blob: 525c5a61735f2c06495406fe8673ce3839965d69 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# Copyright (C) 2013 Intel Corporation
2#
3# Released under the MIT license (see COPYING.MIT)
4
Brad Bishopf86d0552018-12-04 14:18:15 -08005inherit metadata_scm
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006# testimage.bbclass enables testing of qemu images using python unittests.
7# Most of the tests are commands run on target image over ssh.
8# To use it add testimage to global inherit and call your target image with -c testimage
9# You can try it out like this:
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010# - first add IMAGE_CLASSES += "testimage" in local.conf
11# - build a qemu core-image-sato
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012# - then bitbake core-image-sato -c testimage. That will run a standard suite of tests.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080013#
14# The tests can be run automatically each time an image is built if you set
15# TESTIMAGE_AUTO = "1"
16
17TESTIMAGE_AUTO ??= "0"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018
19# You can set (or append to) TEST_SUITES in local.conf to select the tests
20# which you want to run for your target.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021# The test names are the module names in meta/lib/oeqa/runtime/cases.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022# Each name in TEST_SUITES represents a required test for the image. (no skipping allowed)
23# Appending "auto" means that it will try to run all tests that are suitable for the image (each test decides that on it's own).
24# Note that order in TEST_SUITES is relevant: tests are run in an order such that
25# tests mentioned in @skipUnlessPassed run before the tests that depend on them,
26# but without such dependencies, tests run in the order in which they are listed
27# in TEST_SUITES.
28#
29# A layer can add its own tests in lib/oeqa/runtime, provided it extends BBPATH as normal in its layer.conf.
30
31# TEST_LOG_DIR contains a command ssh log and may contain infromation about what command is running, output and return codes and for qemu a boot log till login.
32# Booting is handled by this class, and it's not a test in itself.
33# TEST_QEMUBOOT_TIMEOUT can be used to set the maximum time in seconds the launch code will wait for the login prompt.
Brad Bishop977dc1a2019-02-06 16:01:43 -050034# TEST_QEMUPARAMS can be used to pass extra parameters to qemu, e.g. "-m 1024" for setting the amount of ram to 1 GB.
Brad Bishop19323692019-04-05 15:28:33 -040035# TEST_RUNQEMUPARAMS can be used to pass extra parameters to runqemu, e.g. "gl" to enable OpenGL acceleration.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
37TEST_LOG_DIR ?= "${WORKDIR}/testimage"
38
39TEST_EXPORT_DIR ?= "${TMPDIR}/testimage/${PN}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060040TEST_INSTALL_TMP_DIR ?= "${WORKDIR}/testimage/install_tmp"
41TEST_NEEDED_PACKAGES_DIR ?= "${WORKDIR}/testimage/packages"
42TEST_EXTRACTED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/extracted"
43TEST_PACKAGED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/packaged"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044
Brad Bishop977dc1a2019-02-06 16:01:43 -050045BASICTESTSUITE = "\
46 ping date df ssh scp python perl gi ptest parselogs \
47 logrotate connman systemd oe_syslog pam stap ldd xorg \
48 kernelmodule gcc buildcpio buildlzip buildgalculator \
49 dnf rpm opkg apt"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050
Brad Bishop977dc1a2019-02-06 16:01:43 -050051DEFAULT_TEST_SUITES = "${BASICTESTSUITE}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052
53# aarch64 has no graphics
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050054DEFAULT_TEST_SUITES_remove_aarch64 = "xorg"
Brad Bishop316dfdd2018-06-25 12:45:53 -040055# musl doesn't support systemtap
56DEFAULT_TEST_SUITES_remove_libc-musl = "stap"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057
Patrick Williamsc0f7c042017-02-23 20:41:17 -060058# qemumips is quite slow and has reached the timeout limit several times on the YP build cluster,
59# mitigate this by removing build tests for qemumips machines.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050060MIPSREMOVE ??= "buildcpio buildlzip buildgalculator"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060061DEFAULT_TEST_SUITES_remove_qemumips = "${MIPSREMOVE}"
62DEFAULT_TEST_SUITES_remove_qemumips64 = "${MIPSREMOVE}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063
64TEST_SUITES ?= "${DEFAULT_TEST_SUITES}"
65
66TEST_QEMUBOOT_TIMEOUT ?= "1000"
67TEST_TARGET ?= "qemu"
Brad Bishop977dc1a2019-02-06 16:01:43 -050068TEST_QEMUPARAMS ?= ""
Brad Bishop19323692019-04-05 15:28:33 -040069TEST_RUNQEMUPARAMS ?= ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070
71TESTIMAGEDEPENDS = ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080072TESTIMAGEDEPENDS_append_qemuall = " qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot qemu-helper-native:do_addto_recipe_sysroot"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060073TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-native:do_populate_sysroot', '', d)}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050074TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf-native:do_populate_sysroot', '', d)}"
Brad Bishop977dc1a2019-02-06 16:01:43 -050075TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-native:do_populate_sysroot', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080076TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'ipk', 'opkg-utils-native:do_populate_sysroot package-index:do_package_index', '', d)}"
77TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 'apt-native:do_populate_sysroot package-index:do_package_index', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078
79TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
80TESTIMAGELOCK_qemuall = ""
81
Brad Bishop977dc1a2019-02-06 16:01:43 -050082TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083
Brad Bishop6e60e8b2018-02-01 10:27:11 -050084TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR"
85
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086testimage_dump_target () {
87 top -bn1
88 ps
89 free
90 df
91 # The next command will export the default gateway IP
92 export DEFAULT_GATEWAY=$(ip route | awk '/default/ { print $3}')
93 ping -c3 $DEFAULT_GATEWAY
94 dmesg
95 netstat -an
96 ip address
97 # Next command will dump logs from /var/log/
98 find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
99}
100
101testimage_dump_host () {
102 top -bn1
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500103 iostat -x -z -N -d -p ALL 20 2
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 ps -ef
105 free
106 df
107 memstat
108 dmesg
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500109 ip -s link
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110 netstat -an
111}
112
113python do_testimage() {
114 testimage_main(d)
115}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600116
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117addtask testimage
118do_testimage[nostamp] = "1"
119do_testimage[depends] += "${TESTIMAGEDEPENDS}"
120do_testimage[lockfiles] += "${TESTIMAGELOCK}"
121
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500122def testimage_sanity(d):
123 if (d.getVar('TEST_TARGET') == 'simpleremote'
124 and (not d.getVar('TEST_TARGET_IP')
125 or not d.getVar('TEST_SERVER_IP'))):
126 bb.fatal('When TEST_TARGET is set to "simpleremote" '
127 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500128
Brad Bishopf86d0552018-12-04 14:18:15 -0800129def get_testimage_configuration(d, test_type, machine):
130 import platform
131 from oeqa.utils.metadata import get_layers
132 configuration = {'TEST_TYPE': test_type,
133 'MACHINE': machine,
134 'DISTRO': d.getVar("DISTRO"),
135 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
136 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
137 'STARTTIME': d.getVar("DATETIME"),
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800138 'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
Brad Bishopf86d0552018-12-04 14:18:15 -0800139 'LAYERS': get_layers(d.getVar("BBLAYERS"))}
140 return configuration
141get_testimage_configuration[vardepsexclude] = "DATETIME"
142
143def get_testimage_json_result_dir(d):
144 json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
145 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
146 if custom_json_result_dir:
147 json_result_dir = custom_json_result_dir
148 return json_result_dir
149
150def get_testimage_result_id(configuration):
151 return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME'])
152
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500153def testimage_main(d):
154 import os
155 import json
156 import signal
157 import logging
158
159 from bb.utils import export_proxies
160 from oeqa.core.utils.misc import updateTestData
161 from oeqa.runtime.context import OERuntimeTestContext
162 from oeqa.runtime.context import OERuntimeTestContextExecutor
163 from oeqa.core.target.qemu import supported_fstypes
164 from oeqa.core.utils.test import getSuiteCases
165 from oeqa.utils import make_logger_bitbake_compatible
166
167 def sigterm_exception(signum, stackframe):
168 """
169 Catch SIGTERM from worker in order to stop qemu.
170 """
171 raise RuntimeError
172
Brad Bishopd5ae7d92018-06-14 09:52:03 -0700173 testimage_sanity(d)
174
175 if (d.getVar('IMAGE_PKGTYPE') == 'rpm'
176 and ('dnf' in d.getVar('TEST_SUITES') or 'auto' in d.getVar('TEST_SUITES'))):
177 create_rpm_index(d)
178
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500179 logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
180 pn = d.getVar("PN")
181
182 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
183
184 image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
185 d.getVar('IMAGE_LINK_NAME')))
186
187 tdname = "%s.testdata.json" % image_name
188 try:
189 td = json.load(open(tdname, "r"))
190 except (FileNotFoundError) as err:
191 bb.fatal('File %s Not Found. Have you built the image with INHERIT+="testimage" in the conf/local.conf?' % tdname)
192
193 # Some variables need to be updates (mostly paths) with the
194 # ones of the current environment because some tests require them.
195 updateTestData(d, td, d.getVar('TESTIMAGE_UPDATE_VARS').split())
196
197 image_manifest = "%s.manifest" % image_name
198 image_packages = OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
199
200 extract_dir = d.getVar("TEST_EXTRACTED_DIR")
201
202 # Get machine
203 machine = d.getVar("MACHINE")
204
205 # Get rootfs
Brad Bishop977dc1a2019-02-06 16:01:43 -0500206 fstypes = d.getVar('IMAGE_FSTYPES').split()
207 if d.getVar("TEST_TARGET") == "qemu":
208 fstypes = [fs for fs in fstypes if fs in supported_fstypes]
209 if not fstypes:
210 bb.fatal('Unsupported image type built. Add a comptible image to '
211 'IMAGE_FSTYPES. Supported types: %s' %
212 ', '.join(supported_fstypes))
Brad Bishop15ae2502019-06-18 21:44:24 -0400213 qfstype = fstypes[0]
214 qdeffstype = d.getVar("QB_DEFAULT_FSTYPE")
215 if qdeffstype:
216 qfstype = qdeffstype
217 rootfs = '%s.%s' % (image_name, qfstype)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500218
219 # Get tmpdir (not really used, just for compatibility)
220 tmpdir = d.getVar("TMPDIR")
221
222 # Get deploy_dir_image (not really used, just for compatibility)
223 dir_image = d.getVar("DEPLOY_DIR_IMAGE")
224
225 # Get bootlog
226 bootlog = os.path.join(d.getVar("TEST_LOG_DIR"),
227 'qemu_boot_log.%s' % d.getVar('DATETIME'))
228
229 # Get display
230 display = d.getVar("BB_ORIGENV").getVar("DISPLAY")
231
232 # Get kernel
233 kernel_name = ('%s-%s.bin' % (d.getVar("KERNEL_IMAGETYPE"), machine))
234 kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), kernel_name)
235
236 # Get boottime
237 boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT"))
238
239 # Get use_kvm
Brad Bishop977dc1a2019-02-06 16:01:43 -0500240 kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH'))
241
242 slirp = False
243 if d.getVar("QEMU_USE_SLIRP"):
244 slirp = True
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500245
246 # TODO: We use the current implementatin of qemu runner because of
247 # time constrains, qemu runner really needs a refactor too.
248 target_kwargs = { 'machine' : machine,
249 'rootfs' : rootfs,
250 'tmpdir' : tmpdir,
251 'dir_image' : dir_image,
252 'display' : display,
253 'kernel' : kernel,
254 'boottime' : boottime,
255 'bootlog' : bootlog,
256 'kvm' : kvm,
Brad Bishop977dc1a2019-02-06 16:01:43 -0500257 'slirp' : slirp,
258 'dump_dir' : d.getVar("TESTIMAGE_DUMP_DIR"),
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500259 }
260
261 # TODO: Currently BBPATH is needed for custom loading of targets.
262 # It would be better to find these modules using instrospection.
263 target_kwargs['target_modules_path'] = d.getVar('BBPATH')
264
265 # runtime use network for download projects for build
266 export_proxies(d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500267
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500268 # we need the host dumper in test context
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500269 host_dumper = OERuntimeTestContextExecutor.getHostDumper(
270 d.getVar("testimage_dump_host"),
271 d.getVar("TESTIMAGE_DUMP_DIR"))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500272
273 # the robot dance
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500274 target = OERuntimeTestContextExecutor.getTarget(
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500275 d.getVar("TEST_TARGET"), logger, d.getVar("TEST_TARGET_IP"),
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500276 d.getVar("TEST_SERVER_IP"), **target_kwargs)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500277
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500278 # test context
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500279 tc = OERuntimeTestContext(td, logger, target, host_dumper,
280 image_packages, extract_dir)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500281
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500282 # Load tests before starting the target
283 test_paths = get_runtime_paths(d)
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500284 test_modules = d.getVar('TEST_SUITES').split()
Brad Bishopd5ae7d92018-06-14 09:52:03 -0700285 if not test_modules:
286 bb.fatal('Empty test suite, please verify TEST_SUITES variable')
287
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500288 tc.loadTests(test_paths, modules=test_modules)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500289
Brad Bishopd5ae7d92018-06-14 09:52:03 -0700290 suitecases = getSuiteCases(tc.suites)
291 if not suitecases:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500292 bb.fatal('Empty test suite, please verify TEST_SUITES variable')
Brad Bishopd5ae7d92018-06-14 09:52:03 -0700293 else:
294 bb.debug(2, 'test suites:\n\t%s' % '\n\t'.join([str(c) for c in suitecases]))
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500295
296 package_extraction(d, tc.suites)
297
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500298 results = None
299 orig_sigterm_handler = signal.signal(signal.SIGTERM, sigterm_exception)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600300 try:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500301 # We need to check if runqemu ends unexpectedly
302 # or if the worker send us a SIGTERM
Brad Bishop19323692019-04-05 15:28:33 -0400303 tc.target.start(params=d.getVar("TEST_QEMUPARAMS"), runqemuparams=d.getVar("TEST_RUNQEMUPARAMS"))
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500304 results = tc.runTests()
305 except (RuntimeError, BlockingIOError) as err:
306 if isinstance(err, RuntimeError):
307 bb.error('testimage received SIGTERM, shutting down...')
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600308 else:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500309 bb.error('runqemu failed, shutting down...')
310 if results:
311 results.stop()
312 results = None
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600313 finally:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500314 signal.signal(signal.SIGTERM, orig_sigterm_handler)
315 tc.target.stop()
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600316
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500317 # Show results (if we have them)
318 if not results:
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500319 bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True)
Brad Bishopf86d0552018-12-04 14:18:15 -0800320 configuration = get_testimage_configuration(d, 'runtime', machine)
321 results.logDetails(get_testimage_json_result_dir(d),
322 configuration,
Brad Bishopc342db32019-05-15 21:57:59 -0400323 get_testimage_result_id(configuration),
324 dump_streams=d.getVar('TESTREPORT_FULLLOGS'))
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500325 results.logSummary(pn)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500326 if not results.wasSuccessful():
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500327 bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600328
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500329def get_runtime_paths(d):
330 """
331 Returns a list of paths where runtime test must reside.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500332
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500333 Runtime tests are expected in <LAYER_DIR>/lib/oeqa/runtime/cases/
334 """
335 paths = []
336
337 for layer in d.getVar('BBLAYERS').split():
338 path = os.path.join(layer, 'lib/oeqa/runtime/cases')
339 if os.path.isdir(path):
340 paths.append(path)
341 return paths
342
343def create_index(arg):
344 import subprocess
345
346 index_cmd = arg
347 try:
348 bb.note("Executing '%s' ..." % index_cmd)
349 result = subprocess.check_output(index_cmd,
350 stderr=subprocess.STDOUT,
351 shell=True)
352 result = result.decode('utf-8')
353 except subprocess.CalledProcessError as e:
354 return("Index creation command '%s' failed with return code "
355 '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8")))
356 if result:
357 bb.note(result)
358 return None
359
360def create_rpm_index(d):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800361 import glob
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500362 # Index RPMs
363 rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c")
364 index_cmds = []
365 archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_')
366
367 for arch in archs.split():
368 rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch)
369 idx_path = os.path.join(d.getVar('WORKDIR'), 'oe-testimage-repo', arch)
370
371 if not os.path.isdir(rpm_dir):
372 continue
373
374 lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock')
375 lf = bb.utils.lockfile(lockfilename, False)
376 oe.path.copyhardlinktree(rpm_dir, idx_path)
377 # Full indexes overload a 256MB image so reduce the number of rpms
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800378 # in the feed by filtering to specific packages needed by the tests.
379 package_list = glob.glob(idx_path + "*/*.rpm")
380
381 for pkg in package_list:
382 if not os.path.basename(pkg).startswith(("rpm", "run-postinsts", "busybox", "bash", "update-alternatives", "libc6", "curl", "musl")):
383 bb.utils.remove(pkg)
384
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500385 bb.utils.unlockfile(lf)
386 cmd = '%s --update -q %s' % (rpm_createrepo, idx_path)
387
388 # Create repodata
389 result = create_index(cmd)
390 if result:
391 bb.fatal('%s' % ('\n'.join(result)))
392
393def package_extraction(d, test_suites):
394 from oeqa.utils.package_manager import find_packages_to_extract
395 from oeqa.utils.package_manager import extract_packages
396
397 bb.utils.remove(d.getVar("TEST_NEEDED_PACKAGES_DIR"), recurse=True)
398 packages = find_packages_to_extract(test_suites)
399 if packages:
400 bb.utils.mkdirhier(d.getVar("TEST_INSTALL_TMP_DIR"))
401 bb.utils.mkdirhier(d.getVar("TEST_PACKAGED_DIR"))
402 bb.utils.mkdirhier(d.getVar("TEST_EXTRACTED_DIR"))
403 extract_packages(d, packages)
404
405testimage_main[vardepsexclude] += "BB_ORIGENV DATETIME"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500406
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800407python () {
408 if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
409 bb.build.addtask("testimage", "do_build", "do_image_complete", d)
410}
411
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500412inherit testsdk