Skip to contentSkip to conversation

glibc: ptest: Add running glibc time related test suite (Y2038) with ptest

PATCH Superseded Lukasz Majewski 4 participants 7 messages Oct 28, 2021 – Nov 9, 2021

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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.

---
Changes for v3:
- Provide missing ${PN}-ptest for PACKAGES, PROVIDES and RPROVIDES variables

Changes for v2:
- Just focus on time related set of tests as those can be run as standalone
- Reuse of already built tests (from glibc-tests.inc) and depoloy them on the HW target.
- Provide single 'run-ptest' script.
- Update the recipe to run with newest poky's -master

---
 .../distro/include/ptest-packagelists.inc     |   1 +
 meta/recipes-core/glibc/glibc-tests_2.34.bb   | 112 ++++++++++++++++++
 meta/recipes-core/glibc/glibc/run-ptest       |  37 ++++++
 3 files changed, 150 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc-tests_2.34.bb
 create mode 100755 meta/recipes-core/glibc/glibc/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 2e324f8da4..fd52fa72a4 100644
@@ -61,6 +61,7 @@ PTESTS_FAST = "\
     slang-ptest \
     wayland-ptest \
     zlib-ptest \
+    glibc-tests-ptest \
 "
 PTESTS_FAST:remove:mips64 = "qemu-ptest"
 PTESTS_PROBLEMS:append:mips64 = "qemu-ptest"
meta/recipes-core/glibc/glibc-tests_2.34.bb new file +112 -0

112 lines not on this page · raw message

meta/recipes-core/glibc/glibc/run-ptest new file +37 -0
new file mode 100755
index 0000000000..f637986105
@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to
+# facilitate Y2038 validation
+# Run with 'ptest-runner glibc-tests'
+
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target
+export GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time
+# related
+tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
+
+# Run tests supporting only 32 bit time
+for i in ${tst_time_tmp}
+do
+	$i >/dev/null 2>&1
+	output
+done
+
+# Run tests supporting only 64 bit time
+for i in ${tst_time64}
+do
+	$i >/dev/null 2>&1
+	output
+done
Signature · 1 line
2.20.1
#1 lore raw

Hello,

There is a remaining issue:

