blob: c19f65b9bb9a11bbd3f5d866b3d21e8c09460401 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY_${PN}-ptest ?= "${SUMMARY} - Package test files"
2DESCRIPTION_${PN}-ptest ?= "${DESCRIPTION} \
3This package contains a test directory ${PTEST_PATH} for package test purposes."
4
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005PTEST_PATH ?= "${libdir}/${BPN}/ptest"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006FILES_${PN}-ptest = "${PTEST_PATH}"
7SECTION_${PN}-ptest = "devel"
8ALLOW_EMPTY_${PN}-ptest = "1"
9PTEST_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}"
10PTEST_ENABLED_class-native = ""
11PTEST_ENABLED_class-nativesdk = ""
12PTEST_ENABLED_class-cross-canadian = ""
13RDEPENDS_${PN}-ptest_class-native = ""
14RDEPENDS_${PN}-ptest_class-nativesdk = ""
15RRECOMMENDS_${PN}-ptest += "ptest-runner"
16
17PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}"
18
19do_configure_ptest() {
20 :
21}
22
23do_configure_ptest_base() {
24 do_configure_ptest
25}
26
27do_compile_ptest() {
28 :
29}
30
31do_compile_ptest_base() {
32 do_compile_ptest
33}
34
35do_install_ptest() {
36 :
37}
38
39do_install_ptest_base() {
40 if [ -f ${WORKDIR}/run-ptest ]; then
41 install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042 fi
Patrick Williamsf1e5d692016-03-30 15:21:19 -050043 if grep -q install-ptest: Makefile; then
44 oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
45 fi
46 do_install_ptest
47 chown -R root:root ${D}${PTEST_PATH}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048}
49
50do_configure_ptest_base[dirs] = "${B}"
51do_compile_ptest_base[dirs] = "${B}"
52do_install_ptest_base[dirs] = "${B}"
53do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}"
54
55addtask configure_ptest_base after do_configure before do_compile
56addtask compile_ptest_base after do_compile before do_install
57addtask install_ptest_base after do_install before do_package do_populate_sysroot
58
59python () {
60 if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050061 d.setVarFlag('do_install_ptest_base', 'fakeroot', '1')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062
63 # Remove all '*ptest_base' tasks when ptest is not enabled
Brad Bishop6e60e8b2018-02-01 10:27:11 -050064 if not(d.getVar('PTEST_ENABLED') == "1"):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065 for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
66 bb.build.deltask(i, d)
67}