mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 16:01:54 -09:00
support/testing: test_timezone: fix test by setting a fixed time
Since Buildroot commit [1], the runtime test emulator infra is setting the emulated system date to the host date. While this is desired in general, this behaviour is introducing a variability in the test execution. Depending if the test is executed during winter or summer time, the output of the command "date +%Z" will produce a different output. This commit fixes the issue by setting a fixed date and time on the emulated system. The date is fixed to Unix Epoch plus one hour. This is because Linux cannot set the system date to a value less than the system uptime. So we cannot set the time back to Unix Epoch with the command "date -s @0" (this would result to a EINVAL Invalid argument). Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/9922589073 https://gitlab.com/buildroot.org/buildroot/-/jobs/9922589081 [1]cf8641b73eSigned-off-by: Julien Olivain <ju.o@free.fr> (cherry picked from commit0839545a9b) Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
33e6f2e395
commit
9a67997454
@@ -9,6 +9,24 @@ def boot_armv5_cpio(emulator, builddir):
|
||||
options=["-initrd", img])
|
||||
emulator.login()
|
||||
|
||||
# emulator.login() sets the emulated system date to the host
|
||||
# date. In general, this is desirable (for correct SSL certificate
|
||||
# behaviors, for example).
|
||||
#
|
||||
# This timezone runtime test checks that a Buildroot configuration
|
||||
# is reflected in the generated system at runtime, using the
|
||||
# standard "date" command. To make sure this test is stable in
|
||||
# time (i.e. output is independent to the date/time the test is
|
||||
# executed due to daylight saving time changes), we reset the
|
||||
# system date to a constant value.
|
||||
#
|
||||
# We cannot set the system date to a value less than the system
|
||||
# uptime. So we cannot set the time back to Unix Epoch with the
|
||||
# command "date -s @0" (this would result to a EINVAL Invalid
|
||||
# argument). Instead, we set the time at 1 hour after Epoch. This
|
||||
# is sufficient as the emulated system takes few seconds to start.
|
||||
emulator.run("date -s @3600")
|
||||
|
||||
|
||||
class TestNoTimezone(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
|
||||
Reference in New Issue
Block a user