Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY_${PN}-ptest ?= "${SUMMARY} - Package test files" |
| 2 | DESCRIPTION_${PN}-ptest ?= "${DESCRIPTION} \ |
| 3 | This package contains a test directory ${PTEST_PATH} for package test purposes." |
| 4 | |
| 5 | PTEST_PATH ?= "${libdir}/${PN}/ptest" |
| 6 | FILES_${PN}-ptest = "${PTEST_PATH}" |
| 7 | SECTION_${PN}-ptest = "devel" |
| 8 | ALLOW_EMPTY_${PN}-ptest = "1" |
| 9 | PTEST_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}" |
| 10 | PTEST_ENABLED_class-native = "" |
| 11 | PTEST_ENABLED_class-nativesdk = "" |
| 12 | PTEST_ENABLED_class-cross-canadian = "" |
| 13 | RDEPENDS_${PN}-ptest_class-native = "" |
| 14 | RDEPENDS_${PN}-ptest_class-nativesdk = "" |
| 15 | RRECOMMENDS_${PN}-ptest += "ptest-runner" |
| 16 | |
| 17 | PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}" |
| 18 | |
| 19 | do_configure_ptest() { |
| 20 | : |
| 21 | } |
| 22 | |
| 23 | do_configure_ptest_base() { |
| 24 | do_configure_ptest |
| 25 | } |
| 26 | |
| 27 | do_compile_ptest() { |
| 28 | : |
| 29 | } |
| 30 | |
| 31 | do_compile_ptest_base() { |
| 32 | do_compile_ptest |
| 33 | } |
| 34 | |
| 35 | do_install_ptest() { |
| 36 | : |
| 37 | } |
| 38 | |
| 39 | do_install_ptest_base() { |
| 40 | if [ -f ${WORKDIR}/run-ptest ]; then |
| 41 | install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 43 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | do_configure_ptest_base[dirs] = "${B}" |
| 51 | do_compile_ptest_base[dirs] = "${B}" |
| 52 | do_install_ptest_base[dirs] = "${B}" |
| 53 | do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}" |
| 54 | |
| 55 | addtask configure_ptest_base after do_configure before do_compile |
| 56 | addtask compile_ptest_base after do_compile before do_install |
| 57 | addtask install_ptest_base after do_install before do_package do_populate_sysroot |
| 58 | |
| 59 | python () { |
| 60 | if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 61 | d.setVarFlag('do_install_ptest_base', 'fakeroot', '1') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | } |