1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

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]

(From OE-Core rev: aa5b9edbd9c4495befe1912a5b401b536be39d5b)

Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jose Perez Carranza
2017-09-01 13:30:24 -07:00
committed by Richard Purdie
parent 3c492afe4f
commit 1d5d4165a5
5 changed files with 25 additions and 1 deletions
+2 -1
View File
@@ -40,7 +40,7 @@ class Archiver(OESelftestTestCase):
excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe))
self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe)
@OETestID(1900)
def test_archiver_filters_by_type(self): def test_archiver_filters_by_type(self):
""" """
Summary: The archiver is documented to filter on the recipe type. 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)) excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipe))
self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe) self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe)
@OETestID(1901)
def test_archiver_filters_by_type_and_name(self): def test_archiver_filters_by_type_and_name(self):
""" """
Summary: Test that the archiver archives by recipe type, taking the Summary: Test that the archiver archives by recipe type, taking the
@@ -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.commands import runCmd, bitbake, get_bb_var, get_bb_vars
from oeqa.utils.decorators import testcase from oeqa.utils.decorators import testcase
from oeqa.utils.ftools import write_file from oeqa.utils.ftools import write_file
from oeqa.core.decorator.oeid import OETestID
class Distrodata(OESelftestTestCase): class Distrodata(OESelftestTestCase):
@@ -9,6 +10,7 @@ class Distrodata(OESelftestTestCase):
def setUpClass(cls): def setUpClass(cls):
super(Distrodata, cls).setUpClass() super(Distrodata, cls).setUpClass()
@OETestID(1902)
def test_checkpkg(self): def test_checkpkg(self):
""" """
Summary: Test that upstream version checks do not regress Summary: Test that upstream version checks do not regress
@@ -131,6 +131,7 @@ class ImageFeatures(OESelftestTestCase):
# check if the resulting gzip is valid # check if the resulting gzip is valid
self.assertTrue(runCmd('gzip -t %s' % gzip_path)) self.assertTrue(runCmd('gzip -t %s' % gzip_path))
@OETestID(1903)
def test_hypervisor_fmts(self): def test_hypervisor_fmts(self):
""" """
Summary: Check various hypervisor formats Summary: Check various hypervisor formats
@@ -165,6 +166,7 @@ class ImageFeatures(OESelftestTestCase):
native_sysroot=sysroot) native_sysroot=sysroot)
self.assertTrue(json.loads(result.output).get('format') == itype) self.assertTrue(json.loads(result.output).get('format') == itype)
@OETestID(1905)
def test_long_chain_conversion(self): def test_long_chain_conversion(self):
""" """
Summary: Check for chaining many CONVERSION_CMDs together 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' % self.assertTrue(runCmd('cd %s;sha256sum -c %s.%s.sha256sum' %
(deploy_dir_image, link_name, conv))) (deploy_dir_image, link_name, conv)))
@OETestID(1904)
def test_image_fstypes(self): def test_image_fstypes(self):
""" """
Summary: Check if image of supported image fstypes can be built Summary: Check if image of supported image fstypes can be built
+17
View File
@@ -1,6 +1,7 @@
from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd from oeqa.utils.commands import runCmd
from oeqa.utils import CommandError from oeqa.utils import CommandError
from oeqa.core.decorator.oeid import OETestID
import subprocess import subprocess
import threading import threading
@@ -26,49 +27,60 @@ class RunCmdTests(OESelftestTestCase):
TIMEOUT = 2 TIMEOUT = 2
DELTA = 1 DELTA = 1
@OETestID(1916)
def test_result_okay(self): def test_result_okay(self):
result = runCmd("true") result = runCmd("true")
self.assertEqual(result.status, 0) self.assertEqual(result.status, 0)
@OETestID(1915)
def test_result_false(self): def test_result_false(self):
result = runCmd("false", ignore_status=True) result = runCmd("false", ignore_status=True)
self.assertEqual(result.status, 1) self.assertEqual(result.status, 1)
@OETestID(1917)
def test_shell(self): def test_shell(self):
# A shell is used for all string commands. # A shell is used for all string commands.
result = runCmd("false; true", ignore_status=True) result = runCmd("false; true", ignore_status=True)
self.assertEqual(result.status, 0) self.assertEqual(result.status, 0)
@OETestID(1910)
def test_no_shell(self): def test_no_shell(self):
self.assertRaises(FileNotFoundError, self.assertRaises(FileNotFoundError,
runCmd, "false; true", shell=False) runCmd, "false; true", shell=False)
@OETestID(1906)
def test_list_not_found(self): def test_list_not_found(self):
self.assertRaises(FileNotFoundError, self.assertRaises(FileNotFoundError,
runCmd, ["false; true"]) runCmd, ["false; true"])
@OETestID(1907)
def test_list_okay(self): def test_list_okay(self):
result = runCmd(["true"]) result = runCmd(["true"])
self.assertEqual(result.status, 0) self.assertEqual(result.status, 0)
@OETestID(1913)
def test_result_assertion(self): def test_result_assertion(self):
self.assertRaisesRegexp(AssertionError, "Command 'echo .* false' returned non-zero exit status 1:\nfoobar", self.assertRaisesRegexp(AssertionError, "Command 'echo .* false' returned non-zero exit status 1:\nfoobar",
runCmd, "echo foobar >&2; false", shell=True) runCmd, "echo foobar >&2; false", shell=True)
@OETestID(1914)
def test_result_exception(self): def test_result_exception(self):
self.assertRaisesRegexp(CommandError, "Command 'echo .* false' returned non-zero exit status 1 with output: foobar", 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) runCmd, "echo foobar >&2; false", shell=True, assert_error=False)
@OETestID(1911)
def test_output(self): def test_output(self):
result = runCmd("echo stdout; echo stderr >&2", shell=True) result = runCmd("echo stdout; echo stderr >&2", shell=True)
self.assertEqual("stdout\nstderr", result.output) self.assertEqual("stdout\nstderr", result.output)
self.assertEqual("", result.error) self.assertEqual("", result.error)
@OETestID(1912)
def test_output_split(self): def test_output_split(self):
result = runCmd("echo stdout; echo stderr >&2", shell=True, stderr=subprocess.PIPE) result = runCmd("echo stdout; echo stderr >&2", shell=True, stderr=subprocess.PIPE)
self.assertEqual("stdout", result.output) self.assertEqual("stdout", result.output)
self.assertEqual("stderr", result.error) self.assertEqual("stderr", result.error)
@OETestID(1920)
def test_timeout(self): def test_timeout(self):
numthreads = threading.active_count() numthreads = threading.active_count()
start = time.time() start = time.time()
@@ -79,6 +91,7 @@ class RunCmdTests(OESelftestTestCase):
self.assertLess(end - start, self.TIMEOUT + self.DELTA) self.assertLess(end - start, self.TIMEOUT + self.DELTA)
self.assertEqual(numthreads, threading.active_count()) self.assertEqual(numthreads, threading.active_count())
@OETestID(1921)
def test_timeout_split(self): def test_timeout_split(self):
numthreads = threading.active_count() numthreads = threading.active_count()
start = time.time() start = time.time()
@@ -89,12 +102,14 @@ class RunCmdTests(OESelftestTestCase):
self.assertLess(end - start, self.TIMEOUT + self.DELTA) self.assertLess(end - start, self.TIMEOUT + self.DELTA)
self.assertEqual(numthreads, threading.active_count()) self.assertEqual(numthreads, threading.active_count())
@OETestID(1918)
def test_stdin(self): def test_stdin(self):
numthreads = threading.active_count() numthreads = threading.active_count()
result = runCmd("cat", data=b"hello world", timeout=self.TIMEOUT) result = runCmd("cat", data=b"hello world", timeout=self.TIMEOUT)
self.assertEqual("hello world", result.output) self.assertEqual("hello world", result.output)
self.assertEqual(numthreads, threading.active_count()) self.assertEqual(numthreads, threading.active_count())
@OETestID(1919)
def test_stdin_timeout(self): def test_stdin_timeout(self):
numthreads = threading.active_count() numthreads = threading.active_count()
start = time.time() start = time.time()
@@ -104,12 +119,14 @@ class RunCmdTests(OESelftestTestCase):
self.assertLess(end - start, self.TIMEOUT + self.DELTA) self.assertLess(end - start, self.TIMEOUT + self.DELTA)
self.assertEqual(numthreads, threading.active_count()) self.assertEqual(numthreads, threading.active_count())
@OETestID(1908)
def test_log(self): def test_log(self):
log = MemLogger() log = MemLogger()
result = runCmd("echo stdout; echo stderr >&2", shell=True, output_log=log) 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(["Running: echo stdout; echo stderr >&2", "stdout", "stderr"], log.info_msgs)
self.assertEqual([], log.error_msgs) self.assertEqual([], log.error_msgs)
@OETestID(1909)
def test_log_split(self): def test_log_split(self):
log = MemLogger() log = MemLogger()
result = runCmd("echo stdout; echo stderr >&2", shell=True, output_log=log, stderr=subprocess.PIPE) result = runCmd("echo stdout; echo stderr >&2", shell=True, output_log=log, stderr=subprocess.PIPE)
+1
View File
@@ -920,6 +920,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
self.assertNotIn('\nBZIMAGE ', result.output) self.assertNotIn('\nBZIMAGE ', result.output)
self.assertNotIn('\nEFI <DIR> ', result.output) self.assertNotIn('\nEFI <DIR> ', result.output)
@OETestID(1922)
def test_mkfs_extraopts(self): def test_mkfs_extraopts(self):
"""Test wks option --mkfs-extraopts for empty and not empty partitions""" """Test wks option --mkfs-extraopts for empty and not empty partitions"""
img = 'core-image-minimal' img = 'core-image-minimal'