diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-06-19 11:58:43 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-06-21 11:09:56 +0100 |
commit | cb7996ae212372fc7e03fdf710dae6e0f1876344 (patch) | |
tree | 0ff31de416f21a27c7a374db025502f5a8b6ac03 /meta/lib/oeqa/selftest/cases/runtime_test.py | |
parent | 721555184bb6b75fa5b878337fceef560eebdb3d (diff) | |
download | poky-cb7996ae212372fc7e03fdf710dae6e0f1876344.tar.gz |
selftest: do not hardcode /tmp/sdk
This races if there are several copies of the test running at the same
time.
[YOCTO #14438]
(From OE-Core rev: deab11848036941771f2b3dc5cdaee83395280b5)
(From OE-Core rev: ea707e8726cd7012d101d02e69503b7c98bdaf3e)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/runtime_test.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 84c2cb77e8..d0c2440722 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
@@ -14,11 +14,6 @@ from oeqa.core.decorator.data import skipIfNotQemu | |||
14 | 14 | ||
15 | class TestExport(OESelftestTestCase): | 15 | class TestExport(OESelftestTestCase): |
16 | 16 | ||
17 | @classmethod | ||
18 | def tearDownClass(cls): | ||
19 | runCmd("rm -rf /tmp/sdk") | ||
20 | super(TestExport, cls).tearDownClass() | ||
21 | |||
22 | def test_testexport_basic(self): | 17 | def test_testexport_basic(self): |
23 | """ | 18 | """ |
24 | Summary: Check basic testexport functionality with only ping test enabled. | 19 | Summary: Check basic testexport functionality with only ping test enabled. |
@@ -95,19 +90,20 @@ class TestExport(OESelftestTestCase): | |||
95 | msg = "Couldn't find SDK tarball: %s" % tarball_path | 90 | msg = "Couldn't find SDK tarball: %s" % tarball_path |
96 | self.assertEqual(os.path.isfile(tarball_path), True, msg) | 91 | self.assertEqual(os.path.isfile(tarball_path), True, msg) |
97 | 92 | ||
98 | # Extract SDK and run tar from SDK | 93 | with tempfile.TemporaryDirectory() as tmpdirname: |
99 | result = runCmd("%s -y -d /tmp/sdk" % tarball_path) | 94 | # Extract SDK and run tar from SDK |
100 | self.assertEqual(0, result.status, "Couldn't extract SDK") | 95 | result = runCmd("%s -y -d %s" % (tarball_path, tmpdirname)) |
96 | self.assertEqual(0, result.status, "Couldn't extract SDK") | ||
101 | 97 | ||
102 | env_script = result.output.split()[-1] | 98 | env_script = result.output.split()[-1] |
103 | result = runCmd(". %s; which tar" % env_script, shell=True) | 99 | result = runCmd(". %s; which tar" % env_script, shell=True) |
104 | self.assertEqual(0, result.status, "Couldn't setup SDK environment") | 100 | self.assertEqual(0, result.status, "Couldn't setup SDK environment") |
105 | is_sdk_tar = True if "/tmp/sdk" in result.output else False | 101 | is_sdk_tar = True if tmpdirname in result.output else False |
106 | self.assertTrue(is_sdk_tar, "Couldn't setup SDK environment") | 102 | self.assertTrue(is_sdk_tar, "Couldn't setup SDK environment") |
107 | 103 | ||
108 | tar_sdk = result.output | 104 | tar_sdk = result.output |
109 | result = runCmd("%s --version" % tar_sdk) | 105 | result = runCmd("%s --version" % tar_sdk) |
110 | self.assertEqual(0, result.status, "Couldn't run tar from SDK") | 106 | self.assertEqual(0, result.status, "Couldn't run tar from SDK") |
111 | 107 | ||
112 | 108 | ||
113 | class TestImage(OESelftestTestCase): | 109 | class TestImage(OESelftestTestCase): |