WARNING: Nothing RPROVIDES 'nativesdk-ptest-runner' (but virtual:nativesdk:/home/pokybuild/yocto-worker/build-appliance/build/meta/recipes-core/glibc/glibc-tests_2.34.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'nativesdk-ptest-runner' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['nativesdk-ptest-runner']

Quoted 231 lines · ?ukasz Majewski

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.

---
Changes for v3:
- Provide missing ${PN}-ptest for PACKAGES, PROVIDES and RPROVIDES variables

Changes for v2:
- Just focus on time related set of tests as those can be run as standalone
- Reuse of already built tests (from glibc-tests.inc) and depoloy them on the HW target.
- Provide single 'run-ptest' script.
- Update the recipe to run with newest poky's -master

---
 .../distro/include/ptest-packagelists.inc     |   1 +
 meta/recipes-core/glibc/glibc-tests_2.34.bb   | 112 ++++++++++++++++++
 meta/recipes-core/glibc/glibc/run-ptest       |  37 ++++++
 3 files changed, 150 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc-tests_2.34.bb
 create mode 100755 meta/recipes-core/glibc/glibc/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 2e324f8da4..fd52fa72a4 100644
@@ -61,6 +61,7 @@ PTESTS_FAST = "\
     slang-ptest \
     wayland-ptest \
     zlib-ptest \
+    glibc-tests-ptest \
 "
 PTESTS_FAST:remove:mips64 = "qemu-ptest"
 PTESTS_PROBLEMS:append:mips64 = "qemu-ptest"
meta/recipes-core/glibc/glibc-tests_2.34.bb new file +112 -0
new file mode 100644
index 0000000000..0a6920eef4
@@ -0,0 +1,112 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit ptest
+
+SRC_URI:append = " \
+	file://run-ptest \
+"
+
+SUMMARY = "glibc tests to be run with ptest"
+
+# Erase some variables already set by glibc_${PV}
+python __anonymous() {
+       # Remove packages provided by glibc build, we only need a subset of them
+       d.setVar("PACKAGES", "${PN} ${PN}-ptest")
+
+       d.setVar("PROVIDES", "${PN} ${PN}-ptest")
+       d.setVar("RPROVIDES", "${PN} ${PN}-ptest")
+
+       d.setVar("RRECOMMENDS", "")
+}
+
+# Remove any lefovers from original glibc recipe
+RPROVIDES:${PN} = "${PN}"
+RRECOMMENDS:${PN} = ""
+RDEPENDS:${PN} = " glibc sed"
+DEPENDS:append = " sed"
+
+# Just build tests for target - do not run them
+do_check:append () {
+	oe_runmake -i check run-built-tests=no
+}
+addtask do_check after do_compile before do_install_ptest_base
+
+glibc_strip_build_directory () {
+	# Delete all non executable files from build directory
+	find ${B} ! -executable -type f -delete
+
+	# Remove build dynamic libraries and links to them as
+	# those are already installed in the target device
+	find ${B} -type f -name "*.so" -delete
+	find ${B} -type l -name "*.so*" -delete
+
+	# Remove headers (installed with glibc)
+	find ${B} -type f -name "*.h" -delete
+
+	find ${B} -type f -name "isomac" -delete
+	find ${B} -type f -name "annexc" -delete
+}
+
+do_install_ptest_base () {
+	glibc_strip_build_directory
+
+	ls -r ${B}/*/*-time64 > ${B}/tst_time64
+
+	# Remove '-time64' suffix - those tests are also time related
+	sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp
+	tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
+
+	rm ${B}/tst_time_tmp ${B}/tst_time64
+	echo "${tst_time}"
+
+	# Install build test programs to the image
+	install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
+
+	for f in "${tst_time}"
+	do
+	    cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
+	done
+
+	install -d ${D}${PTEST_PATH}
+	cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+
+}
+
+# The datadir directory is required to allow core (and reused)
+# glibc cleanup function to finish correctly, as this directory
+# is not created for ptests
+stash_locale_package_cleanup:prepend () {
+	mkdir -p ${PKGD}${datadir}
+}
+
+stash_locale_sysroot_cleanup:prepend () {
+	mkdir -p ${SYSROOT_DESTDIR}${datadir}
+}
+
+# Prevent the do_package() task to set 'libc6' prefix
+# for glibc tests related packages
+python populate_packages:prepend () {
+    if d.getVar('DEBIAN_NAMES'):
+        d.setVar('DEBIAN_NAMES', '')
+}
+
+FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*"
+
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Install debug data in .debug and sources in /usr/src/debug
+# It is more handy to have _all_ the sources and symbols in one
+# place (package) as this recipe will be used for validation and
+# debugging.
+PACKAGE_DEBUG_SPLIT_STYLE = "debug"
+
+# glibc test cases violate by default some Yocto/OE checks (staticdev,
+# textrel)
+# 'debug-files' - add everything (including debug) into one package
+#                 (no need to install/build *-src package)
+INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
+
+deltask do_stash_locale
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
meta/recipes-core/glibc/glibc/run-ptest new file +37 -0
new file mode 100755
index 0000000000..f637986105
@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to
+# facilitate Y2038 validation
+# Run with 'ptest-runner glibc-tests'
+
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target
+export GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time
+# related
+tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
+
+# Run tests supporting only 32 bit time
+for i in ${tst_time_tmp}
+do
+	$i >/dev/null 2>&1
+	output
+done
+
+# Run tests supporting only 64 bit time
+for i in ${tst_time64}
+do
+	$i >/dev/null 2>&1
+	output
+done
Signature · 11 lines
2.20.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#157595): https://lists.openembedded.org/g/openembedded-core/message/157595
Mute This Topic: https://lists.openembedded.org/mt/86650301/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

Hi Alexandre.

Sorry for the late reply - I've must overlooked this reply...

Quoted 9 lines

Hello,

There is a remaining issue:

WARNING: Nothing RPROVIDES 'nativesdk-ptest-runner' (but virtual:nativesdk:/home/pokybuild/yocto-worker/build-appliance/build/meta/recipes-core/glibc/glibc-tests_2.34.bb RDEPENDS on or otherwise requires it) NOTE: Runtime target
'nativesdk-ptest-runner' is unbuildable, removing... Missing or
unbuildable dependency chain was: ['nativesdk-ptest-runner']

Could you share your setup?

I've been trying to reproduce this problem with:
MACHINE=qemuarm64 bitbake core-image-ptest-all -c populate_sdk

but no warnings were observed.

Thanks in advance.

Quoted 227 lines · ?ukasz Majewski
Quoted 225 lines

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.

---
Changes for v3:
- Provide missing ${PN}-ptest for PACKAGES, PROVIDES and RPROVIDES variables

Changes for v2:
- Just focus on time related set of tests as those can be run as standalone
- Reuse of already built tests (from glibc-tests.inc) and depoloy them on the HW target.
- Provide single 'run-ptest' script.
- Update the recipe to run with newest poky's -master

---
 .../distro/include/ptest-packagelists.inc     |   1 +
 meta/recipes-core/glibc/glibc-tests_2.34.bb   | 112
++++++++++++++++++ meta/recipes-core/glibc/glibc/run-ptest       |
37 ++++++ 3 files changed, 150 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc-tests_2.34.bb
 create mode 100755 meta/recipes-core/glibc/glibc/run-ptest
(quoted diff) +0 -0

b/meta/conf/distro/include/ptest-packagelists.inc index 2e324f8da4..fd52fa72a4 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -61,6 +61,7 @@

PTESTS_FAST = "\ slang-ptest \
     wayland-ptest \
     zlib-ptest \
meta/conf/distro/include/ptest-packagelists.inc +1 -0
+    glibc-tests-ptest \
 "
 PTESTS_FAST:remove:mips64 = "qemu-ptest"
 PTESTS_PROBLEMS:append:mips64 = "qemu-ptest"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-tests_2.34.bb new file mode 100644 index 0000000000..0a6920eef4

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +14 -0
@@ -0,0 +1,112 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit ptest
+
+SRC_URI:append = " \
+	file://run-ptest \
+"
+
+SUMMARY = "glibc tests to be run with ptest"
+
+# Erase some variables already set by glibc_${PV}
+python __anonymous() {
+       # Remove packages provided by glibc build, we only need a

subset of them

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +42 -0
+       d.setVar("PACKAGES", "${PN} ${PN}-ptest")
+
+       d.setVar("PROVIDES", "${PN} ${PN}-ptest")
+       d.setVar("RPROVIDES", "${PN} ${PN}-ptest")
+
+       d.setVar("RRECOMMENDS", "")
+}
+
+# Remove any lefovers from original glibc recipe
+RPROVIDES:${PN} = "${PN}"
+RRECOMMENDS:${PN} = ""
+RDEPENDS:${PN} = " glibc sed"
+DEPENDS:append = " sed"
+
+# Just build tests for target - do not run them
+do_check:append () {
+	oe_runmake -i check run-built-tests=no
+}
+addtask do_check after do_compile before do_install_ptest_base
+
+glibc_strip_build_directory () {
+	# Delete all non executable files from build directory
+	find ${B} ! -executable -type f -delete
+
+	# Remove build dynamic libraries and links to them as
+	# those are already installed in the target device
+	find ${B} -type f -name "*.so" -delete
+	find ${B} -type l -name "*.so*" -delete
+
+	# Remove headers (installed with glibc)
+	find ${B} -type f -name "*.h" -delete
+
+	find ${B} -type f -name "isomac" -delete
+	find ${B} -type f -name "annexc" -delete
+}
+
+do_install_ptest_base () {
+	glibc_strip_build_directory
+
+	ls -r ${B}/*/*-time64 > ${B}/tst_time64
+
+	# Remove '-time64' suffix - those tests are also time

related

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +48 -0
+	sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp
+	tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
+
+	rm ${B}/tst_time_tmp ${B}/tst_time64
+	echo "${tst_time}"
+
+	# Install build test programs to the image
+	install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
+
+	for f in "${tst_time}"
+	do
+	    cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
+	done
+
+	install -d ${D}${PTEST_PATH}
+	cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+
+}
+
+# The datadir directory is required to allow core (and reused)
+# glibc cleanup function to finish correctly, as this directory
+# is not created for ptests
+stash_locale_package_cleanup:prepend () {
+	mkdir -p ${PKGD}${datadir}
+}
+
+stash_locale_sysroot_cleanup:prepend () {
+	mkdir -p ${SYSROOT_DESTDIR}${datadir}
+}
+
+# Prevent the do_package() task to set 'libc6' prefix
+# for glibc tests related packages
+python populate_packages:prepend () {
+    if d.getVar('DEBIAN_NAMES'):
+        d.setVar('DEBIAN_NAMES', '')
+}
+
+FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*"
+
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Install debug data in .debug and sources in /usr/src/debug
+# It is more handy to have _all_ the sources and symbols in one
+# place (package) as this recipe will be used for validation and
+# debugging.
+PACKAGE_DEBUG_SPLIT_STYLE = "debug"
+
+# glibc test cases violate by default some Yocto/OE checks

(staticdev, +# textrel)

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +7 -0
+# 'debug-files' - add everything (including debug) into one package
+#                 (no need to install/build *-src package)
+INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
+
+deltask do_stash_locale
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc/run-ptest new file mode 100755 index 0000000000..f637986105

meta/recipes-core/glibc/glibc/run-ptest new file +37 -0
@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to
+# facilitate Y2038 validation
+# Run with 'ptest-runner glibc-tests'
+
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target
+export GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time
+# related
+tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
+
+# Run tests supporting only 32 bit time
+for i in ${tst_time_tmp}
+do
+	$i >/dev/null 2>&1
+	output
+done
+
+# Run tests supporting only 64 bit time
+for i in ${tst_time64}
+do
+	$i >/dev/null 2>&1
+	output
+done
Signature · 1 line
2.20.1
Quoted 11 lines
Quoted 9 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#157595):
https://lists.openembedded.org/g/openembedded-core/message/157595
Mute This Topic: https://lists.openembedded.org/mt/86650301/3617179
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]] -=-=-=-=-=-=-=-=-=-=-=-

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#3 lore raw

