diff options
-rw-r--r-- | meta-selftest/lib/oeqa/runtime/cases/selftest.json (renamed from meta-selftest/lib/oeqa/runtime/selftest.json) | 0 | ||||
-rw-r--r-- | meta-selftest/lib/oeqa/runtime/cases/selftest.py (renamed from meta-selftest/lib/oeqa/runtime/selftest.py) | 34 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/runtime-test.py | 42 |
3 files changed, 31 insertions, 45 deletions
diff --git a/meta-selftest/lib/oeqa/runtime/selftest.json b/meta-selftest/lib/oeqa/runtime/cases/selftest.json index e5ae46ecd4..e5ae46ecd4 100644 --- a/meta-selftest/lib/oeqa/runtime/selftest.json +++ b/meta-selftest/lib/oeqa/runtime/cases/selftest.json | |||
diff --git a/meta-selftest/lib/oeqa/runtime/selftest.py b/meta-selftest/lib/oeqa/runtime/cases/selftest.py index a7e58ab3d5..329470f153 100644 --- a/meta-selftest/lib/oeqa/runtime/selftest.py +++ b/meta-selftest/lib/oeqa/runtime/cases/selftest.py | |||
@@ -1,13 +1,9 @@ | |||
1 | import os | 1 | from oeqa.runtime.case import OERuntimeTestCase |
2 | from oeqa.core.decorator.depends import OETestDepends | ||
2 | 3 | ||
3 | from oeqa.oetest import oeRuntimeTest, skipModule | 4 | class Selftest(OERuntimeTestCase): |
4 | from oeqa.utils.commands import runCmd | ||
5 | from oeqa.utils.decorators import * | ||
6 | 5 | ||
7 | class Selftest(oeRuntimeTest): | 6 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
8 | |||
9 | @skipUnlessPassed("test_ssh") | ||
10 | @tag("selftest_package_install") | ||
11 | def test_install_package(self): | 7 | def test_install_package(self): |
12 | """ | 8 | """ |
13 | Summary: Check basic package installation functionality. | 9 | Summary: Check basic package installation functionality. |
@@ -21,8 +17,7 @@ class Selftest(oeRuntimeTest): | |||
21 | (status, output) = self.target.run("socat -V") | 17 | (status, output) = self.target.run("socat -V") |
22 | self.assertEqual(status, 0, msg="socat is not installed") | 18 | self.assertEqual(status, 0, msg="socat is not installed") |
23 | 19 | ||
24 | @skipUnlessPassed("test_install_package") | 20 | @OETestDepends(['selftest.Selftest.test_install_package']) |
25 | @tag("selftest_package_install") | ||
26 | def test_verify_unistall(self): | 21 | def test_verify_unistall(self): |
27 | """ | 22 | """ |
28 | Summary: Check basic package installation functionality. | 23 | Summary: Check basic package installation functionality. |
@@ -34,22 +29,3 @@ class Selftest(oeRuntimeTest): | |||
34 | 29 | ||
35 | (status, output) = self.target.run("socat -V") | 30 | (status, output) = self.target.run("socat -V") |
36 | self.assertNotEqual(status, 0, msg="socat is still installed") | 31 | self.assertNotEqual(status, 0, msg="socat is still installed") |
37 | |||
38 | @tag("selftest_sdk") | ||
39 | def test_sdk(self): | ||
40 | |||
41 | result = runCmd("env -0") | ||
42 | sdk_path = search_sdk_path(result.output) | ||
43 | self.assertTrue(sdk_path, msg="Can't find SDK path") | ||
44 | |||
45 | tar_cmd = os.path.join(sdk_path, "tar") | ||
46 | result = runCmd("%s --help" % tar_cmd) | ||
47 | |||
48 | def search_sdk_path(env): | ||
49 | for line in env.split("\0"): | ||
50 | (key, _, value) = line.partition("=") | ||
51 | if key == "PATH": | ||
52 | for path in value.split(":"): | ||
53 | if "pokysdk" in path: | ||
54 | return path | ||
55 | return "" | ||
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py index a105f3f579..9e2ecc60f9 100644 --- a/meta/lib/oeqa/selftest/runtime-test.py +++ b/meta/lib/oeqa/selftest/runtime-test.py | |||
@@ -6,6 +6,10 @@ import re | |||
6 | 6 | ||
7 | class TestExport(oeSelfTest): | 7 | class TestExport(oeSelfTest): |
8 | 8 | ||
9 | @classmethod | ||
10 | def tearDownClass(cls): | ||
11 | runCmd("rm -rf /tmp/sdk") | ||
12 | |||
9 | def test_testexport_basic(self): | 13 | def test_testexport_basic(self): |
10 | """ | 14 | """ |
11 | Summary: Check basic testexport functionality with only ping test enabled. | 15 | Summary: Check basic testexport functionality with only ping test enabled. |
@@ -34,15 +38,15 @@ class TestExport(oeSelfTest): | |||
34 | 38 | ||
35 | with runqemu('core-image-minimal') as qemu: | 39 | with runqemu('core-image-minimal') as qemu: |
36 | # Attempt to run runexported.py to perform ping test | 40 | # Attempt to run runexported.py to perform ping test |
37 | runexported_path = os.path.join(testexport_dir, "runexported.py") | 41 | test_path = os.path.join(testexport_dir, "oe-test") |
38 | testdata_path = os.path.join(testexport_dir, "testdata.json") | 42 | data_file = os.path.join(testexport_dir, 'data', 'testdata.json') |
39 | cmd = "%s -t %s -s %s %s" % (runexported_path, qemu.ip, qemu.server_ip, testdata_path) | 43 | manifest = os.path.join(testexport_dir, 'data', 'manifest') |
44 | cmd = ("%s runtime --test-data-file %s --packages-manifest %s " | ||
45 | "--target-ip %s --server-ip %s --quiet" | ||
46 | % (test_path, data_file, manifest, qemu.ip, qemu.server_ip)) | ||
40 | result = runCmd(cmd) | 47 | result = runCmd(cmd) |
41 | self.assertEqual(0, result.status, 'runexported.py returned a non 0 status') | ||
42 | |||
43 | # Verify ping test was succesful | 48 | # Verify ping test was succesful |
44 | failure = True if 'FAIL' in result.output else False | 49 | self.assertEqual(0, result.status, 'oe-test runtime returned a non 0 status') |
45 | self.assertNotEqual(True, failure, 'ping test failed') | ||
46 | 50 | ||
47 | def test_testexport_sdk(self): | 51 | def test_testexport_sdk(self): |
48 | """ | 52 | """ |
@@ -61,7 +65,6 @@ class TestExport(oeSelfTest): | |||
61 | features += 'TEST_SERVER_IP = "192.168.7.1"\n' | 65 | features += 'TEST_SERVER_IP = "192.168.7.1"\n' |
62 | features += 'TEST_TARGET_IP = "192.168.7.1"\n' | 66 | features += 'TEST_TARGET_IP = "192.168.7.1"\n' |
63 | features += 'TEST_SUITES = "ping"\n' | 67 | features += 'TEST_SUITES = "ping"\n' |
64 | features += 'TEST_SUITES_TAGS = "selftest_sdk"\n' | ||
65 | features += 'TEST_EXPORT_SDK_ENABLED = "1"\n' | 68 | features += 'TEST_EXPORT_SDK_ENABLED = "1"\n' |
66 | features += 'TEST_EXPORT_SDK_PACKAGES = "nativesdk-tar"\n' | 69 | features += 'TEST_EXPORT_SDK_PACKAGES = "nativesdk-tar"\n' |
67 | self.write_config(features) | 70 | self.write_config(features) |
@@ -75,14 +78,22 @@ class TestExport(oeSelfTest): | |||
75 | sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal') | 78 | sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal') |
76 | tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal') | 79 | tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal') |
77 | tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name) | 80 | tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name) |
78 | self.assertEqual(os.path.isfile(tarball_path), True, "Couldn't find SDK tarball: %s" % tarball_path) | 81 | msg = "Couldn't find SDK tarball: %s" % tarball_path |
82 | self.assertEqual(os.path.isfile(tarball_path), True, msg) | ||
83 | |||
84 | # Extract SDK and run tar from SDK | ||
85 | result = runCmd("%s -y -d /tmp/sdk" % tarball_path) | ||
86 | self.assertEqual(0, result.status, "Couldn't extract SDK") | ||
87 | |||
88 | env_script = result.output.split()[-1] | ||
89 | result = runCmd(". %s; which tar" % env_script, shell=True) | ||
90 | self.assertEqual(0, result.status, "Couldn't setup SDK environment") | ||
91 | is_sdk_tar = True if "/tmp/sdk" in result.output else False | ||
92 | self.assertTrue(is_sdk_tar, "Couldn't setup SDK environment") | ||
79 | 93 | ||
80 | # Run runexported.py | 94 | tar_sdk = result.output |
81 | runexported_path = os.path.join(testexport_dir, "runexported.py") | 95 | result = runCmd("%s --version" % tar_sdk) |
82 | testdata_path = os.path.join(testexport_dir, "testdata.json") | 96 | self.assertEqual(0, result.status, "Couldn't run tar from SDK") |
83 | cmd = "%s %s" % (runexported_path, testdata_path) | ||
84 | result = runCmd(cmd) | ||
85 | self.assertEqual(0, result.status, 'runexported.py returned a non 0 status') | ||
86 | 97 | ||
87 | 98 | ||
88 | class TestImage(oeSelfTest): | 99 | class TestImage(oeSelfTest): |
@@ -100,7 +111,6 @@ class TestImage(oeSelfTest): | |||
100 | 111 | ||
101 | features = 'INHERIT += "testimage"\n' | 112 | features = 'INHERIT += "testimage"\n' |
102 | features += 'TEST_SUITES = "ping ssh selftest"\n' | 113 | features += 'TEST_SUITES = "ping ssh selftest"\n' |
103 | features += 'TEST_SUITES_TAGS = "selftest_package_install"\n' | ||
104 | self.write_config(features) | 114 | self.write_config(features) |
105 | 115 | ||
106 | # Build core-image-sato and testimage | 116 | # Build core-image-sato and testimage |