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