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