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 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 5 | PTEST_PATH ?= "${libdir}/${BPN}/ptest" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 6 | PTEST_BUILD_HOST_FILES ?= "Makefile" |
| 7 | PTEST_BUILD_HOST_PATTERN ?= "" |
| 8 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | FILES_${PN}-ptest = "${PTEST_PATH}" |
| 10 | SECTION_${PN}-ptest = "devel" |
| 11 | ALLOW_EMPTY_${PN}-ptest = "1" |
| 12 | PTEST_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}" |
| 13 | PTEST_ENABLED_class-native = "" |
| 14 | PTEST_ENABLED_class-nativesdk = "" |
| 15 | PTEST_ENABLED_class-cross-canadian = "" |
| 16 | RDEPENDS_${PN}-ptest_class-native = "" |
| 17 | RDEPENDS_${PN}-ptest_class-nativesdk = "" |
| 18 | RRECOMMENDS_${PN}-ptest += "ptest-runner" |
| 19 | |
| 20 | PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}" |
| 21 | |
| 22 | do_configure_ptest() { |
| 23 | : |
| 24 | } |
| 25 | |
| 26 | do_configure_ptest_base() { |
| 27 | do_configure_ptest |
| 28 | } |
| 29 | |
| 30 | do_compile_ptest() { |
| 31 | : |
| 32 | } |
| 33 | |
| 34 | do_compile_ptest_base() { |
| 35 | do_compile_ptest |
| 36 | } |
| 37 | |
| 38 | do_install_ptest() { |
| 39 | : |
| 40 | } |
| 41 | |
| 42 | do_install_ptest_base() { |
| 43 | if [ -f ${WORKDIR}/run-ptest ]; then |
| 44 | install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 46 | if grep -q install-ptest: Makefile; then |
| 47 | oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest |
| 48 | fi |
| 49 | do_install_ptest |
| 50 | chown -R root:root ${D}${PTEST_PATH} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 51 | |
| 52 | # Strip build host paths from any installed Makefile |
| 53 | for filename in ${PTEST_BUILD_HOST_FILES}; do |
| 54 | for installed_ptest_file in $(find ${D}${PTEST_PATH} -type f -name $filename); do |
| 55 | bbnote "Stripping host paths from: $installed_ptest_file" |
| 56 | sed -e 's#${HOSTTOOLS_DIR}/*##g' \ |
| 57 | -e 's#${WORKDIR}/*=#.=#g' \ |
| 58 | -e 's#${WORKDIR}/*##g' \ |
| 59 | -i $installed_ptest_file |
| 60 | if [ -n "${PTEST_BUILD_HOST_PATTERN}" ]; then |
| 61 | sed -E '/${PTEST_BUILD_HOST_PATTERN}/d' \ |
| 62 | -i $installed_ptest_file |
| 63 | fi |
| 64 | done |
| 65 | done |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | do_configure_ptest_base[dirs] = "${B}" |
| 69 | do_compile_ptest_base[dirs] = "${B}" |
| 70 | do_install_ptest_base[dirs] = "${B}" |
| 71 | do_install_ptest_base[cleandirs] = "${D}${PTEST_PATH}" |
| 72 | |
| 73 | addtask configure_ptest_base after do_configure before do_compile |
| 74 | addtask compile_ptest_base after do_compile before do_install |
| 75 | addtask install_ptest_base after do_install before do_package do_populate_sysroot |
| 76 | |
| 77 | python () { |
| 78 | 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] | 79 | d.setVarFlag('do_install_ptest_base', 'fakeroot', '1') |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 80 | d.setVarFlag('do_install_ptest_base', 'umask', '022') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 81 | |
| 82 | # Remove all '*ptest_base' tasks when ptest is not enabled |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 83 | if not(d.getVar('PTEST_ENABLED') == "1"): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']: |
| 85 | bb.build.deltask(i, d) |
| 86 | } |