summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorDaniel Istrate <daniel.alexandrux.istrate@intel.com>2015-12-15 16:32:43 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-22 16:08:42 +0000
commit9e8f5ff6b0bd6cffcbb991d75487ab6005974000 (patch)
treed9b6623529d376e5fd87c34b8b8bec23e23d3ee7 /meta/lib
parent8b664a7d6bba89a8221d7fd1a52915fef0002d71 (diff)
downloadopenembedded-core-9e8f5ff6b0bd6cffcbb991d75487ab6005974000.tar.gz
openembedded-core-9e8f5ff6b0bd6cffcbb991d75487ab6005974000.tar.bz2
openembedded-core-9e8f5ff6b0bd6cffcbb991d75487ab6005974000.zip
selftest/buildhistory.py: Test buildhistory does not change sigs
[YOCTO #5953] Add a test to ensure buildhistory does not change signatures. Also removed unused imports. Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/buildhistory.py69
1 files changed, 65 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/buildhistory.py b/meta/lib/oeqa/selftest/buildhistory.py
index d8cae4664b..e8aa05df7a 100644
--- a/meta/lib/oeqa/selftest/buildhistory.py
+++ b/meta/lib/oeqa/selftest/buildhistory.py
@@ -1,12 +1,10 @@
-import unittest
import os
import re
-import shutil
import datetime
-import oeqa.utils.ftools as ftools
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer
+from oeqa.utils.commands import bitbake, get_bb_var
+from oeqa.utils.decorators import testcase
class BuildhistoryBase(oeSelfTest):
@@ -43,3 +41,66 @@ class BuildhistoryBase(oeSelfTest):
self.assertTrue(search_for_error, msg="Could not find desired error in output: %s" % error_regex)
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)