From 7d3649d4f482826654bae64bc00d94417c1b7063 Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Wed, 7 Dec 2022 09:56:46 +0100 Subject: [PATCH] feat: Add the qemu_system_time function This simply accepts a connection to a running QEMU host adn returns the local system time using the date command. Ticket: QA-483 Changelog: None Signed-off-by: Ole Petter --- tests/utils/common/common.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/utils/common/common.py b/tests/utils/common/common.py index 76cacf2..cf1a6ef 100644 --- a/tests/utils/common/common.py +++ b/tests/utils/common/common.py @@ -711,6 +711,14 @@ def cleanup_mender_state(request, connection): put_no_sftp(bootstrap, connection, remote="/data/mender/bootstrap.mender") +def qemu_system_time(connection): + """Returns an integer representing the number of seconds since the epoch on + the QEMU host behind the :connection + + """ + return int(connection.run("date +%s").stdout) + + def bootenv_tools(connection): """Returns a tuple containing the print and set tools of the current bootloader."""