diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/recipetool.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index aebea42502..42202b7831 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
@@ -120,9 +120,15 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
120 | self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) | 120 | self._try_recipetool_appendfile_fail('/dev/console', self.testfile, ['ERROR: /dev/console cannot be handled by this tool']) |
121 | 121 | ||
122 | def test_recipetool_appendfile_alternatives(self): | 122 | def test_recipetool_appendfile_alternatives(self): |
123 | lspath = '/bin/ls' | ||
124 | dirname = "base_bindir" | ||
125 | if "usrmerge" in get_bb_var('DISTRO_FEATURES'): | ||
126 | lspath = '/usr/bin/ls' | ||
127 | dirname = "bindir" | ||
128 | |||
123 | # Now try with a file we know should be an alternative | 129 | # Now try with a file we know should be an alternative |
124 | # (this is very much a fake example, but one we know is reliably an alternative) | 130 | # (this is very much a fake example, but one we know is reliably an alternative) |
125 | self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox']) | 131 | self._try_recipetool_appendfile_fail(lspath, self.testfile, ['ERROR: File %s is an alternative possibly provided by the following recipes:' % lspath, 'coreutils', 'busybox']) |
126 | # Need a test file - should be executable | 132 | # Need a test file - should be executable |
127 | testfile2 = os.path.join(self.corebase, 'oe-init-build-env') | 133 | testfile2 = os.path.join(self.corebase, 'oe-init-build-env') |
128 | testfile2name = os.path.basename(testfile2) | 134 | testfile2name = os.path.basename(testfile2) |
@@ -131,12 +137,12 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
131 | 'SRC_URI += "file://%s"\n' % testfile2name, | 137 | 'SRC_URI += "file://%s"\n' % testfile2name, |
132 | '\n', | 138 | '\n', |
133 | 'do_install:append() {\n', | 139 | 'do_install:append() {\n', |
134 | ' install -d ${D}${base_bindir}\n', | 140 | ' install -d ${D}${%s}\n' % dirname, |
135 | ' install -m 0755 ${WORKDIR}/%s ${D}${base_bindir}/ls\n' % testfile2name, | 141 | ' install -m 0755 ${UNPACKDIR}/%s ${D}${%s}/ls\n' % (testfile2name, dirname), |
136 | '}\n'] | 142 | '}\n'] |
137 | self._try_recipetool_appendfile('coreutils', '/bin/ls', testfile2, '-r coreutils', expectedlines, [testfile2name]) | 143 | self._try_recipetool_appendfile('coreutils', lspath, testfile2, '-r coreutils', expectedlines, [testfile2name]) |
138 | # Now try bbappending the same file again, contents should not change | 144 | # Now try bbappending the same file again, contents should not change |
139 | bbappendfile, _ = self._try_recipetool_appendfile('coreutils', '/bin/ls', self.testfile, '-r coreutils', expectedlines, [testfile2name]) | 145 | bbappendfile, _ = self._try_recipetool_appendfile('coreutils', lspath, self.testfile, '-r coreutils', expectedlines, [testfile2name]) |
140 | # But file should have | 146 | # But file should have |
141 | copiedfile = os.path.join(os.path.dirname(bbappendfile), 'coreutils', testfile2name) | 147 | copiedfile = os.path.join(os.path.dirname(bbappendfile), 'coreutils', testfile2name) |
142 | result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) | 148 | result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True) |
@@ -158,7 +164,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
158 | '\n', | 164 | '\n', |
159 | 'do_install:append() {\n', | 165 | 'do_install:append() {\n', |
160 | ' install -d ${D}${datadir}\n', | 166 | ' install -d ${D}${datadir}\n', |
161 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', | 167 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n', |
162 | '}\n'] | 168 | '}\n'] |
163 | self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile']) | 169 | self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile']) |
164 | # Try adding another file, this time where the source file is executable | 170 | # Try adding another file, this time where the source file is executable |
@@ -173,8 +179,8 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
173 | '\n', | 179 | '\n', |
174 | 'do_install:append() {\n', | 180 | 'do_install:append() {\n', |
175 | ' install -d ${D}${datadir}\n', | 181 | ' install -d ${D}${datadir}\n', |
176 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', | 182 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n', |
177 | ' install -m 0755 ${WORKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name, | 183 | ' install -m 0755 ${UNPACKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name, |
178 | '}\n'] | 184 | '}\n'] |
179 | self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name]) | 185 | self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name]) |
180 | 186 | ||
@@ -186,7 +192,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
186 | '\n', | 192 | '\n', |
187 | 'do_install:append() {\n', | 193 | 'do_install:append() {\n', |
188 | ' install -d ${D}${bindir}\n', | 194 | ' install -d ${D}${bindir}\n', |
189 | ' install -m 0755 ${WORKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n', | 195 | ' install -m 0755 ${UNPACKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n', |
190 | '}\n'] | 196 | '}\n'] |
191 | _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile']) | 197 | _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile']) |
192 | self.assertNotIn('WARNING: ', output) | 198 | self.assertNotIn('WARNING: ', output) |
@@ -201,7 +207,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
201 | '\n', | 207 | '\n', |
202 | 'do_install:append:mymachine() {\n', | 208 | 'do_install:append:mymachine() {\n', |
203 | ' install -d ${D}${datadir}\n', | 209 | ' install -d ${D}${datadir}\n', |
204 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n', | 210 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/something\n', |
205 | '}\n'] | 211 | '}\n'] |
206 | _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile']) | 212 | _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile']) |
207 | self.assertNotIn('WARNING: ', output) | 213 | self.assertNotIn('WARNING: ', output) |
@@ -235,7 +241,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
235 | '\n', | 241 | '\n', |
236 | 'do_install:append() {\n', | 242 | 'do_install:append() {\n', |
237 | ' install -d ${D}${datadir}\n', | 243 | ' install -d ${D}${datadir}\n', |
238 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-subdir\n', | 244 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-subdir\n', |
239 | '}\n'] | 245 | '}\n'] |
240 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) | 246 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-subdir', self.testfile, '', expectedlines, ['testfile']) |
241 | self.assertNotIn('WARNING: ', output) | 247 | self.assertNotIn('WARNING: ', output) |
@@ -262,7 +268,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
262 | '\n', | 268 | '\n', |
263 | 'do_install:append() {\n', | 269 | 'do_install:append() {\n', |
264 | ' install -d ${D}${sysconfdir}\n', | 270 | ' install -d ${D}${sysconfdir}\n', |
265 | ' install -m 0644 ${WORKDIR}/testfile ${D}${sysconfdir}/selftest-replaceme-patched\n', | 271 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${sysconfdir}/selftest-replaceme-patched\n', |
266 | '}\n'] | 272 | '}\n'] |
267 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/etc/selftest-replaceme-patched', self.testfile, '', expectedlines, ['testfile']) | 273 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/etc/selftest-replaceme-patched', self.testfile, '', expectedlines, ['testfile']) |
268 | for line in output.splitlines(): | 274 | for line in output.splitlines(): |
@@ -280,7 +286,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
280 | '\n', | 286 | '\n', |
281 | 'do_install:append() {\n', | 287 | 'do_install:append() {\n', |
282 | ' install -d ${D}${datadir}\n', | 288 | ' install -d ${D}${datadir}\n', |
283 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-scripted\n', | 289 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-scripted\n', |
284 | '}\n'] | 290 | '}\n'] |
285 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile']) | 291 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-scripted', self.testfile, '', expectedlines, ['testfile']) |
286 | self.assertNotIn('WARNING: ', output) | 292 | self.assertNotIn('WARNING: ', output) |
@@ -303,7 +309,7 @@ class RecipetoolAppendTests(RecipetoolBase): | |||
303 | '\n', | 309 | '\n', |
304 | 'do_install:append() {\n', | 310 | 'do_install:append() {\n', |
305 | ' install -d ${D}${datadir}\n', | 311 | ' install -d ${D}${datadir}\n', |
306 | ' install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/selftest-replaceme-postinst\n', | 312 | ' install -m 0644 ${UNPACKDIR}/testfile ${D}${datadir}/selftest-replaceme-postinst\n', |
307 | '}\n'] | 313 | '}\n'] |
308 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) | 314 | _, output = self._try_recipetool_appendfile('selftest-recipetool-appendfile', '/usr/share/selftest-replaceme-postinst', self.testfile, '-r selftest-recipetool-appendfile', expectedlines, ['testfile']) |
309 | 315 | ||