Hi,

I think need to fix this too

AssertionError:
The following recipes do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file. glibc-tests (/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/recipes-core/glibc/glibc-tests_2.34.bb)

full log:
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/2807/steps/15/logs/stdio

also for issue with
"Missing or unbuildable dependency chain was: ['nativesdk-ptest-runner']" you may refer to these build for build config
https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/4598/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/97/builds/3629/steps/12/logs/stdio

Quoted 267 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of ?ukasz Majewski
Sent: Tuesday, 9 November, 2021 12:31 AM
To: Alexandre Belloni <[email protected]>
Cc: Richard Purdie <[email protected]>; Nathan Rossi <[email protected]>; Khem Raj <[email protected]>; Adhemerval Zanella <[email protected]>; Patches and discussions about the oe- core layer <[email protected]>
Subject: Re: [OE-core] [PATCH v3] glibc: ptest: Add running glibc time related test suite (Y2038) with ptest

Hi Alexandre.

Sorry for the late reply - I've must overlooked this reply...

Quoted 10 lines

Hello,

There is a remaining issue:

WARNING: Nothing RPROVIDES 'nativesdk-ptest-runner' (but virtual:nativesdk:/home/pokybuild/yocto-worker/build-appliance/build/m eta/recipes-core/glibc/glibc-tests_2.34.bb
RDEPENDS on or otherwise requires it) NOTE: Runtime target 'nativesdk-ptest-runner' is unbuildable, removing... Missing or unbuildable dependency chain was: ['nativesdk-ptest-runner']

