diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2017-01-19 12:38:06 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:21 +0000 |
commit | 6cea270c544ceb14cbd44f4e5f4e51c3a3dcb143 (patch) | |
tree | e2ebab9929dce7ad2f22d8266d31ea4702ce7e4a /meta/lib/oeqa | |
parent | 46ce0b5ef3ee623cc9d366f83030363b470ed11e (diff) | |
download | poky-6cea270c544ceb14cbd44f4e5f4e51c3a3dcb143.tar.gz |
selftest/runtime-test.py: Adapt test to use new runtime framework
This adapt the current runtime selftest to use the new runtime
framework.
(From OE-Core rev: cfeec8a59ba03f98944fd3dca1a67d80e7edb4c9)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/runtime-test.py | 42 |
1 files changed, 26 insertions, 16 deletions
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 |