diff options
author | Daniel Istrate <daniel.alexandrux.istrate@intel.com> | 2016-01-04 15:26:08 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-07 13:40:04 +0000 |
commit | 975e67e28ccba5dcb0fced43c1f9e7da183dc201 (patch) | |
tree | 90f0f52f3662115c1cba04cc9f48a23ea0280116 /meta | |
parent | d66a4c5cb77f745e973daf34b84724f91549f391 (diff) | |
download | openembedded-core-975e67e28ccba5dcb0fced43c1f9e7da183dc201.tar.gz openembedded-core-975e67e28ccba5dcb0fced43c1f9e7da183dc201.tar.bz2 openembedded-core-975e67e28ccba5dcb0fced43c1f9e7da183dc201.zip |
selftest: moved tc test_buildhistory_does_not_change_signatures
Moved test_buildhistory_does_not_change_signatures from
buildhistory/BuildhistoryBase to buildoptions/BuildhistoryTests.
The test being in the base class was causing it to run
multiple times.
Fix for [YOCTO #8867]
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/buildhistory.py | 64 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/buildoptions.py | 64 |
2 files changed, 66 insertions, 62 deletions
diff --git a/meta/lib/oeqa/selftest/buildhistory.py b/meta/lib/oeqa/selftest/buildhistory.py index e8aa05df7a..38bcd72cb4 100644 --- a/meta/lib/oeqa/selftest/buildhistory.py +++ b/meta/lib/oeqa/selftest/buildhistory.py @@ -42,65 +42,5 @@ class BuildhistoryBase(oeSelfTest): else: self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output)) - @testcase(1386) - def test_buildhistory_does_not_change_signatures(self): - """ - Summary: Ensure that buildhistory does not change signatures - Expected: Only 'do_rootfs' and 'do_build' tasks are rerun - Product: oe-core - Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com> - AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> - """ - - tmpdir1_name = 'tmpsig1' - tmpdir2_name = 'tmpsig2' - builddir = os.environ.get('BUILDDIR') - tmpdir1 = os.path.join(builddir, tmpdir1_name) - tmpdir2 = os.path.join(builddir, tmpdir2_name) - - self.track_for_cleanup(tmpdir1) - self.track_for_cleanup(tmpdir2) - - features = 'TMPDIR = "%s"\n' % tmpdir1 - self.write_config(features) - bitbake('core-image-sato -S none') - - features = 'TMPDIR = "%s"\n' % tmpdir2 - features += 'INHERIT += "buildhistory"\n' - self.write_config(features) - bitbake('core-image-sato -S none') - - def get_files(d): - f = [] - for root, dirs, files in os.walk(d): - for name in files: - f.append(os.path.join(root, name)) - return f - - files1 = get_files(tmpdir1 + '/stamps') - files2 = get_files(tmpdir2 + '/stamps') - files2 = [x.replace(tmpdir2_name, tmpdir1_name) for x in files2] - - f1 = set(files1) - f2 = set(files2) - sigdiff = f1 - f2 - - self.assertEqual(len(sigdiff), 2, 'Expected 2 signature differences. Out: %s' % list(sigdiff)) - - unexpected_diff = [] - - # No new signatures should appear apart from do_rootfs and do_build - found_do_rootfs_flag = False - found_do_build_flag = False - - for sig in sigdiff: - if 'do_rootfs' in sig: - found_do_rootfs_flag = True - elif 'do_build' in sig: - found_do_build_flag = True - else: - unexpected_diff.append(sig) - - self.assertTrue(found_do_rootfs_flag, 'Task do_rootfs did not rerun.') - self.assertTrue(found_do_build_flag, 'Task do_build did not rerun') - self.assertFalse(unexpected_diff, 'Found unexpected signature differences. Out: %s' % unexpected_diff) + # No tests should be added to the base class. + # Please create a new class that inherit this one, or use one of those already available for adding tests. diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py index acf481f7b8..64ced151b4 100644 --- a/meta/lib/oeqa/selftest/buildoptions.py +++ b/meta/lib/oeqa/selftest/buildoptions.py @@ -118,6 +118,70 @@ class BuildhistoryTests(BuildhistoryBase): self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) + @testcase(1386) + def test_buildhistory_does_not_change_signatures(self): + """ + Summary: Ensure that buildhistory does not change signatures + Expected: Only 'do_rootfs' and 'do_build' tasks are rerun + Product: oe-core + Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com> + AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> + """ + + tmpdir1_name = 'tmpsig1' + tmpdir2_name = 'tmpsig2' + builddir = os.environ.get('BUILDDIR') + tmpdir1 = os.path.join(builddir, tmpdir1_name) + tmpdir2 = os.path.join(builddir, tmpdir2_name) + + self.track_for_cleanup(tmpdir1) + self.track_for_cleanup(tmpdir2) + + features = 'TMPDIR = "%s"\n' % tmpdir1 + self.write_config(features) + bitbake('core-image-sato -S none') + + features = 'TMPDIR = "%s"\n' % tmpdir2 + features += 'INHERIT += "buildhistory"\n' + self.write_config(features) + bitbake('core-image-sato -S none') + + def get_files(d): + f = [] + for root, dirs, files in os.walk(d): + for name in files: + f.append(os.path.join(root, name)) + return f + + files1 = get_files(tmpdir1 + '/stamps') + files2 = get_files(tmpdir2 + '/stamps') + files2 = [x.replace(tmpdir2_name, tmpdir1_name) for x in files2] + + f1 = set(files1) + f2 = set(files2) + sigdiff = f1 - f2 + + self.assertEqual(len(sigdiff), 2, 'Expected 2 signature differences. Out: %s' % list(sigdiff)) + + unexpected_diff = [] + + # No new signatures should appear apart from do_rootfs and do_build + found_do_rootfs_flag = False + found_do_build_flag = False + + for sig in sigdiff: + if 'do_rootfs' in sig: + found_do_rootfs_flag = True + elif 'do_build' in sig: + found_do_build_flag = True + else: + unexpected_diff.append(sig) + + self.assertTrue(found_do_rootfs_flag, 'Task do_rootfs did not rerun.') + self.assertTrue(found_do_build_flag, 'Task do_build did not rerun') + self.assertFalse(unexpected_diff, 'Found unexpected signature differences. Out: %s' % unexpected_diff) + + class BuildImagesTest(oeSelfTest): @testcase(563) def test_directfb(self): |