xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-core/glibc/glibc-tests_2.35.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1require glibc_${PV}.bb
2require glibc-tests.inc
3
4inherit ptest features_check
5REQUIRED_DISTRO_FEATURES = "ptest"
6
7SRC_URI += " \
8	file://reproducible-paths.patch \
9	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
22       bbclassextend = d.getVar("BBCLASSEXTEND").replace("nativesdk", "").strip()
23       d.setVar("BBCLASSEXTEND", bbclassextend)
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
30RPROVIDES:${PN} = "${PN}"
31RRECOMMENDS:${PN} = ""
32RDEPENDS:${PN} = " glibc sed"
33DEPENDS += "sed"
34
35export oe_srcdir="${exec_prefix}/src/debug/glibc/${PV}/"
36
37# 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
102FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/${PN}/*"
103
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"
121