Could you share your setup?

I've been trying to reproduce this problem with:
MACHINE=qemuarm64 bitbake core-image-ptest-all -c populate_sdk

but no warnings were observed.

Thanks in advance.

Quoted 208 lines · ?ukasz Majewski
Quoted 206 lines

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.

---
Changes for v3:
- Provide missing ${PN}-ptest for PACKAGES, PROVIDES and RPROVIDES variables

Changes for v2:
- Just focus on time related set of tests as those can be run as standalone
- Reuse of already built tests (from glibc-tests.inc) and depoloy them on the HW target.
- Provide single 'run-ptest' script.
- Update the recipe to run with newest poky's -master

---
 .../distro/include/ptest-packagelists.inc     |   1 +
 meta/recipes-core/glibc/glibc-tests_2.34.bb   | 112
++++++++++++++++++ meta/recipes-core/glibc/glibc/run-ptest       |
37 ++++++ 3 files changed, 150 insertions(+)  create mode 100644
meta/recipes-core/glibc/glibc-tests_2.34.bb
 create mode 100755 meta/recipes-core/glibc/glibc/run-ptest
(quoted diff) +0 -0

b/meta/conf/distro/include/ptest-packagelists.inc index 2e324f8da4..fd52fa72a4 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -61,6 +61,7 @@

