Compare commits
21 Commits
af4aefe170
...
d032fbcf7f
Author | SHA1 | Date |
---|---|---|
Yu Watanabe | d032fbcf7f | |
Daan De Meyer | 0e44a351ea | |
Luca Boccassi | 94eacb9329 | |
Daan De Meyer | f458a60391 | |
Daan De Meyer | ceca7c5005 | |
Daan De Meyer | 4f969b20b0 | |
Daan De Meyer | d6047d9fb5 | |
Daan De Meyer | a2aacbfad5 | |
Daan De Meyer | 6d2fd490cf | |
Daan De Meyer | c859b310ed | |
Daan De Meyer | 51cd3dec2a | |
Daan De Meyer | fdc4706850 | |
Daan De Meyer | 506403f561 | |
Daan De Meyer | 6fd5df6005 | |
Daan De Meyer | a197604af4 | |
Vito Caputo | 4f3df8c1bb | |
白一百 | 8c18851e7e | |
Yu Watanabe | 5b2926d941 | |
Yu Watanabe | ec6a9b2e03 | |
Yu Watanabe | 087e46cc55 | |
Yu Watanabe | 4527f71040 |
|
@ -37,7 +37,7 @@ jobs:
|
|||
VALIDATE_GITHUB_ACTIONS: true
|
||||
|
||||
- name: Check that tabs are not used in Python code
|
||||
run: sh -c '! git grep -P "\\t" -- src/ukify/ukify.py'
|
||||
run: sh -c '! git grep -P "\\t" -- src/ukify/ukify.py test/integration-test-wrapper.py'
|
||||
|
||||
- name: Install ruff and mypy
|
||||
run: |
|
||||
|
@ -47,14 +47,14 @@ jobs:
|
|||
- name: Run mypy
|
||||
run: |
|
||||
python3 -m mypy --version
|
||||
python3 -m mypy src/ukify/ukify.py
|
||||
python3 -m mypy src/ukify/ukify.py test/integration-test-wrapper.py
|
||||
|
||||
- name: Run ruff check
|
||||
run: |
|
||||
ruff --version
|
||||
ruff check src/ukify/ukify.py
|
||||
ruff check src/ukify/ukify.py test/integration-test-wrapper.py
|
||||
|
||||
- name: Run ruff format
|
||||
run: |
|
||||
ruff --version
|
||||
ruff format --check src/ukify/ukify.py
|
||||
ruff format --check src/ukify/ukify.py test/integration-test-wrapper.py
|
||||
|
|
|
@ -105,7 +105,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
- uses: systemd/mkosi@8976a0abb19221e65300222f2d33067970cca0f1
|
||||
- uses: systemd/mkosi@0825cca8084674ec8fa27502134b1bc601f79e0c
|
||||
|
||||
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
||||
# immediately, we remove the files in the background. However, we first move them to a different location
|
||||
|
|
3
NEWS
3
NEWS
|
@ -764,6 +764,9 @@ CHANGES WITH 257 in spe:
|
|||
other cases EnterNamespace= might be an suitable approach to acquire
|
||||
symbolized backtraces.)
|
||||
|
||||
Special thanks to Nick Owens for bringing attention to and testing
|
||||
fixes for issue #34516.
|
||||
|
||||
Contributions from: 12paper, A. Wilcox, Abderrahim Kitouni,
|
||||
Adrian Vovk, Alain Greppin, Allison Karlitskaya, Alyssa Ross,
|
||||
Anders Jonsson, Andika Triwidada, Andres Beltran, Anouk Ceyssens,
|
||||
|
|
|
@ -295,6 +295,10 @@ sensor:modalias:acpi:MXC6655*:dmi:*:svnCHUWIInnovationAndTechnology*:pnHi10X:*
|
|||
sensor:modalias:acpi:KIOX000A*:dmi:*:svnCHUWIInnovationAndTechnology*:pnHi10X:*
|
||||
ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
|
||||
|
||||
# Chuwi Hi10 X1
|
||||
sensor:modalias:acpi:NSA2513*:dmi:*:svnCHUWIInnovationAndTechnology*:pnHi10X1:*
|
||||
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
||||
|
||||
# Chuwi Hi10 Go
|
||||
sensor:modalias:acpi:MXC6655*:dmi:*:svnCHUWIINNOVATIONLIMITED:pnHi10Go:*
|
||||
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0,-1, 0; 0, 0, 1
|
||||
|
|
|
@ -4397,6 +4397,15 @@ ServerAddress=192.168.0.1/24</programlisting>
|
|||
<xi:include href="version-info.xml" xpointer="v244"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>Preference=</varname></term>
|
||||
|
||||
<listitem><para>Specifies the preference of the route option. Takes one of <literal>high</literal>,
|
||||
<literal>medium</literal>, or <literal>low</literal>. Defaults to <literal>medium</literal>.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v258"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
|
10
mkosi.clangd
10
mkosi.clangd
|
@ -1,12 +1,18 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
MKOSI_CONFIG="$(mkosi --json summary | jq -r .Images[-1])"
|
||||
if command -v flatpak-spawn >/dev/null; then
|
||||
SPAWN=(flatpak-spawn --host)
|
||||
else
|
||||
SPAWN=()
|
||||
fi
|
||||
|
||||
MKOSI_CONFIG="$("${SPAWN[@]}" --host mkosi --json summary | jq -r .Images[-1])"
|
||||
DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")"
|
||||
RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")"
|
||||
ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")"
|
||||
|
||||
exec mkosi \
|
||||
exec "${SPAWN[@]}" mkosi \
|
||||
--incremental=strict \
|
||||
--build-sources-ephemeral=no \
|
||||
--format=none \
|
||||
|
|
|
@ -6,10 +6,12 @@ ToolsTreeDistribution=arch
|
|||
[Build]
|
||||
ToolsTreePackages=
|
||||
cryptsetup
|
||||
github-cli
|
||||
libcap
|
||||
libmicrohttpd
|
||||
python-jinja
|
||||
python-pytest
|
||||
ruff
|
||||
shellcheck
|
||||
tpm2-tss
|
||||
util-linux-libs
|
||||
|
|
|
@ -16,3 +16,4 @@ ToolsTreePackages=
|
|||
tpm2-tss-devel
|
||||
python3-jinja2
|
||||
python3-pytest
|
||||
shellcheck
|
||||
|
|
|
@ -6,6 +6,7 @@ ToolsTreeDistribution=|ubuntu
|
|||
|
||||
[Build]
|
||||
ToolsTreePackages=
|
||||
gh
|
||||
libblkid-dev
|
||||
libcap-dev
|
||||
libcryptsetup-dev
|
||||
|
@ -16,3 +17,4 @@ ToolsTreePackages=
|
|||
libtss2-dev
|
||||
python3-jinja2
|
||||
python3-pytest
|
||||
shellcheck
|
||||
|
|
|
@ -5,4 +5,5 @@ ToolsTreeDistribution=fedora
|
|||
|
||||
[Build]
|
||||
ToolsTreePackages=
|
||||
gh
|
||||
ruff
|
||||
|
|
|
@ -5,6 +5,7 @@ ToolsTreeDistribution=opensuse
|
|||
|
||||
[Build]
|
||||
ToolsTreePackages=
|
||||
gh
|
||||
pkgconfig(blkid)
|
||||
pkgconfig(libcap)
|
||||
pkgconfig(libcryptsetup)
|
||||
|
@ -16,3 +17,4 @@ ToolsTreePackages=
|
|||
tss2-devel
|
||||
python3-jinja2
|
||||
python3-pytest
|
||||
ShellCheck
|
||||
|
|
|
@ -13,6 +13,7 @@ Environment=
|
|||
|
||||
[Content]
|
||||
Packages=
|
||||
clang-devel
|
||||
compiler-rt
|
||||
gdb
|
||||
git-core
|
||||
|
|
|
@ -15,6 +15,7 @@ Environment=
|
|||
[Content]
|
||||
Packages=
|
||||
apt
|
||||
clangd
|
||||
erofs-utils
|
||||
git-core
|
||||
libclang-rt-dev
|
||||
|
|
|
@ -12,6 +12,7 @@ Environment=
|
|||
|
||||
[Content]
|
||||
Packages=
|
||||
clang
|
||||
diffutils
|
||||
erofs-utils
|
||||
gcc-c++
|
||||
|
|
|
@ -57,6 +57,8 @@ wrap=(
|
|||
delv
|
||||
dhcpd
|
||||
dig
|
||||
dnf
|
||||
dnf5
|
||||
dmsetup
|
||||
dnsmasq
|
||||
findmnt
|
||||
|
@ -93,7 +95,7 @@ wrap=(
|
|||
)
|
||||
|
||||
for bin in "${wrap[@]}"; do
|
||||
if ! mkosi-chroot command -v "$bin" >/dev/null; then
|
||||
if ! mkosi-chroot bash -c "command -v $bin" >/dev/null; then
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -103,7 +105,7 @@ for bin in "${wrap[@]}"; do
|
|||
enable_lsan=0
|
||||
fi
|
||||
|
||||
target="$(mkosi-chroot command -v "$bin")"
|
||||
target="$(mkosi-chroot bash -c "command -v $bin")"
|
||||
|
||||
mv "$BUILDROOT/$target" "$BUILDROOT/$target.orig"
|
||||
|
||||
|
|
|
@ -75,6 +75,10 @@ static int curl_glue_socket_callback(CURL *curl, curl_socket_t s, int action, vo
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Don't configure io event source anymore when the event loop is dead already. */
|
||||
if (g->event && sd_event_get_state(g->event) == SD_EVENT_FINISHED)
|
||||
return 0;
|
||||
|
||||
r = hashmap_ensure_allocated(&g->ios, &trivial_hash_ops);
|
||||
if (r < 0) {
|
||||
log_oom();
|
||||
|
|
|
@ -406,7 +406,7 @@ IPv6SendRA.ReachableTimeSec, config_parse_router_uint32_msec_use
|
|||
IPv6SendRA.RetransmitSec, config_parse_router_uint32_msec_usec, 0, offsetof(Network, router_retransmit_usec)
|
||||
IPv6SendRA.Managed, config_parse_bool, 0, offsetof(Network, router_managed)
|
||||
IPv6SendRA.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information)
|
||||
IPv6SendRA.RouterPreference, config_parse_router_preference, 0, 0
|
||||
IPv6SendRA.RouterPreference, config_parse_router_preference, 0, offsetof(Network, router_preference)
|
||||
IPv6SendRA.HopLimit, config_parse_uint8, 0, offsetof(Network, router_hop_limit)
|
||||
IPv6SendRA.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns)
|
||||
IPv6SendRA.DNS, config_parse_radv_dns, 0, 0
|
||||
|
@ -427,6 +427,7 @@ IPv6Prefix.RouteMetric, config_parse_prefix_metric,
|
|||
IPv6Prefix.Token, config_parse_prefix_token, 0, 0
|
||||
IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0
|
||||
IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0
|
||||
IPv6RoutePrefix.Preference, config_parse_route_prefix_preference, 0, 0
|
||||
IPv6PREF64Prefix.Prefix, config_parse_pref64_prefix, 0, 0
|
||||
IPv6PREF64Prefix.LifetimeSec, config_parse_pref64_prefix_lifetime, 0, 0
|
||||
LLDP.MUDURL, config_parse_mud_url, 0, offsetof(Network, lldp_mudurl)
|
||||
|
|
|
@ -1134,6 +1134,37 @@ int config_parse_route_prefix_lifetime(
|
|||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_route_prefix_preference(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(route_prefix_free_or_set_invalidp) RoutePrefix *p = NULL;
|
||||
Network *network = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
|
||||
r = route_prefix_new_static(network, filename, section_line, &p);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
r = config_parse_router_preference(unit, filename, line, section, section_line,
|
||||
lvalue, ltype, rvalue, &p->route.preference, NULL);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
TAKE_PTR(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_pref64_prefix(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
|
@ -1511,25 +1542,18 @@ int config_parse_router_preference(
|
|||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Network *network = userdata;
|
||||
uint8_t *preference = ASSERT_PTR(data);
|
||||
|
||||
assert(filename);
|
||||
assert(section);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (streq(rvalue, "high"))
|
||||
network->router_preference = SD_NDISC_PREFERENCE_HIGH;
|
||||
else if (STR_IN_SET(rvalue, "medium", "normal", "default"))
|
||||
network->router_preference = SD_NDISC_PREFERENCE_MEDIUM;
|
||||
if (isempty(rvalue) || STR_IN_SET(rvalue, "medium", "normal", "default"))
|
||||
*preference = SD_NDISC_PREFERENCE_MEDIUM;
|
||||
else if (streq(rvalue, "high"))
|
||||
*preference = SD_NDISC_PREFERENCE_HIGH;
|
||||
else if (streq(rvalue, "low"))
|
||||
network->router_preference = SD_NDISC_PREFERENCE_LOW;
|
||||
*preference = SD_NDISC_PREFERENCE_LOW;
|
||||
else
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid router preference, ignoring assignment: %s", rvalue);
|
||||
return log_syntax_parse_error(unit, filename, line, 0, lvalue, rvalue);
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int config_parse_router_home_agent_lifetime(
|
||||
|
|
|
@ -86,6 +86,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
|
|||
CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_lifetime);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_preference);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix_lifetime);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_router_home_agent_lifetime);
|
||||
|
|
|
@ -467,7 +467,7 @@ class SignTool:
|
|||
raise NotImplementedError()
|
||||
|
||||
@staticmethod
|
||||
def from_string(name) -> type['SignTool']:
|
||||
def from_string(name: str) -> type['SignTool']:
|
||||
if name == 'pesign':
|
||||
return PeSign
|
||||
elif name == 'sbsign':
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
'''Test wrapper command for driving integration tests.
|
||||
'''
|
||||
"""Test wrapper command for driving integration tests."""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
|
@ -13,7 +12,6 @@ import sys
|
|||
import textwrap
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
EMERGENCY_EXIT_DROPIN = """\
|
||||
[Unit]
|
||||
Wants=emergency-exit.service
|
||||
|
@ -34,7 +32,7 @@ ExecStart=false
|
|||
"""
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--mkosi', required=True)
|
||||
parser.add_argument('--meson-source-dir', required=True, type=Path)
|
||||
|
@ -46,34 +44,43 @@ def main():
|
|||
parser.add_argument('--slow', action=argparse.BooleanOptionalAction)
|
||||
parser.add_argument('--vm', action=argparse.BooleanOptionalAction)
|
||||
parser.add_argument('--exit-code', required=True, type=int)
|
||||
parser.add_argument('mkosi_args', nargs="*")
|
||||
parser.add_argument('mkosi_args', nargs='*')
|
||||
args = parser.parse_args()
|
||||
|
||||
if not bool(int(os.getenv("SYSTEMD_INTEGRATION_TESTS", "0"))):
|
||||
print(f"SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping {args.name}", file=sys.stderr)
|
||||
if not bool(int(os.getenv('SYSTEMD_INTEGRATION_TESTS', '0'))):
|
||||
print(
|
||||
f'SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping {args.name}',
|
||||
file=sys.stderr,
|
||||
)
|
||||
exit(77)
|
||||
|
||||
if args.slow and not bool(int(os.getenv("SYSTEMD_SLOW_TESTS", "0"))):
|
||||
print(f"SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.name}", file=sys.stderr)
|
||||
if args.slow and not bool(int(os.getenv('SYSTEMD_SLOW_TESTS', '0'))):
|
||||
print(
|
||||
f'SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.name}',
|
||||
file=sys.stderr,
|
||||
)
|
||||
exit(77)
|
||||
|
||||
if args.vm and bool(int(os.getenv("TEST_NO_QEMU", "0"))):
|
||||
print(f"TEST_NO_QEMU=1, skipping {args.name}", file=sys.stderr)
|
||||
if args.vm and bool(int(os.getenv('TEST_NO_QEMU', '0'))):
|
||||
print(f'TEST_NO_QEMU=1, skipping {args.name}', file=sys.stderr)
|
||||
exit(77)
|
||||
|
||||
for s in os.getenv("TEST_SKIP", "").split():
|
||||
for s in os.getenv('TEST_SKIP', '').split():
|
||||
if s in args.name:
|
||||
print(f"Skipping {args.name} due to TEST_SKIP", file=sys.stderr)
|
||||
print(f'Skipping {args.name} due to TEST_SKIP', file=sys.stderr)
|
||||
exit(77)
|
||||
|
||||
keep_journal = os.getenv("TEST_SAVE_JOURNAL", "fail")
|
||||
shell = bool(int(os.getenv("TEST_SHELL", "0")))
|
||||
keep_journal = os.getenv('TEST_SAVE_JOURNAL', 'fail')
|
||||
shell = bool(int(os.getenv('TEST_SHELL', '0')))
|
||||
|
||||
if shell and not sys.stderr.isatty():
|
||||
print(f"--interactive must be passed to meson test to use TEST_SHELL=1", file=sys.stderr)
|
||||
print(
|
||||
'--interactive must be passed to meson test to use TEST_SHELL=1',
|
||||
file=sys.stderr,
|
||||
)
|
||||
exit(1)
|
||||
|
||||
name = args.name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "")
|
||||
name = args.name + (f'-{i}' if (i := os.getenv('MESON_TEST_ITERATION')) else '')
|
||||
|
||||
dropin = textwrap.dedent(
|
||||
"""\
|
||||
|
@ -84,14 +91,14 @@ def main():
|
|||
|
||||
if not shell:
|
||||
dropin += textwrap.dedent(
|
||||
f"""
|
||||
"""
|
||||
[Unit]
|
||||
SuccessAction=exit
|
||||
SuccessActionExitStatus=123
|
||||
"""
|
||||
)
|
||||
|
||||
if os.getenv("TEST_MATCH_SUBTEST"):
|
||||
if os.getenv('TEST_MATCH_SUBTEST'):
|
||||
dropin += textwrap.dedent(
|
||||
f"""
|
||||
[Service]
|
||||
|
@ -99,7 +106,7 @@ def main():
|
|||
"""
|
||||
)
|
||||
|
||||
if os.getenv("TEST_MATCH_TESTCASE"):
|
||||
if os.getenv('TEST_MATCH_TESTCASE'):
|
||||
dropin += textwrap.dedent(
|
||||
f"""
|
||||
[Service]
|
||||
|
@ -116,7 +123,7 @@ def main():
|
|||
"""
|
||||
)
|
||||
|
||||
journal_file = (args.meson_build_dir / (f"test/journal/{name}.journal")).absolute()
|
||||
journal_file = (args.meson_build_dir / (f'test/journal/{name}.journal')).absolute()
|
||||
journal_file.unlink(missing_ok=True)
|
||||
elif not shell:
|
||||
dropin += textwrap.dedent(
|
||||
|
@ -136,54 +143,60 @@ def main():
|
|||
*(['--forward-journal', journal_file] if journal_file else []),
|
||||
*(
|
||||
[
|
||||
'--credential',
|
||||
f"systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}",
|
||||
'--credential',
|
||||
f"systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}",
|
||||
'--credential', f'systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}', # noqa: E501
|
||||
'--credential', f'systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}',
|
||||
]
|
||||
if not sys.stderr.isatty()
|
||||
else []
|
||||
),
|
||||
'--credential',
|
||||
f"systemd.unit-dropin.{args.unit}={shlex.quote(dropin)}",
|
||||
'--credential', f'systemd.unit-dropin.{args.unit}={shlex.quote(dropin)}',
|
||||
'--runtime-network=none',
|
||||
'--runtime-scratch=no',
|
||||
*args.mkosi_args,
|
||||
'--qemu-firmware', args.firmware,
|
||||
*(['--qemu-kvm', 'no'] if int(os.getenv("TEST_NO_KVM", "0")) else []),
|
||||
'--qemu-firmware',
|
||||
args.firmware,
|
||||
*(['--qemu-kvm', 'no'] if int(os.getenv('TEST_NO_KVM', '0')) else []),
|
||||
'--kernel-command-line-extra',
|
||||
' '.join([
|
||||
'systemd.hostname=H',
|
||||
f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/{args.name}.units:/usr/lib/systemd/tests/testdata/units:",
|
||||
*([f"systemd.unit={args.unit}"] if not shell else []),
|
||||
'systemd.mask=systemd-networkd-wait-online.service',
|
||||
*(
|
||||
[
|
||||
"systemd.mask=serial-getty@.service",
|
||||
"systemd.show_status=error",
|
||||
"systemd.crash_shell=0",
|
||||
"systemd.crash_action=poweroff",
|
||||
]
|
||||
if not sys.stderr.isatty()
|
||||
else []
|
||||
),
|
||||
]),
|
||||
' '.join(
|
||||
[
|
||||
'systemd.hostname=H',
|
||||
f'SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/{args.name}.units:/usr/lib/systemd/tests/testdata/units:',
|
||||
*([f'systemd.unit={args.unit}'] if not shell else []),
|
||||
'systemd.mask=systemd-networkd-wait-online.service',
|
||||
*(
|
||||
[
|
||||
'systemd.mask=serial-getty@.service',
|
||||
'systemd.show_status=error',
|
||||
'systemd.crash_shell=0',
|
||||
'systemd.crash_action=poweroff',
|
||||
]
|
||||
if not sys.stderr.isatty()
|
||||
else []
|
||||
),
|
||||
]
|
||||
),
|
||||
'--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else args.storage}",
|
||||
*(['--runtime-build-sources=no'] if not sys.stderr.isatty() else []),
|
||||
'qemu' if args.vm or os.getuid() != 0 else 'boot',
|
||||
]
|
||||
] # fmt: skip
|
||||
|
||||
result = subprocess.run(cmd)
|
||||
|
||||
# On Debian/Ubuntu we get a lot of random QEMU crashes. Retry once, and then skip if it fails again.
|
||||
if args.vm and result.returncode == 247 and args.exit_code != 247:
|
||||
journal_file.unlink(missing_ok=True)
|
||||
if journal_file:
|
||||
journal_file.unlink(missing_ok=True)
|
||||
result = subprocess.run(cmd)
|
||||
if args.vm and result.returncode == 247 and args.exit_code != 247:
|
||||
print(f"Test {args.name} failed due to QEMU crash (error 247), ignoring", file=sys.stderr)
|
||||
print(
|
||||
f'Test {args.name} failed due to QEMU crash (error 247), ignoring',
|
||||
file=sys.stderr,
|
||||
)
|
||||
exit(77)
|
||||
|
||||
if journal_file and (keep_journal == "0" or (result.returncode in (args.exit_code, 77) and keep_journal == "fail")):
|
||||
if journal_file and (
|
||||
keep_journal == '0' or (result.returncode in (args.exit_code, 77) and keep_journal == 'fail')
|
||||
):
|
||||
journal_file.unlink(missing_ok=True)
|
||||
|
||||
if shell or result.returncode in (args.exit_code, 77):
|
||||
|
@ -192,31 +205,33 @@ def main():
|
|||
if journal_file:
|
||||
ops = []
|
||||
|
||||
if os.getenv("GITHUB_ACTIONS"):
|
||||
id = os.environ["GITHUB_RUN_ID"]
|
||||
iteration = os.environ["GITHUB_RUN_ATTEMPT"]
|
||||
if os.getenv('GITHUB_ACTIONS'):
|
||||
id = os.environ['GITHUB_RUN_ID']
|
||||
iteration = os.environ['GITHUB_RUN_ATTEMPT']
|
||||
j = json.loads(
|
||||
subprocess.run(
|
||||
[
|
||||
args.mkosi,
|
||||
"--directory", os.fspath(args.meson_source_dir),
|
||||
"--json",
|
||||
"summary",
|
||||
'--directory', os.fspath(args.meson_source_dir),
|
||||
'--json',
|
||||
'summary',
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
).stdout
|
||||
)
|
||||
distribution = j["Images"][-1]["Distribution"]
|
||||
release = j["Images"][-1]["Release"]
|
||||
artifact = f"ci-mkosi-{id}-{iteration}-{distribution}-{release}-failed-test-journals"
|
||||
ops += [f"gh run download {id} --name {artifact} -D ci/{artifact}"]
|
||||
journal_file = Path(f"ci/{artifact}/test/journal/{name}.journal")
|
||||
) # fmt: skip
|
||||
distribution = j['Images'][-1]['Distribution']
|
||||
release = j['Images'][-1]['Release']
|
||||
artifact = f'ci-mkosi-{id}-{iteration}-{distribution}-{release}-failed-test-journals'
|
||||
ops += [f'gh run download {id} --name {artifact} -D ci/{artifact}']
|
||||
journal_file = Path(f'ci/{artifact}/test/journal/{name}.journal')
|
||||
|
||||
ops += [f"journalctl --file {journal_file} --no-hostname -o short-monotonic -u {args.unit} -p info"]
|
||||
ops += [f'journalctl --file {journal_file} --no-hostname -o short-monotonic -u {args.unit} -p info']
|
||||
|
||||
print("Test failed, relevant logs can be viewed with: \n\n"
|
||||
f"{(' && '.join(ops))}\n", file=sys.stderr)
|
||||
print(
|
||||
"Test failed, relevant logs can be viewed with: \n\n" f"{(' && '.join(ops))}\n",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
# 0 also means we failed so translate that to a non-zero exit code to mark the test as failed.
|
||||
exit(result.returncode or 1)
|
||||
|
|
|
@ -6472,6 +6472,22 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
|||
networkctl_reload()
|
||||
self.check_router_preference('01', 100, 'high', 300, 'low')
|
||||
|
||||
# Use route options with preference to configure default routes.
|
||||
with open(os.path.join(network_unit_dir, '25-veth-router-high.network'), mode='a', encoding='utf-8') as f:
|
||||
f.write('LifetimeSec=1200\nPreference=low\n')
|
||||
with open(os.path.join(network_unit_dir, '25-veth-router-low.network'), mode='a', encoding='utf-8') as f:
|
||||
f.write('LifetimeSec=1200\nPreference=high\n')
|
||||
networkctl_reload()
|
||||
self.check_router_preference('01', 300, 'low', 100, 'high')
|
||||
|
||||
# Set zero lifetime again to the route options.
|
||||
with open(os.path.join(network_unit_dir, '25-veth-router-high.network'), mode='a', encoding='utf-8') as f:
|
||||
f.write('LifetimeSec=0\n')
|
||||
with open(os.path.join(network_unit_dir, '25-veth-router-low.network'), mode='a', encoding='utf-8') as f:
|
||||
f.write('LifetimeSec=0\n')
|
||||
networkctl_reload()
|
||||
self.check_router_preference('01', 100, 'high', 300, 'low')
|
||||
|
||||
def _test_ndisc_vs_static_route(self, manage_foreign_nexthops):
|
||||
if not manage_foreign_nexthops:
|
||||
copy_networkd_conf_dropin('networkd-manage-foreign-nexthops-no.conf')
|
||||
|
|
Loading…
Reference in New Issue