All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test/py: Add test case for mkimage -o argument
@ 2022-02-03 20:43 Jan Kiszka
  2022-02-04 15:24 ` Simon Glass
  2022-02-11 17:05 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2022-02-03 20:43 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List

From: Jan Kiszka <jan.kiszka@siemens.com>

Stress the '-o algo_name' argument of mkimage by expanding the vboot
test.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 test/py/tests/test_vboot.py                   | 33 +++++++-------
 test/py/tests/vboot/sign-configs-algo-arg.its | 44 +++++++++++++++++++
 test/py/tests/vboot/sign-images-algo-arg.its  | 40 +++++++++++++++++
 3 files changed, 101 insertions(+), 16 deletions(-)
 create mode 100644 test/py/tests/vboot/sign-configs-algo-arg.its
 create mode 100644 test/py/tests/vboot/sign-images-algo-arg.its

diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py
index b080d482af9..ac8ed9f1145 100644
--- a/test/py/tests/test_vboot.py
+++ b/test/py/tests/test_vboot.py
@@ -35,18 +35,19 @@ import vboot_evil
 # Only run the full suite on a few combinations, since it doesn't add any more
 # test coverage.
 TESTDATA = [
-    ['sha1-basic', 'sha1', '', None, False, True],
-    ['sha1-pad', 'sha1', '', '-E -p 0x10000', False, False],
-    ['sha1-pss', 'sha1', '-pss', None, False, False],
-    ['sha1-pss-pad', 'sha1', '-pss', '-E -p 0x10000', False, False],
-    ['sha256-basic', 'sha256', '', None, False, False],
-    ['sha256-pad', 'sha256', '', '-E -p 0x10000', False, False],
-    ['sha256-pss', 'sha256', '-pss', None, False, False],
-    ['sha256-pss-pad', 'sha256', '-pss', '-E -p 0x10000', False, False],
-    ['sha256-pss-required', 'sha256', '-pss', None, True, False],
-    ['sha256-pss-pad-required', 'sha256', '-pss', '-E -p 0x10000', True, True],
-    ['sha384-basic', 'sha384', '', None, False, False],
-    ['sha384-pad', 'sha384', '', '-E -p 0x10000', False, False],
+    ['sha1-basic', 'sha1', '', None, False, True, False],
+    ['sha1-pad', 'sha1', '', '-E -p 0x10000', False, False, False],
+    ['sha1-pss', 'sha1', '-pss', None, False, False, False],
+    ['sha1-pss-pad', 'sha1', '-pss', '-E -p 0x10000', False, False, False],
+    ['sha256-basic', 'sha256', '', None, False, False, False],
+    ['sha256-pad', 'sha256', '', '-E -p 0x10000', False, False, False],
+    ['sha256-pss', 'sha256', '-pss', None, False, False, False],
+    ['sha256-pss-pad', 'sha256', '-pss', '-E -p 0x10000', False, False, False],
+    ['sha256-pss-required', 'sha256', '-pss', None, True, False, False],
+    ['sha256-pss-pad-required', 'sha256', '-pss', '-E -p 0x10000', True, True, False],
+    ['sha384-basic', 'sha384', '', None, False, False, False],
+    ['sha384-pad', 'sha384', '', '-E -p 0x10000', False, False, False],
+    ['algo-arg', 'algo-arg', '', '-o sha256,rsa2048', False, False, True],
 ]
 
 @pytest.mark.boardspec('sandbox')
@@ -55,10 +56,10 @@ TESTDATA = [
 @pytest.mark.requiredtool('fdtget')
 @pytest.mark.requiredtool('fdtput')
 @pytest.mark.requiredtool('openssl')
-@pytest.mark.parametrize("name,sha_algo,padding,sign_options,required,full_test",
+@pytest.mark.parametrize("name,sha_algo,padding,sign_options,required,full_test,algo_arg",
                          TESTDATA)
 def test_vboot(u_boot_console, name, sha_algo, padding, sign_options, required,
-               full_test):
+               full_test, algo_arg):
     """Test verified boot signing with mkimage and verification with 'bootm'.
 
     This works using sandbox only as it needs to update the device tree used
@@ -219,7 +220,7 @@ def test_vboot(u_boot_console, name, sha_algo, padding, sign_options, required,
         # Build the FIT, but don't sign anything yet
         cons.log.action('%s: Test FIT with signed images' % sha_algo)
         make_fit('sign-images-%s%s.its' % (sha_algo, padding))
-        run_bootm(sha_algo, 'unsigned images', 'dev-', True)
+        run_bootm(sha_algo, 'unsigned images', ' - OK' if algo_arg else 'dev-', True)
 
         # Sign images with our dev keys
         sign_fit(sha_algo, sign_options)
@@ -230,7 +231,7 @@ def test_vboot(u_boot_console, name, sha_algo, padding, sign_options, required,
 
         cons.log.action('%s: Test FIT with signed configuration' % sha_algo)
         make_fit('sign-configs-%s%s.its' % (sha_algo, padding))
-        run_bootm(sha_algo, 'unsigned config', '%s+ OK' % sha_algo, True)
+        run_bootm(sha_algo, 'unsigned config', '%s+ OK' % ('sha256' if algo_arg else sha_algo), True)
 
         # Sign images with our dev keys
         sign_fit(sha_algo, sign_options)
diff --git a/test/py/tests/vboot/sign-configs-algo-arg.its b/test/py/tests/vboot/sign-configs-algo-arg.its
new file mode 100644
index 00000000000..3a5bb6d0f73
--- /dev/null
+++ b/test/py/tests/vboot/sign-configs-algo-arg.its
@@ -0,0 +1,44 @@
+/dts-v1/;
+
+/ {
+	description = "Chrome OS kernel image with one or more FDT blobs";
+	#address-cells = <1>;
+
+	images {
+		kernel {
+			data = /incbin/("test-kernel.bin");
+			type = "kernel_noload";
+			arch = "sandbox";
+			os = "linux";
+			compression = "none";
+			load = <0x4>;
+			entry = <0x8>;
+			kernel-version = <1>;
+			hash-1 {
+				algo = "sha256";
+			};
+		};
+		fdt-1 {
+			description = "snow";
+			data = /incbin/("sandbox-kernel.dtb");
+			type = "flat_dt";
+			arch = "sandbox";
+			compression = "none";
+			fdt-version = <1>;
+			hash-1 {
+				algo = "sha256";
+			};
+		};
+	};
+	configurations {
+		default = "conf-1";
+		conf-1 {
+			kernel = "kernel";
+			fdt = "fdt-1";
+			signature {
+				key-name-hint = "dev";
+				sign-images = "fdt", "kernel";
+			};
+		};
+	};
+};
diff --git a/test/py/tests/vboot/sign-images-algo-arg.its b/test/py/tests/vboot/sign-images-algo-arg.its
new file mode 100644
index 00000000000..9144c8b5ad8
--- /dev/null
+++ b/test/py/tests/vboot/sign-images-algo-arg.its
@@ -0,0 +1,40 @@
+/dts-v1/;
+
+/ {
+	description = "Chrome OS kernel image with one or more FDT blobs";
+	#address-cells = <1>;
+
+	images {
+		kernel {
+			data = /incbin/("test-kernel.bin");
+			type = "kernel_noload";
+			arch = "sandbox";
+			os = "linux";
+			compression = "none";
+			load = <0x4>;
+			entry = <0x8>;
+			kernel-version = <1>;
+			signature {
+				key-name-hint = "dev";
+			};
+		};
+		fdt-1 {
+			description = "snow";
+			data = /incbin/("sandbox-kernel.dtb");
+			type = "flat_dt";
+			arch = "sandbox";
+			compression = "none";
+			fdt-version = <1>;
+			signature {
+				key-name-hint = "dev";
+			};
+		};
+	};
+	configurations {
+		default = "conf-1";
+		conf-1 {
+			kernel = "kernel";
+			fdt = "fdt-1";
+		};
+	};
+};
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test/py: Add test case for mkimage -o argument
  2022-02-03 20:43 [PATCH] test/py: Add test case for mkimage -o argument Jan Kiszka
@ 2022-02-04 15:24 ` Simon Glass
  2022-02-11 17:05 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-02-04 15:24 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: U-Boot Mailing List