PTESTS_FAST = "\ slang-ptest \
     wayland-ptest \
     zlib-ptest \
meta/conf/distro/include/ptest-packagelists.inc +1 -0
+    glibc-tests-ptest \
 "
 PTESTS_FAST:remove:mips64 = "qemu-ptest"
 PTESTS_PROBLEMS:append:mips64 = "qemu-ptest"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-tests_2.34.bb new file mode 100644 index 0000000000..0a6920eef4

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +14 -0
@@ -0,0 +1,112 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit ptest
+
+SRC_URI:append = " \
+	file://run-ptest \
+"
+
+SUMMARY = "glibc tests to be run with ptest"
+
+# Erase some variables already set by glibc_${PV} python
+__anonymous() {
+       # Remove packages provided by glibc build, we only need a

subset of them

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +40 -0
+       d.setVar("PACKAGES", "${PN} ${PN}-ptest")
+
+       d.setVar("PROVIDES", "${PN} ${PN}-ptest")
+       d.setVar("RPROVIDES", "${PN} ${PN}-ptest")
+
+       d.setVar("RRECOMMENDS", "")
+}
+
+# Remove any lefovers from original glibc recipe RPROVIDES:${PN} =
+"${PN}"
+RRECOMMENDS:${PN} = ""
+RDEPENDS:${PN} = " glibc sed"
+DEPENDS:append = " sed"
+
+# Just build tests for target - do not run them do_check:append ()
+{
+	oe_runmake -i check run-built-tests=no } addtask do_check after
+do_compile before do_install_ptest_base
+
+glibc_strip_build_directory () {
+	# Delete all non executable files from build directory
+	find ${B} ! -executable -type f -delete
+
+	# Remove build dynamic libraries and links to them as
+	# those are already installed in the target device
+	find ${B} -type f -name "*.so" -delete
+	find ${B} -type l -name "*.so*" -delete
+
+	# Remove headers (installed with glibc)
+	find ${B} -type f -name "*.h" -delete
+
+	find ${B} -type f -name "isomac" -delete
+	find ${B} -type f -name "annexc" -delete }
+
+do_install_ptest_base () {
+	glibc_strip_build_directory
+
+	ls -r ${B}/*/*-time64 > ${B}/tst_time64
+
+	# Remove '-time64' suffix - those tests are also time

related

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +44 -0
+	sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp
+	tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
+
+	rm ${B}/tst_time_tmp ${B}/tst_time64
+	echo "${tst_time}"
+
+	# Install build test programs to the image
+	install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
+
+	for f in "${tst_time}"
+	do
+	    cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
+	done
+
+	install -d ${D}${PTEST_PATH}
+	cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+
+}
+
+# The datadir directory is required to allow core (and reused) #
+glibc cleanup function to finish correctly, as this directory # is
+not created for ptests stash_locale_package_cleanup:prepend () {
+	mkdir -p ${PKGD}${datadir}
+}
+
+stash_locale_sysroot_cleanup:prepend () {
+	mkdir -p ${SYSROOT_DESTDIR}${datadir} }
+
+# Prevent the do_package() task to set 'libc6' prefix # for glibc
+tests related packages python populate_packages:prepend () {
+    if d.getVar('DEBIAN_NAMES'):
+        d.setVar('DEBIAN_NAMES', '') }
+
+FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*"
+
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Install debug data in .debug and sources in /usr/src/debug # It
+is more handy to have _all_ the sources and symbols in one # place
+(package) as this recipe will be used for validation and #
+debugging.
+PACKAGE_DEBUG_SPLIT_STYLE = "debug"
+
+# glibc test cases violate by default some Yocto/OE checks

(staticdev, +# textrel)

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +7 -0
+# 'debug-files' - add everything (including debug) into one package
+#                 (no need to install/build *-src package)
+INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
+
+deltask do_stash_locale
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc/run-ptest new file mode 100755 index 0000000000..f637986105

meta/recipes-core/glibc/glibc/run-ptest new file +29 -0
@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to #
+facilitate Y2038 validation # Run with 'ptest-runner glibc-tests'
+
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target export
+GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time # related
+tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
+
+# Run tests supporting only 32 bit time for i in ${tst_time_tmp} do
+	$i >/dev/null 2>&1
+	output
+done
+
+# Run tests supporting only 64 bit time for i in ${tst_time64} do
+	$i >/dev/null 2>&1
Quoted 10 lines
Quoted 8 lines
meta/recipes-core/glibc/glibc/run-ptest new file +2 -1
+	output
+done
--

2.20.1

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#4 lore raw

Hi Lee Chee,

Quoted 4 lines

Hi,

I think need to fix this too

Thanks for pointing out those issues.

Quoted 10 lines

AssertionError:
The following recipes do not have a maintainer assigned to them.
Please add an entry to meta/conf/distro/include/maintainers.inc file.
glibc-tests (/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/recipes-core/glibc/glibc-tests_2.34.bb)

full log:
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/2807/steps/15/logs/stdio

Quoted 8 lines

also for issue with
"Missing or unbuildable dependency chain was:
['nativesdk-ptest-runner']" you may refer to these build for build config
https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/4598/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/97/builds/3629/steps/12/logs/stdio

I will fix them and prepare v4.

Quoted 269 lines
Quoted 269 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of ?ukasz Majewski
Sent: Tuesday, 9 November, 2021 12:31 AM
To: Alexandre Belloni <[email protected]>
Cc: Richard Purdie <[email protected]>; Nathan Rossi <[email protected]>; Khem Raj <[email protected]>; Adhemerval Zanella <[email protected]>; Patches and discussions about the oe- core layer <[email protected]>
Subject: Re: [OE-core] [PATCH v3] glibc: ptest: Add running glibc time related test suite (Y2038) with ptest

Hi Alexandre.

Sorry for the late reply - I've must overlooked this reply...

Quoted 10 lines

Hello,

There is a remaining issue:

WARNING: Nothing RPROVIDES 'nativesdk-ptest-runner' (but virtual:nativesdk:/home/pokybuild/yocto-worker/build-appliance/build/m eta/recipes-core/glibc/glibc-tests_2.34.bb
RDEPENDS on or otherwise requires it) NOTE: Runtime target 'nativesdk-ptest-runner' is unbuildable, removing... Missing or unbuildable dependency chain was: ['nativesdk-ptest-runner']

Could you share your setup?

I've been trying to reproduce this problem with:
MACHINE=qemuarm64 bitbake core-image-ptest-all -c populate_sdk

but no warnings were observed.

Thanks in advance.

Quoted 216 lines · ?ukasz Majewski
Quoted 214 lines

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.

---
Changes for v3:
- Provide missing ${PN}-ptest for PACKAGES, PROVIDES and RPROVIDES variables

Changes for v2:
- Just focus on time related set of tests as those can be run as standalone
- Reuse of already built tests (from glibc-tests.inc) and depoloy them on the HW target.
- Provide single 'run-ptest' script.
- Update the recipe to run with newest poky's -master

---
 .../distro/include/ptest-packagelists.inc     |   1 +
 meta/recipes-core/glibc/glibc-tests_2.34.bb   | 112
++++++++++++++++++ meta/recipes-core/glibc/glibc/run-ptest
| 37 ++++++ 3 files changed, 150 insertions(+)  create mode
100644 meta/recipes-core/glibc/glibc-tests_2.34.bb
 create mode 100755 meta/recipes-core/glibc/glibc/run-ptest
(quoted diff) +0 -0

b/meta/conf/distro/include/ptest-packagelists.inc index 2e324f8da4..fd52fa72a4 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -61,6 +61,7

@@ PTESTS_FAST = "\ slang-ptest \
     wayland-ptest \
     zlib-ptest \
meta/conf/distro/include/ptest-packagelists.inc +1 -0
+    glibc-tests-ptest \
 "
 PTESTS_FAST:remove:mips64 = "qemu-ptest"
 PTESTS_PROBLEMS:append:mips64 = "qemu-ptest"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-tests_2.34.bb new file mode 100644 index 0000000000..0a6920eef4

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +14 -0
@@ -0,0 +1,112 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit ptest
+
+SRC_URI:append = " \
+	file://run-ptest \
+"
+
+SUMMARY = "glibc tests to be run with ptest"
+
+# Erase some variables already set by glibc_${PV} python
+__anonymous() {
+       # Remove packages provided by glibc build, we only need a

subset of them

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +9 -0
+       d.setVar("PACKAGES", "${PN} ${PN}-ptest")
+
+       d.setVar("PROVIDES", "${PN} ${PN}-ptest")
+       d.setVar("RPROVIDES", "${PN} ${PN}-ptest")
+
+       d.setVar("RRECOMMENDS", "")
+}
+
+# Remove any lefovers from original glibc recipe

RPROVIDES:${PN} = +"${PN}"

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +5 -0
+RRECOMMENDS:${PN} = ""
+RDEPENDS:${PN} = " glibc sed"
+DEPENDS:append = " sed"
+
+# Just build tests for target - do not run them do_check:append

() +{

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +1 -0
+	oe_runmake -i check run-built-tests=no } addtask

do_check after +do_compile before do_install_ptest_base

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +22 -0
+
+glibc_strip_build_directory () {
+	# Delete all non executable files from build directory
+	find ${B} ! -executable -type f -delete
+
+	# Remove build dynamic libraries and links to them as
+	# those are already installed in the target device
+	find ${B} -type f -name "*.so" -delete
+	find ${B} -type l -name "*.so*" -delete
+
+	# Remove headers (installed with glibc)
+	find ${B} -type f -name "*.h" -delete
+
+	find ${B} -type f -name "isomac" -delete
+	find ${B} -type f -name "annexc" -delete }
+
+do_install_ptest_base () {
+	glibc_strip_build_directory
+
+	ls -r ${B}/*/*-time64 > ${B}/tst_time64
+
+	# Remove '-time64' suffix - those tests are also time

related

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +1 -0
+	sed -e "s/-time64$//" ${B}/tst_time64 >

${B}/tst_time_tmp

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +20 -0
+	tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
+
+	rm ${B}/tst_time_tmp ${B}/tst_time64
+	echo "${tst_time}"
+
+	# Install build test programs to the image
+	install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
+
+	for f in "${tst_time}"
+	do
+	    cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
+	done
+
+	install -d ${D}${PTEST_PATH}
+	cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+
+}
+
+# The datadir directory is required to allow core (and reused) #
+glibc cleanup function to finish correctly, as this directory #

