From aa5b9edbd9c4495befe1912a5b401b536be39d5b Mon Sep 17 00:00:00 2001 From: Jose Perez Carranza Date: Fri, 1 Sep 2017 13:30:24 -0700 Subject: oeqa/selftest: Add missing IDs to various test cases Add decorator @OETestID() with Tesopia TC-ID to the test cases that did not have it properly set. [YOCTO #11873] Signed-off-by: Jose Perez Carranza Signed-off-by: Ross Burton --- meta/lib/oeqa/selftest/cases/archiver.py | 3 ++- meta/lib/oeqa/selftest/cases/distrodata.py | 2 ++ meta/lib/oeqa/selftest/cases/imagefeatures.py | 3 +++ meta/lib/oeqa/selftest/cases/runcmd.py | 17 +++++++++++++++++ meta/lib/oeqa/selftest/cases/wic.py | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) (limited to 'meta/lib') diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index 72026d573c..f61a522017 100644 --- a/meta/lib/oeqa/selftest/cases/archiver.py +++ b/meta/lib/oeqa/selftest/cases/archiver.py @@ -40,7 +40,7 @@ class Archiver(OESelftestTestCase): excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) - + @OETestID(1900) def test_archiver_filters_by_type(self): """ Summary: The archiver is documented to filter on the recipe type. @@ -73,6 +73,7 @@ class Archiver(OESelftestTestCase): excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipe)) self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe) + @OETestID(1901) def test_archiver_filters_by_type_and_name(self): """ Summary: Test that the archiver archives by recipe type, taking the diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py index ecb15d9aea..12540adc7d 100644 --- a/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/meta/lib/oeqa/selftest/cases/distrodata.py @@ -2,6 +2,7 @@ from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars from oeqa.utils.decorators import testcase from oeqa.utils.ftools import write_file +from oeqa.core.decorator.oeid import OETestID class Distrodata(OESelftestTestCase): @@ -9,6 +10,7 @@ class Distrodata(OESelftestTestCase): def setUpClass(cls): super(Distrodata, cls).setUpClass() + @OETestID(1902) def test_checkpkg(self): """ Summary: Test that upstream version checks do not regress diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py index bb2e0dba4c..1a850008ef 100644 --- a/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -131,6 +131,7 @@ class ImageFeatures(OESelftestTestCase): # check if the resulting gzip is valid self.assertTrue(runCmd('gzip -t %s' % gzip_path)) + @OETestID(1903) def test_hypervisor_fmts(self): """ Summary: Check various hypervisor formats @@ -165,6 +166,7 @@ class ImageFeatures(OESelftestTestCase): native_sysroot=sysroot) self.assertTrue(json.loads(result.output).get('format') == itype) + @OETestID(1905) def test_long_chain_conversion(self): """ Summary: Check for chaining many CONVERSION_CMDs together @@ -196,6 +198,7 @@ class ImageFeatures(OESelftestTestCase): self.assertTrue(runCmd('cd %s;sha256sum -c %s.%s.sha256sum' % (deploy_dir_image, link_name, conv))) + @OETestID(1904) def test_image_fstypes(self): """ Summary: Check if image of supported image fstypes can be built diff --git a/meta/lib/oeqa/selftest/cases/runcmd.py b/meta/lib/oeqa/selftest/cases/runcmd.py index 6c785caadc..d76d7063c6 100644 --- a/meta/lib/oeqa/selftest/cases/runcmd.py +++ b/meta/lib/oeqa/selftest/cases/runcmd.py @@ -1,6 +1,7 @@ from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd from oeqa.utils import CommandError +from oeqa.core.decorator.oeid import OETestID import subprocess import threading @@ -26,49 +27,60 @@ class RunCmdTests(OESelftestTestCase): TIMEOUT = 2 DELTA = 1 + @OETestID(1916) def test_result_okay(self): result = runCmd("true") self.assertEqual(result.status, 0) + @OETestID(1915) def test_result_false(self): result = runCmd("false", ignore_status=True) self.assertEqual(result.status, 1) + @OETestID(1917) def test_shell(self): # A shell is used for all string commands. result = runCmd("false; true", ignore_status=True) self.assertEqual(result.status, 0) + @OETestID(1910) def test_no_shell(self): self.assertRaises(FileNotFoundError, runCmd, "false; true", shell=False) + @OETestID(1906) def test_list_not_found(self): self.assertRaises(FileNotFoundError, runCmd, ["false; true"]) + @OETestID(1907) def test_list_okay(self): result = runCmd(["true"]) self.assertEqual(result.status, 0) + @OETestID(1913) def test_result_assertion(self): self.assertRaisesRegexp(AssertionError, "Command 'echo .* false' returned non-zero exit status 1:\nfoobar", runCmd, "echo foobar >&2; false", shell=True) + @OETestID(1914) def test_result_exception(self): self.assertRaisesRegexp(CommandError, "Command 'echo .* false' returned non-zero exit status 1 with output: foobar", runCmd, "echo foobar >&2; false", shell=True, assert_error=False) + @OETestID(1911) def test_output(self): result = runCmd("echo stdout; echo stderr >&2", shell=True) self.assertEqual("stdout\nstderr", result.output) self.assertEqual("", result.error) + @OETestID(1912) def test_output_split(self): result = runCmd("echo stdout; echo stderr >&2", shell=True, stderr=subprocess.PIPE) self.assertEqual("stdout", result.output) self.assertEqual("stderr", result.error) + @OETestID(1920) def test_timeout(self): numthreads = threading.active_count() start = time.time() @@ -79,6 +91,7 @@ class RunCmdTests(OESelftestTestCase): self.assertLess(end - start, self.TIMEOUT + self.DELTA) self.assertEqual(numthreads, threading.active_count()) + @OETestID(1921) def test_timeout_split(self): numthreads = threading.active_count() start = time.time() @@ -89,12 +102,14 @@ class RunCmdTests(OESelftestTestCase): self.assertLess(end - start, self.TIMEOUT + self.DELTA) self.assertEqual(numthreads, threading.active_count()) + @OETestID(1918) def test_stdin(self): numthreads = threading.active_count() result = runCmd("cat", data=b"hello world", timeout=self.TIMEOUT) self.assertEqual("hello world", result.output) self.assertEqual(numthreads, threading.active_count()) + @OETestID(1919) def test_stdin_timeout(self): numthreads = threading.active_count() start = time.time() @@ -104,12 +119,14 @@ class RunCmdTests(OESelftestTestCase): self.assertLess(end - start, self.TIMEOUT + self.DELTA) self.assertEqual(numthreads, threading.active_count()) + @OETestID(1908) def test_log(self): log = MemLogger() result = runCmd("echo stdout; echo stderr >&2", shell=True, output_log=log) self.assertEqual(["Running: echo stdout; echo stderr >&2", "stdout", "stderr"], log.info_msgs) self.assertEqual([], log.error_msgs) + @OETestID(1909) def test_log_split(self): log = MemLogger() result = runCmd("echo stdout; echo stderr >&2", shell=True, output_log=log, stderr=subprocess.PIPE) diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index aa73ba4f7e..fc19a3f211 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -920,6 +920,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r self.assertNotIn('\nBZIMAGE ', result.output) self.assertNotIn('\nEFI ', result.output) + @OETestID(1922) def test_mkfs_extraopts(self): """Test wks option --mkfs-extraopts for empty and not empty partitions""" img = 'core-image-minimal' -- cgit 1.2.3-korg