[Y2038] Question about porting y2038-tests to glibc

Lukasz Majewski lukma@denx.de
Wed Oct 28 10:01:56 GMT 2020


Dear Community,

I'm going to port a set of Y2038 tests [1] into the glibc test suite.

The operation of porting the code to handle eligible syscalls (like
clock_settime, etc.) seems to be straightforward.

However, one issue is a bit problematic - namely the adjusting of time
when tests run. It would be best to run tests with "current" (i.e. time
not after 03:14:07 UTC 19 January 2038) and after it (when 32 bit
time_t and friends overflow).

Now, I do use a QEMU ARM BSP built with Yocto [2], so there is no issue
to run date +s and set time manually. Also, the time can be adjusted by
the test itself. As I do run it all on the QEMU the Host system is not
affected in any way.

Hence the question - it would be best to tie Y2038 test with all
eligible 32 bit systems (arm, ppc32, mips, riscv32, etc) and run them
when glibc-build-many.py is executed (as part of its check stage).

Possible ideas (the IMHO best approach first):

1. Use of "faketime" [3] to execute test program. This however imposes
the requirement to have it installed (by glibc-build-many as we did with
binutils and compilers). Good news is that there is already a python
wrapper for it [4], so maybe the time can be set for "check" stage.

2. Run tests with QEMU, but this also requires it to be installed and
it may be not easily deployable.

3. Adjust host time in the tests code (via clock_settime/gettime
syscalls). This is IMHO a no-op as we may end up with changed host time
when test/built breaks by any reason.

Or maybe somebody has better idea how to solve this issue?
Thanks in advance for input.

Links:
[1] - https://github.com/lmajewski/y2038-tests/commits/master
[2] - https://github.com/lmajewski/meta-y2038/blob/master/README
[3] - http://manpages.ubuntu.com/manpages/trusty/man1/faketime.1.html
[4] - https://pypi.org/project/faketime/


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: lukma@denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/libc-help/attachments/20201028/db68fe53/attachment.sig>


More information about the Libc-help mailing list