is +not created for ptests stash_locale_package_cleanup:prepend () {

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +7 -0
+	mkdir -p ${PKGD}${datadir}
+}
+
+stash_locale_sysroot_cleanup:prepend () {
+	mkdir -p ${SYSROOT_DESTDIR}${datadir} }
+
+# Prevent the do_package() task to set 'libc6' prefix # for

glibc +tests related packages python populate_packages:prepend () {

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +8 -0
+    if d.getVar('DEBIAN_NAMES'):
+        d.setVar('DEBIAN_NAMES', '') }
+
+FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*"
+
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Install debug data in .debug and sources in /usr/src/debug #

It +is more handy to have _all_ the sources and symbols in one # place +(package) as this recipe will be used for validation and #

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +4 -0
+debugging.
+PACKAGE_DEBUG_SPLIT_STYLE = "debug"
+
+# glibc test cases violate by default some Yocto/OE checks

(staticdev, +# textrel)
+# 'debug-files' - add everything (including debug) into one
package +# (no need to install/build *-src
package) +INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths" +

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +3 -0
+deltask do_stash_locale
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc/run-ptest new file mode 100755 index 0000000000..f637986105

meta/recipes-core/glibc/glibc/run-ptest new file +3 -0
@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to #
+facilitate Y2038 validation # Run with 'ptest-runner

