mirror of
https://github.com/systemd/systemd.git
synced 2025-03-11 20:58:27 +03:00
TEST-53-ISSUE-16347: Implement rtc via custom argument
Let's get rid of the configure script for this use case by just implementing the necessary logic in integration-test-wrapper.py. We need to get rid of our usage of configure scripts to allow enabling the History= setting.
This commit is contained in:
parent
4b8edc68f9
commit
2db2cb3034
@ -3,9 +3,7 @@
|
||||
integration_tests += [
|
||||
integration_test_template + {
|
||||
'name' : fs.name(meson.current_source_dir()),
|
||||
'mkosi-args' : integration_test_template['mkosi-args'] + [
|
||||
'--configure-script', meson.current_source_dir() / 'mkosi.configure',
|
||||
],
|
||||
'rtc' : true,
|
||||
'vm' : true,
|
||||
},
|
||||
]
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -e
|
||||
|
||||
RTC="$(date -u +%Y-%m-%dT%H:%M:%S -d "+3 days")"
|
||||
jq ".QemuArgs += [\"-rtc\", \"base=$RTC\"]"
|
@ -6,6 +6,7 @@
|
||||
import argparse
|
||||
import base64
|
||||
import dataclasses
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@ -363,6 +364,7 @@ def main() -> None:
|
||||
parser.add_argument('--exit-code', required=True, type=int)
|
||||
parser.add_argument('--coredump-exclude-regex', required=True)
|
||||
parser.add_argument('--sanitizer-exclude-regex', required=True)
|
||||
parser.add_argument('--rtc', action=argparse.BooleanOptionalAction)
|
||||
parser.add_argument('mkosi_args', nargs='*')
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -466,6 +468,16 @@ def main() -> None:
|
||||
"""
|
||||
)
|
||||
|
||||
if args.rtc:
|
||||
if sys.version_info >= (3, 12):
|
||||
now = datetime.datetime.now(datetime.UTC)
|
||||
else:
|
||||
now = datetime.datetime.utcnow()
|
||||
|
||||
rtc = datetime.datetime.strftime(now, r'%Y-%m-%dT%H:%M:%S')
|
||||
else:
|
||||
rtc = None
|
||||
|
||||
cmd = [
|
||||
args.mkosi,
|
||||
'--directory', os.fspath(args.meson_source_dir),
|
||||
@ -485,6 +497,7 @@ def main() -> None:
|
||||
'--credential', f'systemd.unit-dropin.{args.unit}={shlex.quote(dropin)}',
|
||||
'--runtime-network=none',
|
||||
'--runtime-scratch=no',
|
||||
*([f'--qemu-args=-rtc base={rtc}'] if rtc else []),
|
||||
*args.mkosi_args,
|
||||
'--firmware', args.firmware,
|
||||
*(['--kvm', 'no'] if int(os.getenv('TEST_NO_KVM', '0')) else []),
|
||||
|
@ -299,6 +299,7 @@ integration_test_template = {
|
||||
'vm' : false,
|
||||
'coredump-exclude-regex' : '',
|
||||
'sanitizer-exclude-regex' : '',
|
||||
'rtc' : false,
|
||||
}
|
||||
testdata_subdirs = [
|
||||
'auxv',
|
||||
@ -417,6 +418,10 @@ foreach integration_test : integration_tests
|
||||
integration_test_args += ['--vm']
|
||||
endif
|
||||
|
||||
if integration_test['rtc']
|
||||
integration_test_args += ['--rtc']
|
||||
endif
|
||||
|
||||
if not mkosi.found()
|
||||
continue
|
||||
endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user