selftest: fix to not hardcode 'tmp' for TMPDIR
cover selftest: fix to not hardcode 'tmp' for TMPDIR
The following changes since commit e016eb10b075e280b4e78a04e47b59a173386421:
bitbake: bb/cooker: BBCooker stops notifier at shutdown (2017-01-06 00:01:07 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/selftest-tmp_dir
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/selftest-tmp_dir
Chen Qi (2):
selftest/bbtests.py: do not hardcode 'tmp' for TMPDIR selftest/buildoptions.py: do not hardcode 'tmp' for TMPDIR
meta/lib/oeqa/selftest/bbtests.py | 5 +++-- meta/lib/oeqa/selftest/buildoptions.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 selftest/bbtests.py: do not hardcode 'tmp' for TMPDIR
Use the value of TMPDIR instead of hardcoding 'tmp'.
In fact, in OE, we have:
TCLIBCAPPEND ?= "-${TCLIBC}"
TMPDIR .= "${TCLIBCAPPEND}"
So the TMPDIR defaults to have ${TCLIBC} in it.
--- meta/lib/oeqa/selftest/bbtests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/bbtests.py +3 -2
@@ -235,8 +235,9 @@ INHERIT_remove = \"report-error\" self.addCleanup(ftools.remove_from_file, conf ,data) result = bitbake('readline', ignore_status=True) self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output)) - self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3'))) - self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2'))) + tmp_dir = get_bb_var('TMPDIR') + self.assertFalse(os.path.isfile(os.path.join(tmp_dir, 'deploy/licenses/readline/generic_GPLv3'))) + self.assertTrue(os.path.isfile(os.path.join(tmp_dir, 'deploy/licenses/readline/generic_GPLv2'))) @testcase(1422) def test_setscene_only(self):
Signature · 1 line
1.9.1
Re: [PATCH 1/2] selftest/bbtests.py: do not hardcode 'tmp' for TMPDIR
Quoted 6 lines · Chen Qi
(quoted diff) +2
-0+ tmp_dir = get_bb_var('TMPDIR') + self.assertFalse(os.path.isfile(os.path.join(tmp_dir,'deploy/licenses/readline/generic_GPLv3')))
+ self.assertTrue(os.path.isfile(os.path.join(tmp_dir,
'deploy/licenses/readline/generic_GPLv2')))
If we're going to remove path assumptions, then LICENSE_DIRECTORY is $DEPLOY_DIR/licenses.
Ross
PATCH 2/2 selftest/buildoptions.py: do not hardcode 'tmp' for TMPDIR
In reply to Chen QiUse the value of TMPDIR instead of hardcoding 'tmp'.
In fact, in OE, we have:
TCLIBCAPPEND ?= "-${TCLIBC}"
TMPDIR .= "${TCLIBCAPPEND}"
So the TMPDIR defaults to have ${TCLIBC} in it.
--- meta/lib/oeqa/selftest/buildoptions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/buildoptions.py +3 -2
@@ -197,7 +197,8 @@ class ArchiverTest(oeSelfTest): self.write_config("INHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nARCHIVER_MODE[srpm] = \"1\"") res = bitbake("xcursor-transparent-theme", ignore_status=True) self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output) - pkgs_path = g.glob(str(self.builddir) + "/tmp/deploy/sources/allarch*/xcurs*") + tmp_dir = get_bb_var('TMPDIR') + pkgs_path = g.glob(str(tmp_dir) + "/deploy/sources/allarch*/xcurs*") src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm" tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.gz" - self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.gz files under tmp/deploy/sources/allarch*/xcursor*") + self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.gz files under %s/deploy/sources/allarch*/xcursor*" % tmp_dir)
Signature · 1 line
1.9.1
Re: [PATCH 2/2] selftest/buildoptions.py: do not hardcode 'tmp' for TMPDIR
Quoted 6 lines · Chen Qi
-
pkgs_path= g.glob(str(self.builddir) +
"/tmp/deploy/sources/allarch*/xcurs*")(quoted diff) +2
-0+ tmp_dir = get_bb_var('TMPDIR') + pkgs_path = g.glob(str(tmp_dir) + "/deploy/sources/allarch*/xcurs*")
I think you meant DEPLOY_DIR_SRC :)
Ross
Re: [PATCH 2/2] selftest/buildoptions.py: do not hardcode 'tmp' for TMPDIR
Quoted 10 lines · Ross
On 9 January 2017 at 07:09, Chen Qi <[email protected] <mailto:[email protected]>> wrote:
-
pkgs_path= g.glob(str(self.builddir) +
"/tmp/deploy/sources/allarch*/xcurs*")
+tmp_dir=get_bb_var('TMPDIR')
+pkgs_path= g.glob(str(tmp_dir) +
"/deploy/sources/allarch*/xcurs*")
Quoted 3 lines
I think you meant
DEPLOY_DIR_SRC:)Ross
Thanks.
I've sent out a new patchset. The title is "[PATCH 0/2] selftest: fix path assumption".
And the remote branch is also changed to:
git://git.pokylinux.org/poky-contrib ChenQi/selftest-path-assumption
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/selftest-path-assumption
Best Regards,
Chen Qi