diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-06-19 11:58:43 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-10 22:46:19 +0100 |
commit | de1578c82524f11936331bffe9bd9300944a7dfc (patch) | |
tree | 9df1357ddb9d968874df404092cbe426d8e53333 /meta/lib | |
parent | bf8881dac7e78c0fdb41086a9198b6980ebdf3c3 (diff) | |
download | poky-de1578c82524f11936331bffe9bd9300944a7dfc.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: 969c29c39b0ceb73ace615c478ca4544be803c9a)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit ea707e8726cd7012d101d02e69503b7c98bdaf3e)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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 976b513727..353d411681 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): |