Mbed-TLS / mbedtls

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
https://www.trustedfirmware.org/projects/mbed-tls/
Other
5.54k stars 2.6k forks source link

Testsuite depends on system time #847

Open jcowgill opened 7 years ago

jcowgill commented 7 years ago

Niels Thykier pointed out that the mbedTLS testsuite is "timebombed" - ie: that it will suddenly fail in the future. See: https://bugs.debian.org/857579#10 This is a problem for Debian because I run the testsuite at build time and the package is expected to build all though the life of a release (usually about 5 years in the case of Debian LTS releases).

This can be tested using the "faketime" program. Setting the date to 3 years in the future causes a number of tests to fail, all of them in the x509parse suite:

$ CTEST_OUTPUT_ON_FAILURE=1 faketime -f '+3y' ctest -R x509parse-suite
[...]
FAILED (405 / 431 tests (63 skipped))

Setting the date 10 years into the future causes more tests to fail:

$ CTEST_OUTPUT_ON_FAILURE=1 faketime -f '+10y' ctest -R x509parse-suite
[...]
FAILED (322 / 431 tests (63 skipped))

Ideally the testsuite should not depend on the system time at all.

simonbutcher commented 7 years ago

It should be a simple change to add an override to the date/time using existing API's to 'fix' the date/time purely for testing.

As such, I'm marking this as an enhancement request, and we'll try and add this to the tests at some point.

As ever, thanks for the feedback.

ciarmcom commented 7 years ago

ARM Internal Ref: IOTSSL-1276