glibc-tests' +

meta/recipes-core/glibc/glibc/run-ptest new file +19 -0
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target export
+GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time # related
+tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
+
+# Run tests supporting only 32 bit time for i in

${tst_time_tmp} do

meta/recipes-core/glibc/glibc/run-ptest new file +5 -0
+	$i >/dev/null 2>&1
+	output
+done
+
+# Run tests supporting only 64 bit time for i in ${tst_time64}

do

meta/recipes-core/glibc/glibc/run-ptest new file +1 -0
+	$i >/dev/null 2>&1
Quoted 10 lines
Quoted 8 lines
meta/recipes-core/glibc/glibc/run-ptest new file +2 -1
+	output
+done
--

2.20.1

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
[email protected]

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#5 lore raw
In reply to Lukasz Majewski

Dear Community,

Quoted 18 lines

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.

Quoted 5 lines

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.

Gentle ping on this patch ...

Quoted 186 lines

---
Changes for v3:
- Provide missing ${PN}-ptest for PACKAGES, PROVIDES and RPROVIDES variables

Changes for v2:
- Just focus on time related set of tests as those can be run as standalone
- Reuse of already built tests (from glibc-tests.inc) and depoloy them on the HW target.
- Provide single 'run-ptest' script.
- Update the recipe to run with newest poky's -master

---
 .../distro/include/ptest-packagelists.inc     |   1 +
 meta/recipes-core/glibc/glibc-tests_2.34.bb   | 112
++++++++++++++++++ meta/recipes-core/glibc/glibc/run-ptest       |
37 ++++++ 3 files changed, 150 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc-tests_2.34.bb
 create mode 100755 meta/recipes-core/glibc/glibc/run-ptest
(quoted diff) +0 -0

b/meta/conf/distro/include/ptest-packagelists.inc index 2e324f8da4..fd52fa72a4 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -61,6 +61,7 @@

