[PATCH 1/3] test: Allow vboot tests to run in parallel

Simon Glass sjg at chromium.org
Mon Feb 8 05:05:40 CET 2021


Update the tests to use separate working directories, so we can run them
in parallel. It also makes it possible to see the individual output files
after the tests have completed.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 test/py/tests/test_vboot.py | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py
index e45800d94c0..fb43c6ef35a 100644
--- a/test/py/tests/test_vboot.py
+++ b/test/py/tests/test_vboot.py
@@ -24,22 +24,23 @@ For configuration verification:
 Tests run with both SHA1 and SHA256 hashing.
 """
 
+import os
 import struct
 import pytest
 import u_boot_utils as util
 import vboot_forge
 
 TESTDATA = [
-    ['sha1', '', None, False],
-    ['sha1', '', '-E -p 0x10000', False],
-    ['sha1', '-pss', None, False],
-    ['sha1', '-pss', '-E -p 0x10000', False],
-    ['sha256', '', None, False],
-    ['sha256', '', '-E -p 0x10000', False],
-    ['sha256', '-pss', None, False],
-    ['sha256', '-pss', '-E -p 0x10000', False],
-    ['sha256', '-pss', None, True],
-    ['sha256', '-pss', '-E -p 0x10000', True],
+    ['sha1-basic', 'sha1', '', None, False],
+    ['sha1-pad', 'sha1', '', '-E -p 0x10000', False],
+    ['sha1-pss', 'sha1', '-pss', None, False],
+    ['sha1-pss-pad', 'sha1', '-pss', '-E -p 0x10000', False],
+    ['sha256-basic', 'sha256', '', None, False],
+    ['sha256-pad', 'sha256', '', '-E -p 0x10000', False],
+    ['sha256-pss', 'sha256', '-pss', None, False],
+    ['sha256-pss-pad', 'sha256', '-pss', '-E -p 0x10000', False],
+    ['sha256-pss-required', 'sha256', '-pss', None, True],
+    ['sha256-pss-pad-required', 'sha256', '-pss', '-E -p 0x10000', True],
 ]
 
 @pytest.mark.boardspec('sandbox')
@@ -48,8 +49,9 @@ TESTDATA = [
 @pytest.mark.requiredtool('fdtget')
 @pytest.mark.requiredtool('fdtput')
 @pytest.mark.requiredtool('openssl')
- at pytest.mark.parametrize("sha_algo,padding,sign_options,required", TESTDATA)
-def test_vboot(u_boot_console, sha_algo, padding, sign_options, required):
+ at pytest.mark.parametrize("name,sha_algo,padding,sign_options,required",
+                         TESTDATA)
+def test_vboot(u_boot_console, name, sha_algo, padding, sign_options, required):
     """Test verified boot signing with mkimage and verification with 'bootm'.
 
     This works using sandbox only as it needs to update the device tree used
@@ -331,7 +333,9 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required):
         run_bootm(sha_algo, 'multi required key', '', False)
 
     cons = u_boot_console
-    tmpdir = cons.config.result_dir + '/'
+    tmpdir = os.path.join(cons.config.result_dir, name) + '/'
+    if not os.path.exists(tmpdir):
+        os.mkdir(tmpdir)
     datadir = cons.config.source_dir + '/test/py/tests/vboot/'
     fit = '%stest.fit' % tmpdir
     mkimage = cons.config.build_dir + '/tools/mkimage'
-- 
2.30.0.478.g8a0d178c01-goog



More information about the U-Boot mailing list