Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame^] | 1 | require glibc_${PV}.bb |
| 2 | require glibc-tests.inc |
| 3 | |
| 4 | inherit ptest |
| 5 | |
| 6 | SRC_URI:append = " \ |
| 7 | file://run-ptest \ |
| 8 | " |
| 9 | |
| 10 | SUMMARY = "glibc tests to be run with ptest" |
| 11 | |
| 12 | # Erase some variables already set by glibc_${PV} |
| 13 | python __anonymous() { |
| 14 | # Remove packages provided by glibc build, we only need a subset of them |
| 15 | d.setVar("PACKAGES", "${PN} ${PN}-ptest") |
| 16 | |
| 17 | d.setVar("PROVIDES", "${PN} ${PN}-ptest") |
| 18 | d.setVar("RPROVIDES", "${PN} ${PN}-ptest") |
| 19 | |
| 20 | d.setVar("BBCLASSEXTEND", "") |
| 21 | d.setVar("RRECOMMENDS", "") |
| 22 | d.setVar("SYSTEMD_SERVICE:nscd", "") |
| 23 | d.setVar("SYSTEMD_PACKAGES", "") |
| 24 | } |
| 25 | |
| 26 | # Remove any leftovers from original glibc recipe |
| 27 | RPROVIDES:${PN} = "${PN}" |
| 28 | RRECOMMENDS:${PN} = "" |
| 29 | RDEPENDS:${PN} = " glibc sed" |
| 30 | DEPENDS:append = " sed" |
| 31 | |
| 32 | # Just build tests for target - do not run them |
| 33 | do_check:append () { |
| 34 | oe_runmake -i check run-built-tests=no |
| 35 | } |
| 36 | addtask do_check after do_compile before do_install_ptest_base |
| 37 | |
| 38 | glibc_strip_build_directory () { |
| 39 | # Delete all non executable files from build directory |
| 40 | find ${B} ! -executable -type f -delete |
| 41 | |
| 42 | # Remove build dynamic libraries and links to them as |
| 43 | # those are already installed in the target device |
| 44 | find ${B} -type f -name "*.so" -delete |
| 45 | find ${B} -type l -name "*.so*" -delete |
| 46 | |
| 47 | # Remove headers (installed with glibc) |
| 48 | find ${B} -type f -name "*.h" -delete |
| 49 | |
| 50 | find ${B} -type f -name "isomac" -delete |
| 51 | find ${B} -type f -name "annexc" -delete |
| 52 | } |
| 53 | |
| 54 | do_install_ptest_base () { |
| 55 | glibc_strip_build_directory |
| 56 | |
| 57 | ls -r ${B}/*/*-time64 > ${B}/tst_time64 |
| 58 | |
| 59 | # Remove '-time64' suffix - those tests are also time related |
| 60 | sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp |
| 61 | tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64) |
| 62 | |
| 63 | rm ${B}/tst_time_tmp ${B}/tst_time64 |
| 64 | echo "${tst_time}" |
| 65 | |
| 66 | # Install build test programs to the image |
| 67 | install -d ${D}${PTEST_PATH}/tests/glibc-ptest/ |
| 68 | |
| 69 | for f in "${tst_time}" |
| 70 | do |
| 71 | cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/ |
| 72 | done |
| 73 | |
| 74 | install -d ${D}${PTEST_PATH} |
| 75 | cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/ |
| 76 | |
| 77 | } |
| 78 | |
| 79 | # The datadir directory is required to allow core (and reused) |
| 80 | # glibc cleanup function to finish correctly, as this directory |
| 81 | # is not created for ptests |
| 82 | stash_locale_package_cleanup:prepend () { |
| 83 | mkdir -p ${PKGD}${datadir} |
| 84 | } |
| 85 | |
| 86 | stash_locale_sysroot_cleanup:prepend () { |
| 87 | mkdir -p ${SYSROOT_DESTDIR}${datadir} |
| 88 | } |
| 89 | |
| 90 | # Prevent the do_package() task to set 'libc6' prefix |
| 91 | # for glibc tests related packages |
| 92 | python populate_packages:prepend () { |
| 93 | if d.getVar('DEBIAN_NAMES'): |
| 94 | d.setVar('DEBIAN_NAMES', '') |
| 95 | } |
| 96 | |
| 97 | FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*" |
| 98 | |
| 99 | EXCLUDE_FROM_SHLIBS = "1" |
| 100 | |
| 101 | # Install debug data in .debug and sources in /usr/src/debug |
| 102 | # It is more handy to have _all_ the sources and symbols in one |
| 103 | # place (package) as this recipe will be used for validation and |
| 104 | # debugging. |
| 105 | PACKAGE_DEBUG_SPLIT_STYLE = ".debug" |
| 106 | |
| 107 | # glibc test cases violate by default some Yocto/OE checks (staticdev, |
| 108 | # textrel) |
| 109 | # 'debug-files' - add everything (including debug) into one package |
| 110 | # (no need to install/build *-src package) |
| 111 | INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths" |
| 112 | |
| 113 | deltask do_stash_locale |
| 114 | do_install[noexec] = "1" |
| 115 | do_populate_sysroot[noexec] = "1" |