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