On Thu, 3 Feb 2022 at 13:43, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Stress the '-o algo_name' argument of mkimage by expanding the vboot
> test.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  test/py/tests/test_vboot.py                   | 33 +++++++-------
>  test/py/tests/vboot/sign-configs-algo-arg.its | 44 +++++++++++++++++++
>  test/py/tests/vboot/sign-images-algo-arg.its  | 40 +++++++++++++++++
>  3 files changed, 101 insertions(+), 16 deletions(-)
>  create mode 100644 test/py/tests/vboot/sign-configs-algo-arg.its
>  create mode 100644 test/py/tests/vboot/sign-images-algo-arg.its
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test/py: Add test case for mkimage -o argument
  2022-02-03 20:43 [PATCH] test/py: Add test case for mkimage -o argument Jan Kiszka
  2022-02-04 15:24 ` Simon Glass
@ 2022-02-11 17:05 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-02-11 17:05 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Simon Glass, U-Boot Mailing List

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

On Thu, Feb 03, 2022 at 09:43:50PM +0100, Jan Kiszka wrote:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Stress the '-o algo_name' argument of mkimage by expanding the vboot
> test.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

First, this is now applied to u-boot/master.  Second, I updated
scripts/pylint.base as this lowered the score from 6.08 to 6.01, but
given both Simon's review and a quick skim of the differences, that's
not a meaningful to me change that pylint is showing.  I bring this up
only because it's another example of why I think the pylint focus really
does need to be on major errors only at least for now.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-11 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 20:43 [PATCH] test/py: Add test case for mkimage -o argument Jan Kiszka
2022-02-04 15:24 ` Simon Glass
2022-02-11 17:05 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.