blob: 96d0569ff67e22e7645c47f2e3aeedbb80bafeb4 [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001require glibc_${PV}.bb
2require glibc-tests.inc
3
Patrick Williams03907ee2022-05-01 06:28:52 -05004inherit ptest features_check
5REQUIRED_DISTRO_FEATURES = "ptest"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00006
7SRC_URI:append = " \
Andrew Geissler615f2f12022-07-15 14:00:58 -05008 file://reproducible-paths.patch \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00009 file://run-ptest \
10"
11
12SUMMARY = "glibc tests to be run with ptest"
13
14# Erase some variables already set by glibc_${PV}
15python __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 Geissler615f2f12022-07-15 14:00:58 -050022 bbclassextend = d.getVar("BBCLASSEXTEND").replace("nativesdk", "").strip()
23 d.setVar("BBCLASSEXTEND", bbclassextend)
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000024 d.setVar("RRECOMMENDS", "")
25 d.setVar("SYSTEMD_SERVICE:nscd", "")
26 d.setVar("SYSTEMD_PACKAGES", "")
27}
28
29# Remove any leftovers from original glibc recipe
30RPROVIDES:${PN} = "${PN}"
31RRECOMMENDS:${PN} = ""
32RDEPENDS:${PN} = " glibc sed"
33DEPENDS:append = " sed"
34
Andrew Geissler615f2f12022-07-15 14:00:58 -050035export oe_srcdir="${exec_prefix}/src/debug/glibc/${PV}/"
36
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000037# Just build tests for target - do not run them
38do_check:append () {
39 oe_runmake -i check run-built-tests=no
40}
41addtask do_check after do_compile before do_install_ptest_base
42
43glibc_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
59do_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
87stash_locale_package_cleanup:prepend () {
88 mkdir -p ${PKGD}${datadir}
89}
90
91stash_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
97python populate_packages:prepend () {
98 if d.getVar('DEBIAN_NAMES'):
99 d.setVar('DEBIAN_NAMES', '')
100}
101
Andrew Geissler615f2f12022-07-15 14:00:58 -0500102FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/${PN}/*"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000103
104EXCLUDE_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.
110PACKAGE_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)
116INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
117
118deltask do_stash_locale
119do_install[noexec] = "1"
120do_populate_sysroot[noexec] = "1"