summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2021-11-09 16:28:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-23 14:04:02 +0000
commit0e0c481a25f10f8f7ff1d69bda7f015186da0202 (patch)
tree8aeedfe644f6aee88b67e707c74d293a8fef2c27 /meta
parent8dcf0325928942ba55710805204fd2e614647de7 (diff)
downloadpoky-0e0c481a25f10f8f7ff1d69bda7f015186da0202.tar.gz
glibc: ptest: Add running glibc time related test suite (Y2038) with ptest
This patch introduces new recipe - namely 'glibc-tests', which builds and installs time related (to check if Y2038 support works) glibc test suite to OE/Yocto built image. It reuses code from already available 'glibc-testsuite' recipe, which is run with 'bitbake glibc-testsuite -c check' and uses qemu to execute remotely (via SSH) tests on some emulated machine. This recipe installs time related glibc tests on some rootfs image. Afterwards, those tests can be executed on the real hardware, to facilitate validation of it with Y2038 problem compliance. To test time related subset - one needs to call: ptest-runner glibc-tests then change the date after Y2038 threshold for 32 bit systems: date -s "20 JAN 2038 18:00:00" and then run ptest-runner again. To facilitate debugging, source files are provided by default with the unstripped debugging symbols. Such approach would reduce the already complex recipe (as it inherits base glibc one), so there is no need to also install *-dbg and *-src packages. (From OE-Core rev: 0a64888e033694e7a68f12df81ef8edfdca0ba3c) Signed-off-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/conf/distro/include/maintainers.inc1
-rw-r--r--meta/conf/distro/include/ptest-packagelists.inc1
-rw-r--r--meta/recipes-core/glibc/glibc-tests_2.34.bb113
-rwxr-xr-xmeta/recipes-core/glibc/glibc/run-ptest37
4 files changed, 152 insertions, 0 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index ed21fbf39a..5423358e77 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -209,6 +209,7 @@ RECIPE_MAINTAINER:pn-glibc = "Khem Raj <raj.khem@gmail.com>"
209RECIPE_MAINTAINER:pn-glibc-locale = "Khem Raj <raj.khem@gmail.com>" 209RECIPE_MAINTAINER:pn-glibc-locale = "Khem Raj <raj.khem@gmail.com>"
210RECIPE_MAINTAINER:pn-glibc-mtrace = "Khem Raj <raj.khem@gmail.com>" 210RECIPE_MAINTAINER:pn-glibc-mtrace = "Khem Raj <raj.khem@gmail.com>"
211RECIPE_MAINTAINER:pn-glibc-scripts = "Khem Raj <raj.khem@gmail.com>" 211RECIPE_MAINTAINER:pn-glibc-scripts = "Khem Raj <raj.khem@gmail.com>"
212RECIPE_MAINTAINER:pn-glibc-tests = "Lukasz Majewski <lukma@denx.de>"
212RECIPE_MAINTAINER:pn-glibc-testsuite = "Khem Raj <raj.khem@gmail.com>" 213RECIPE_MAINTAINER:pn-glibc-testsuite = "Khem Raj <raj.khem@gmail.com>"
213RECIPE_MAINTAINER:pn-glide = "Otavio Salvador <otavio.salvador@ossystems.com.br>" 214RECIPE_MAINTAINER:pn-glide = "Otavio Salvador <otavio.salvador@ossystems.com.br>"
214RECIPE_MAINTAINER:pn-gmp = "Khem Raj <raj.khem@gmail.com>" 215RECIPE_MAINTAINER:pn-gmp = "Khem Raj <raj.khem@gmail.com>"
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 9559f611d0..0277ddaf1a 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -61,6 +61,7 @@ PTESTS_FAST = "\
61 slang-ptest \ 61 slang-ptest \
62 wayland-ptest \ 62 wayland-ptest \
63 zlib-ptest \ 63 zlib-ptest \
64 glibc-tests-ptest \
64" 65"
65PTESTS_FAST:remove:mips64 = "qemu-ptest" 66PTESTS_FAST:remove:mips64 = "qemu-ptest"
66PTESTS_PROBLEMS:append:mips64 = " qemu-ptest" 67PTESTS_PROBLEMS:append:mips64 = " qemu-ptest"
diff --git a/meta/recipes-core/glibc/glibc-tests_2.34.bb b/meta/recipes-core/glibc/glibc-tests_2.34.bb
new file mode 100644
index 0000000000..42b510c053
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-tests_2.34.bb
@@ -0,0 +1,113 @@
1require glibc_${PV}.bb
2require glibc-tests.inc
3
4inherit ptest
5
6SRC_URI:append = " \
7 file://run-ptest \
8"
9
10SUMMARY = "glibc tests to be run with ptest"
11
12# Erase some variables already set by glibc_${PV}
13python __anonymous() {
14 # Remove packages provided by glibc build, we only need a subset of them
15 d.setVar("PACKAGES", "${PN} ${PN}-ptest")
16
17 d.setVar("PROVIDES", "${PN} ${PN}-ptest")
18 d.setVar("RPROVIDES", "${PN} ${PN}-ptest")
19
20 d.setVar("BBCLASSEXTEND", "")
21 d.setVar("RRECOMMENDS", "")
22}
23
24# Remove any leftovers from original glibc recipe
25RPROVIDES:${PN} = "${PN}"
26RRECOMMENDS:${PN} = ""
27RDEPENDS:${PN} = " glibc sed"
28DEPENDS:append = " sed"
29
30# Just build tests for target - do not run them
31do_check:append () {
32 oe_runmake -i check run-built-tests=no
33}
34addtask do_check after do_compile before do_install_ptest_base
35
36glibc_strip_build_directory () {
37 # Delete all non executable files from build directory
38 find ${B} ! -executable -type f -delete
39
40 # Remove build dynamic libraries and links to them as
41 # those are already installed in the target device
42 find ${B} -type f -name "*.so" -delete
43 find ${B} -type l -name "*.so*" -delete
44
45 # Remove headers (installed with glibc)
46 find ${B} -type f -name "*.h" -delete
47
48 find ${B} -type f -name "isomac" -delete
49 find ${B} -type f -name "annexc" -delete
50}
51
52do_install_ptest_base () {
53 glibc_strip_build_directory
54
55 ls -r ${B}/*/*-time64 > ${B}/tst_time64
56
57 # Remove '-time64' suffix - those tests are also time related
58 sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp
59 tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
60
61 rm ${B}/tst_time_tmp ${B}/tst_time64
62 echo "${tst_time}"
63
64 # Install build test programs to the image
65 install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
66
67 for f in "${tst_time}"
68 do
69 cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
70 done
71
72 install -d ${D}${PTEST_PATH}
73 cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
74
75}
76
77# The datadir directory is required to allow core (and reused)
78# glibc cleanup function to finish correctly, as this directory
79# is not created for ptests
80stash_locale_package_cleanup:prepend () {
81 mkdir -p ${PKGD}${datadir}
82}
83
84stash_locale_sysroot_cleanup:prepend () {
85 mkdir -p ${SYSROOT_DESTDIR}${datadir}
86}
87
88# Prevent the do_package() task to set 'libc6' prefix
89# for glibc tests related packages
90python populate_packages:prepend () {
91 if d.getVar('DEBIAN_NAMES'):
92 d.setVar('DEBIAN_NAMES', '')
93}
94
95FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*"
96
97EXCLUDE_FROM_SHLIBS = "1"
98
99# Install debug data in .debug and sources in /usr/src/debug
100# It is more handy to have _all_ the sources and symbols in one
101# place (package) as this recipe will be used for validation and
102# debugging.
103PACKAGE_DEBUG_SPLIT_STYLE = "debug"
104
105# glibc test cases violate by default some Yocto/OE checks (staticdev,
106# textrel)
107# 'debug-files' - add everything (including debug) into one package
108# (no need to install/build *-src package)
109INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
110
111deltask do_stash_locale
112do_install[noexec] = "1"
113do_populate_sysroot[noexec] = "1"
diff --git a/meta/recipes-core/glibc/glibc/run-ptest b/meta/recipes-core/glibc/glibc/run-ptest
new file mode 100755
index 0000000000..f637986105
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/run-ptest
@@ -0,0 +1,37 @@
1#!/bin/sh
2# ptest script for glibc - to run time related tests to
3# facilitate Y2038 validation
4# Run with 'ptest-runner glibc-tests'
5
6output() {
7 retcode=$?
8 if [ $retcode -eq 0 ]
9 then echo "PASS: $i"
10 elif [ $retcode -eq 77 ]
11 then echo "SKIP: $i"
12 else echo "FAIL: $i"
13 fi
14}
15
16# Allow altering time on the target
17export GLIBC_TEST_ALLOW_TIME_SETTING="1"
18
19tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
20
21# Remove '-time64' suffix - those tests are also time
22# related
23tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
24
25# Run tests supporting only 32 bit time
26for i in ${tst_time_tmp}
27do
28 $i >/dev/null 2>&1
29 output
30done
31
32# Run tests supporting only 64 bit time
33for i in ${tst_time64}
34do
35 $i >/dev/null 2>&1
36 output
37done