PTESTS_FAST = "\ slang-ptest \
     wayland-ptest \
     zlib-ptest \
meta/conf/distro/include/ptest-packagelists.inc +1 -0
+    glibc-tests-ptest \
 "
 PTESTS_FAST:remove:mips64 = "qemu-ptest"
 PTESTS_PROBLEMS:append:mips64 = "qemu-ptest"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-tests_2.34.bb new file mode 100644 index 0000000000..0a6920eef4

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +14 -0
@@ -0,0 +1,112 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit ptest
+
+SRC_URI:append = " \
+	file://run-ptest \
+"
+
+SUMMARY = "glibc tests to be run with ptest"
+
+# Erase some variables already set by glibc_${PV}
+python __anonymous() {
+       # Remove packages provided by glibc build, we only need a

subset of them

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +90 -0
+       d.setVar("PACKAGES", "${PN} ${PN}-ptest")
+
+       d.setVar("PROVIDES", "${PN} ${PN}-ptest")
+       d.setVar("RPROVIDES", "${PN} ${PN}-ptest")
+
+       d.setVar("RRECOMMENDS", "")
+}
+
+# Remove any lefovers from original glibc recipe
+RPROVIDES:${PN} = "${PN}"
+RRECOMMENDS:${PN} = ""
+RDEPENDS:${PN} = " glibc sed"
+DEPENDS:append = " sed"
+
+# Just build tests for target - do not run them
+do_check:append () {
+	oe_runmake -i check run-built-tests=no
+}
+addtask do_check after do_compile before do_install_ptest_base
+
+glibc_strip_build_directory () {
+	# Delete all non executable files from build directory
+	find ${B} ! -executable -type f -delete
+
+	# Remove build dynamic libraries and links to them as
+	# those are already installed in the target device
+	find ${B} -type f -name "*.so" -delete
+	find ${B} -type l -name "*.so*" -delete
+
+	# Remove headers (installed with glibc)
+	find ${B} -type f -name "*.h" -delete
+
+	find ${B} -type f -name "isomac" -delete
+	find ${B} -type f -name "annexc" -delete
+}
+
+do_install_ptest_base () {
+	glibc_strip_build_directory
+
+	ls -r ${B}/*/*-time64 > ${B}/tst_time64
+
+	# Remove '-time64' suffix - those tests are also time related
+	sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp
+	tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64)
+
+	rm ${B}/tst_time_tmp ${B}/tst_time64
+	echo "${tst_time}"
+
+	# Install build test programs to the image
+	install -d ${D}${PTEST_PATH}/tests/glibc-ptest/
+
+	for f in "${tst_time}"
+	do
+	    cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/
+	done
+
+	install -d ${D}${PTEST_PATH}
+	cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/
+
+}
+
+# The datadir directory is required to allow core (and reused)
+# glibc cleanup function to finish correctly, as this directory
+# is not created for ptests
+stash_locale_package_cleanup:prepend () {
+	mkdir -p ${PKGD}${datadir}
+}
+
+stash_locale_sysroot_cleanup:prepend () {
+	mkdir -p ${SYSROOT_DESTDIR}${datadir}
+}
+
+# Prevent the do_package() task to set 'libc6' prefix
+# for glibc tests related packages
+python populate_packages:prepend () {
+    if d.getVar('DEBIAN_NAMES'):
+        d.setVar('DEBIAN_NAMES', '')
+}
+
+FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/glibc-tests/*"
+
+EXCLUDE_FROM_SHLIBS = "1"
+
+# Install debug data in .debug and sources in /usr/src/debug
+# It is more handy to have _all_ the sources and symbols in one
+# place (package) as this recipe will be used for validation and
+# debugging.
+PACKAGE_DEBUG_SPLIT_STYLE = "debug"
+
+# glibc test cases violate by default some Yocto/OE checks

(staticdev, +# textrel)

meta/recipes-core/glibc/glibc-tests_2.34.bb new file +7 -0
+# 'debug-files' - add everything (including debug) into one package
+#                 (no need to install/build *-src package)
+INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths"
+
+deltask do_stash_locale
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc/run-ptest new file mode 100755 index 0000000000..f637986105

meta/recipes-core/glibc/glibc/run-ptest new file +27 -0
@@ -0,0 +1,37 @@
+#!/bin/sh
+# ptest script for glibc - to run time related tests to
+# facilitate Y2038 validation
+# Run with 'ptest-runner glibc-tests'
+
+output() {
+  retcode=$?
+  if [ $retcode -eq 0 ]
+    then echo "PASS: $i"
+  elif [ $retcode -eq 77 ]
+    then echo "SKIP: $i"
+  else echo "FAIL: $i"
+  fi
+}
+
+# Allow altering time on the target
+export GLIBC_TEST_ALLOW_TIME_SETTING="1"
+
+tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64)
+
+# Remove '-time64' suffix - those tests are also time
+# related
+tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64})
+
+# Run tests supporting only 32 bit time
+for i in ${tst_time_tmp}
+do

meta/recipes-core/glibc/glibc/run-ptest line 37

Quoted 10 lines
meta/recipes-core/glibc/glibc/run-ptest new file +10 -0
+	$i >/dev/null 2>&1
+	output
+done
+
+# Run tests supporting only 64 bit time
+for i in ${tst_time64}
+do
+	$i >/dev/null 2>&1
+	output
+done

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#6 lore raw
Quoted 20 lines · Lukasz Majewski

Dear Community,

Quoted 18 lines

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.

Quoted 7 lines
Quoted 5 lines

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.

Gentle ping on this patch ...

There is a reply from Alexandre on the 29th which says:

"""
There is a remaining issue:

WARNING: Nothing RPROVIDES 'nativesdk-ptest-runner' (but virtual:nativesdk:/home/pokybuild/yocto-worker/build-appliance/build/meta/recipes-core/glibc/glibc-tests_2.34.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'nativesdk-ptest-runner' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['nativesdk-ptest-runner']
"""

Cheers,

Richard