diff mbox series

[ACT] UBUNTU: SAUCE: ubuntu_seccomp: run sub-tests one-by-one

Message ID 20211019055847.127732-1-po-hsu.lin@canonical.com
State New
Headers show
Series [ACT] UBUNTU: SAUCE: ubuntu_seccomp: run sub-tests one-by-one | expand

Commit Message

Po-Hsu Lin Oct. 19, 2021, 5:58 a.m. UTC
Use the regression script in the tests directory to run sub-tests
one-by-one. So that failed test case can be hinted more precisely.

Tested on a bare-metal system and the test result is consistent with
the `make check` command.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 ubuntu_seccomp/control           | 13 +++++++++----
 ubuntu_seccomp/ubuntu_seccomp.py |  4 ++--
 2 files changed, 11 insertions(+), 6 deletions(-)

Comments

Po-Hsu Lin Oct. 27, 2021, 2:35 a.m. UTC | #1
Applied and pushed.

Thanks
Sam
diff mbox series

Patch

diff --git a/ubuntu_seccomp/control b/ubuntu_seccomp/control
index afba3b3d..fc71a215 100644
--- a/ubuntu_seccomp/control
+++ b/ubuntu_seccomp/control
@@ -1,5 +1,5 @@ 
 AUTHOR = "Ubuntu"
-NAME = "seccomp"
+NAME = "ubuntu_seccomp"
 CRITERIA = """
 Uses Kees Cook's seccomp tests.
 """
@@ -10,12 +10,17 @@  TEST_CATEGORY = 'Functional'
 TEST_TYPE = "client"
 DOC = ""
 
-name = 'ubuntu_seccomp'
 
-result = job.run_test_detail('ubuntu_seccomp', test_name='setup', tag='setup', timeout=60*20)
+result = job.run_test_detail(NAME, test_name='setup', tag='setup', timeout=60*20)
 if result == 'ERROR':
     print("ERROR: test failed to build, skipping all the sub tests")
 else:
-    result = job.run_test_detail('ubuntu_seccomp', test_name='seccomp', tag='seccomp', timeout=60*40)
+    tests_dir = os.path.join(job.bindir, 'tmp', NAME, 'src', 'libseccomp', 'tests')
+    files_list = os.listdir(tests_dir)
+    files_list.sort()
+    for test in files_list:
+        if test.endswith('.tests'):
+            target = test.replace('.tests', '')
+            job.run_test_detail(NAME, test_name=target, tag=target, timeout=60*3)
 
 # vi:set ts=4 sw=4 expandtab syntax=python:
diff --git a/ubuntu_seccomp/ubuntu_seccomp.py b/ubuntu_seccomp/ubuntu_seccomp.py
index d59e31a7..214bd4b4 100644
--- a/ubuntu_seccomp/ubuntu_seccomp.py
+++ b/ubuntu_seccomp/ubuntu_seccomp.py
@@ -59,7 +59,7 @@  class ubuntu_seccomp(test.test):
             return
         os.chdir(os.path.join(self.srcdir, 'libseccomp', 'tests'))
 
-        cmd = 'make check'
-        self.results = utils.system_output(cmd, retain_output=True)
+        cmd = 'time ./regression -b {}'.format(test_name)
+        print(utils.system_output(cmd, verbose=False))
 
 # vi:set ts=4 sw=4 expandtab syntax=python: