blob: 4dc5dbe9ef2b1dd36c556bb9a7d5818a07a52e36 [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
5PTEST_PATH ?= "${libdir}/${PN}/ptest"
6FILES_${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):
61 d.setVarFlag('do_install_ptest_base', 'fakeroot', 1)
62
63 # Remove all '*ptest_base' tasks when ptest is not enabled
64 if not(d.getVar('PTEST_ENABLED', True) == "1"):
65 for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
66 bb.build.deltask(i, d)
67}