From: Julien Olivain <ju.o@free.fr>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: buildroot@buildroot.org,
Ricardo Martincoski <ricardo.martincoski@datacom.com.br>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [Buildroot] [PATCH 1/9 v3] support/testing: set date in emulated machine
Date: Fri, 07 Mar 2025 19:49:10 +0100 [thread overview]
Message-ID: <8fb79f2dfe7c9cedca2e2e854e4b3c48@free.fr> (raw)
In-Reply-To: <745bdcacbdff342d7e37dd1003a03923dc03b935.1740841539.git.yann.morin.1998@free.fr>
Hi Yann, all,
On 01/03/2025 16:05, Yann E. MORIN wrote:
> When time comes to check certificates, the date and time in the
> emulated
> machine should be close enough to the actual values, so that
> certificate
> validity can be checked.
>
> Set the date to the date of the system. This is going to be accurate to
> the second, which is, by far, enough for our purpose.
>
> The Emulator() class doesn't inherit from unittest.TestCase, so we
> can't
> call any of the usual self.assertXXX() methods; instead, we just raise
> a standard exception, like is done a few lines above to detect the
> login
> prompt.
>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>
> ---
> Changes v1 -> v2:
> - catch failure to set the date
> ---
> support/testing/infra/emulator.py | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/support/testing/infra/emulator.py
> b/support/testing/infra/emulator.py
> index ef5be2a19e..9be1143944 100644
> --- a/support/testing/infra/emulator.py
> +++ b/support/testing/infra/emulator.py
> @@ -5,6 +5,7 @@ import os
>
> import pexpect
> import pexpect.replwrap
> +import time
>
> import infra
>
> @@ -152,6 +153,10 @@ class Emulator(object):
>
> self.connect_shell()
>
> + output, exit_code = self.run(f"date @{int(time.time())}")
> + if exit_code:
> + raise SystemError("Cannot set date in virtual machine")
> +
Is this really needed?
Arm and Aarch64 qemu machines includes a pl031 RTC.
x86/x86_64 includes a mc146818 RTC.
RISC-V has a Goldfish RTC.
If we revert this patch, the podman runtime test still succeed.
In the runtime log "TestPodman-run.log", when the kernel boots,
we see:
...
rtc-pl031 10017000.rtc: registered as rtc0
rtc-pl031 10017000.rtc: setting system clock to 2025-03-07T17:38:24 UTC
(1741369104)
...
I understand that it is not always guaranteed that the qemu machine
has a rtc and the used kernel has a driver for it, which is why we
would like to set the date like this. But this could be left to the
test implementer to make sure this is properly handled. And in the
podman test case, you did.
What do you think?
Best regards,
Julien.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2025-03-07 18:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-01 15:05 [Buildroot] [PATCH 0/9 v3] package/podman: new package (branch yem/podman) Yann E. MORIN
2025-03-01 15:05 ` [Buildroot] [PATCH 1/9 v3] support/testing: set date in emulated machine Yann E. MORIN
2025-03-07 18:49 ` Julien Olivain [this message]
2025-03-08 11:07 ` Yann E. MORIN
2025-03-08 21:51 ` Julien Olivain
2025-03-01 15:05 ` [Buildroot] [PATCH 2/9 v3] package/shadow: install to staging for subids Yann E. MORIN
2025-03-07 13:15 ` Raphael Pavlidis
2025-03-01 15:05 ` [Buildroot] [PATCH 3/9 v3] package/conmon: depends on systemd when enabled Yann E. MORIN
2025-03-01 15:05 ` [Buildroot] [PATCH 4/9 v3] package/slirp4netns: needs TUN support in the kernel Yann E. MORIN
2025-03-07 13:20 ` Raphael Pavlidis
2025-03-01 15:05 ` [Buildroot] [PATCH 5/9 v3] package/skopeo: add target variant Yann E. MORIN
2025-03-01 15:05 ` [Buildroot] [PATCH 6/9 v3] package/cgroupfs-mount: tweak the kernel config Yann E. MORIN
2025-03-01 15:05 ` [Buildroot] [PATCH 7/9 v3] package/cgroupfs-v2-mount: new package Yann E. MORIN
2025-03-01 15:05 ` [Buildroot] [PATCH 8/9 v3] package/netavark: " Yann E. MORIN
2025-03-01 15:05 ` [Buildroot] [PATCH 9/9 v3] package/podman: " Yann E. MORIN
2025-03-07 13:40 ` Raphael Pavlidis
2025-03-07 19:38 ` Christian Stewart via buildroot
2025-03-08 11:02 ` Yann E. MORIN
2025-03-08 11:00 ` Yann E. MORIN
2025-03-09 8:30 ` Yann E. MORIN
2025-03-09 22:14 ` Yann E. MORIN
2025-03-07 18:55 ` Julien Olivain
2025-03-08 11:34 ` Yann E. MORIN
2025-03-08 22:03 ` Julien Olivain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8fb79f2dfe7c9cedca2e2e854e4b3c48@free.fr \
--to=ju.o@free.fr \
--cc=buildroot@buildroot.org \
--cc=ricardo.martincoski@datacom.com.br \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin.1998@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.