summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-08-01 08:16:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-04 15:22:22 +0100
commit44ae8284d03c79deadd89ee5ee7ca75481ab9e53 (patch)
tree6ef8a6c89c1bf3eaa434f3beb21b967143bf2328
parentd2e5c93dba516b85a10e510e65aaad5d77aaa652 (diff)
downloadpoky-44ae8284d03c79deadd89ee5ee7ca75481ab9e53.tar.gz
selftest/runtime-test.py: Add test for testexport SDK feature
This adds test_testexport_sdk() to test the SDK feature of testexport in the CI in order to avoid breaking it. [YOCTO #9765] (From OE-Core rev: badec3d10fcdd2d000450ab533caadcff1df5e13) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta-selftest/lib/oeqa/runtime/selftest.py24
-rw-r--r--meta/lib/oeqa/selftest/runtime-test.py41
2 files changed, 65 insertions, 0 deletions
diff --git a/meta-selftest/lib/oeqa/runtime/selftest.py b/meta-selftest/lib/oeqa/runtime/selftest.py
index b9c9b23bfc..a7e58ab3d5 100644
--- a/meta-selftest/lib/oeqa/runtime/selftest.py
+++ b/meta-selftest/lib/oeqa/runtime/selftest.py
@@ -1,9 +1,13 @@
1import os
2
1from oeqa.oetest import oeRuntimeTest, skipModule 3from oeqa.oetest import oeRuntimeTest, skipModule
4from oeqa.utils.commands import runCmd
2from oeqa.utils.decorators import * 5from oeqa.utils.decorators import *
3 6
4class Selftest(oeRuntimeTest): 7class Selftest(oeRuntimeTest):
5 8
6 @skipUnlessPassed("test_ssh") 9 @skipUnlessPassed("test_ssh")
10 @tag("selftest_package_install")
7 def test_install_package(self): 11 def test_install_package(self):
8 """ 12 """
9 Summary: Check basic package installation functionality. 13 Summary: Check basic package installation functionality.
@@ -18,6 +22,7 @@ class Selftest(oeRuntimeTest):
18 self.assertEqual(status, 0, msg="socat is not installed") 22 self.assertEqual(status, 0, msg="socat is not installed")
19 23
20 @skipUnlessPassed("test_install_package") 24 @skipUnlessPassed("test_install_package")
25 @tag("selftest_package_install")
21 def test_verify_unistall(self): 26 def test_verify_unistall(self):
22 """ 27 """
23 Summary: Check basic package installation functionality. 28 Summary: Check basic package installation functionality.
@@ -29,3 +34,22 @@ class Selftest(oeRuntimeTest):
29 34
30 (status, output) = self.target.run("socat -V") 35 (status, output) = self.target.run("socat -V")
31 self.assertNotEqual(status, 0, msg="socat is still installed") 36 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
48def 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 b8e1be10f8..c2d5b45a4b 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -43,6 +43,46 @@ class TestExport(oeSelfTest):
43 failure = True if 'FAIL' in result.output else False 43 failure = True if 'FAIL' in result.output else False
44 self.assertNotEqual(True, failure, 'ping test failed') 44 self.assertNotEqual(True, failure, 'ping test failed')
45 45
46 def test_testexport_sdk(self):
47 """
48 Summary: Check sdk functionality for testexport.
49 Expected: 1. testexport directory must be created.
50 2. SDK tarball must exists.
51 3. Uncompressing of tarball must succeed.
52 4. Check if the SDK directory is added to PATH.
53 5. Run tar from the SDK directory.
54 Product: oe-core
55 Author: Mariano Lopez <mariano.lopez@intel.com>
56 """
57
58 features = 'INHERIT += "testexport"\n'
59 # These aren't the actual IP addresses but testexport class needs something defined
60 features += 'TEST_SERVER_IP = "192.168.7.1"\n'
61 features += 'TEST_TARGET_IP = "192.168.7.1"\n'
62 features += 'TEST_SUITES = "ping"\n'
63 features += 'TEST_SUITES_TAGS = "selftest_sdk"\n'
64 features += 'TEST_EXPORT_SDK_ENABLED = "1"\n'
65 features += 'TEST_EXPORT_SDK_PACKAGES = "nativesdk-tar"\n'
66 self.write_config(features)
67
68 # Build tesexport for core-image-minimal
69 bitbake('core-image-minimal')
70 bitbake('-c testexport core-image-minimal')
71
72 # Check for SDK
73 testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
74 sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal')
75 tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal')
76 tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name)
77 self.assertEqual(os.path.isfile(tarball_path), True, "Couldn't find SDK tarball: %s" % tarball_path)
78
79 # Run runexported.py
80 runexported_path = os.path.join(testexport_dir, "runexported.py")
81 testdata_path = os.path.join(testexport_dir, "testdata.json")
82 cmd = "%s %s" % (runexported_path, testdata_path)
83 result = runCmd(cmd)
84 self.assertEqual(0, result.status, 'runexported.py returned a non 0 status')
85
46 86
47class TestImage(oeSelfTest): 87class TestImage(oeSelfTest):
48 88
@@ -57,6 +97,7 @@ class TestImage(oeSelfTest):
57 97
58 features = 'INHERIT += "testimage"\n' 98 features = 'INHERIT += "testimage"\n'
59 features += 'TEST_SUITES = "ping ssh selftest"\n' 99 features += 'TEST_SUITES = "ping ssh selftest"\n'
100 features += 'TEST_SUITES_TAGS = "selftest_package_install"\n'
60 self.write_config(features) 101 self.write_config(features)
61 102
62 # Build core-image-sato and testimage 103 # Build core-image-sato and testimage