summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorDaniel Istrate <daniel.alexandrux.istrate@intel.com>2016-01-04 15:26:08 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-07 13:40:16 +0000
commit4ec2da71db78c16aedad2156a68b2e244ee2ccea (patch)
tree4130124b1375d60dcbc18872d62036824676741e /meta
parent02d259c1f4d9cf19636867ebcabf8695cd79f797 (diff)
downloadpoky-4ec2da71db78c16aedad2156a68b2e244ee2ccea.tar.gz
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] (From OE-Core rev: 975e67e28ccba5dcb0fced43c1f9e7da183dc201) Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/buildhistory.py64
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py64
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):
42 else: 42 else:
43 self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output)) 43 self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output))
44 44
45 @testcase(1386) 45 # No tests should be added to the base class.
46 def test_buildhistory_does_not_change_signatures(self): 46 # Please create a new class that inherit this one, or use one of those already available for adding tests.
47 """
48 Summary: Ensure that buildhistory does not change signatures
49 Expected: Only 'do_rootfs' and 'do_build' tasks are rerun
50 Product: oe-core
51 Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
52 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
53 """
54
55 tmpdir1_name = 'tmpsig1'
56 tmpdir2_name = 'tmpsig2'
57 builddir = os.environ.get('BUILDDIR')
58 tmpdir1 = os.path.join(builddir, tmpdir1_name)
59 tmpdir2 = os.path.join(builddir, tmpdir2_name)
60
61 self.track_for_cleanup(tmpdir1)
62 self.track_for_cleanup(tmpdir2)
63
64 features = 'TMPDIR = "%s"\n' % tmpdir1
65 self.write_config(features)
66 bitbake('core-image-sato -S none')
67
68 features = 'TMPDIR = "%s"\n' % tmpdir2
69 features += 'INHERIT += "buildhistory"\n'
70 self.write_config(features)
71 bitbake('core-image-sato -S none')
72
73 def get_files(d):
74 f = []
75 for root, dirs, files in os.walk(d):
76 for name in files:
77 f.append(os.path.join(root, name))
78 return f
79
80 files1 = get_files(tmpdir1 + '/stamps')
81 files2 = get_files(tmpdir2 + '/stamps')
82 files2 = [x.replace(tmpdir2_name, tmpdir1_name) for x in files2]
83
84 f1 = set(files1)
85 f2 = set(files2)
86 sigdiff = f1 - f2
87
88 self.assertEqual(len(sigdiff), 2, 'Expected 2 signature differences. Out: %s' % list(sigdiff))
89
90 unexpected_diff = []
91
92 # No new signatures should appear apart from do_rootfs and do_build
93 found_do_rootfs_flag = False
94 found_do_build_flag = False
95
96 for sig in sigdiff:
97 if 'do_rootfs' in sig:
98 found_do_rootfs_flag = True
99 elif 'do_build' in sig:
100 found_do_build_flag = True
101 else:
102 unexpected_diff.append(sig)
103
104 self.assertTrue(found_do_rootfs_flag, 'Task do_rootfs did not rerun.')
105 self.assertTrue(found_do_build_flag, 'Task do_build did not rerun')
106 self.assertFalse(unexpected_diff, 'Found unexpected signature differences. Out: %s' % unexpected_diff)
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):
118 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) 118 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
119 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) 119 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error)
120 120
121 @testcase(1386)
122 def test_buildhistory_does_not_change_signatures(self):
123 """
124 Summary: Ensure that buildhistory does not change signatures
125 Expected: Only 'do_rootfs' and 'do_build' tasks are rerun
126 Product: oe-core
127 Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
128 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
129 """
130
131 tmpdir1_name = 'tmpsig1'
132 tmpdir2_name = 'tmpsig2'
133 builddir = os.environ.get('BUILDDIR')
134 tmpdir1 = os.path.join(builddir, tmpdir1_name)
135 tmpdir2 = os.path.join(builddir, tmpdir2_name)
136
137 self.track_for_cleanup(tmpdir1)
138 self.track_for_cleanup(tmpdir2)
139
140 features = 'TMPDIR = "%s"\n' % tmpdir1
141 self.write_config(features)
142 bitbake('core-image-sato -S none')
143
144 features = 'TMPDIR = "%s"\n' % tmpdir2
145 features += 'INHERIT += "buildhistory"\n'
146 self.write_config(features)
147 bitbake('core-image-sato -S none')
148
149 def get_files(d):
150 f = []
151 for root, dirs, files in os.walk(d):
152 for name in files:
153 f.append(os.path.join(root, name))
154 return f
155
156 files1 = get_files(tmpdir1 + '/stamps')
157 files2 = get_files(tmpdir2 + '/stamps')
158 files2 = [x.replace(tmpdir2_name, tmpdir1_name) for x in files2]
159
160 f1 = set(files1)
161 f2 = set(files2)
162 sigdiff = f1 - f2
163
164 self.assertEqual(len(sigdiff), 2, 'Expected 2 signature differences. Out: %s' % list(sigdiff))
165
166 unexpected_diff = []
167
168 # No new signatures should appear apart from do_rootfs and do_build
169 found_do_rootfs_flag = False
170 found_do_build_flag = False
171
172 for sig in sigdiff:
173 if 'do_rootfs' in sig:
174 found_do_rootfs_flag = True
175 elif 'do_build' in sig:
176 found_do_build_flag = True
177 else:
178 unexpected_diff.append(sig)
179
180 self.assertTrue(found_do_rootfs_flag, 'Task do_rootfs did not rerun.')
181 self.assertTrue(found_do_build_flag, 'Task do_build did not rerun')
182 self.assertFalse(unexpected_diff, 'Found unexpected signature differences. Out: %s' % unexpected_diff)
183
184
121class BuildImagesTest(oeSelfTest): 185class BuildImagesTest(oeSelfTest):
122 @testcase(563) 186 @testcase(563)
123 def test_directfb(self): 187 def test_directfb(self):