Skip to content

Commit

Permalink
Merge pull request systemd#31445 from keszybz/slow-tests
Browse files Browse the repository at this point in the history
Mark more tests as slow
  • Loading branch information
bluca authored Feb 22, 2024
2 parents 909c4f8 + 37eba4b commit c0b5b74
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test_env = environment()
test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
test_env.set('PATH', project_build_root + ':' + path)
test_env.set('PROJECT_BUILD_ROOT', project_build_root)
test_env.set('SYSTEMD_SLOW_TESTS', slow_tests ? '1' : '0')

if efi_addon != ''
test_env.set('EFI_ADDON', efi_addon)
Expand Down
6 changes: 5 additions & 1 deletion src/test/test-nss-hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,11 @@ static int parse_argv(int argc, char **argv,
} else {
_cleanup_free_ char *hostname = NULL;
assert_se(hostname = gethostname_malloc());
assert_se(names = strv_new("localhost", "_gateway", "_outbound", "foo_no_such_host", hostname));
assert_se(names = strv_new("localhost",
"_gateway",
"_outbound",
hostname,
slow_tests_enabled() ? "foo_no_such_host" : NULL));

n = make_addresses(&addrs);
assert_se(n >= 0);
Expand Down
23 changes: 19 additions & 4 deletions src/ukify/test/test_ukify.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
import ukify

build_root = os.getenv('PROJECT_BUILD_ROOT')
try:
slow_tests = bool(int(os.getenv('SYSTEMD_SLOW_TESTS', '1')))
except ValueError:
slow_tests = True

arg_tools = ['--tools', build_root] if build_root else []

def systemd_measure():
Expand Down Expand Up @@ -531,6 +536,7 @@ def test_uname_scraping(kernel_initrd):
uname = ukify.Uname.scrape(kernel_initrd[1])
assert re.match(r'\d+\.\d+\.\d+', uname)

@pytest.mark.skipif(not slow_tests, reason='slow')
@pytest.mark.parametrize("days", [365*10, None])
def test_efi_signing_sbsign(days, kernel_initrd, tmp_path):
if kernel_initrd is None:
Expand Down Expand Up @@ -576,6 +582,7 @@ def test_efi_signing_sbsign(days, kernel_initrd, tmp_path):

shutil.rmtree(tmp_path)

@pytest.mark.skipif(not slow_tests, reason='slow')
def test_efi_signing_pesign(kernel_initrd, tmp_path):
if kernel_initrd is None:
pytest.skip('linux+initrd not found')
Expand Down Expand Up @@ -635,16 +642,22 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
uname_arg='1.2.3'
osrel_arg='Linux'
cmdline_arg='ARG1 ARG2 ARG3'
opts = ukify.parse_args([

args = [
'build',
*kernel_initrd,
f'--cmdline={cmdline_arg}',
f'--os-release={osrel_arg}',
f'--uname={uname_arg}',
f'--output={output}',
f'--secureboot-certificate={cert.name}',
f'--secureboot-private-key={key.name}',
])
]
if slow_tests:
args += [
f'--secureboot-certificate={cert.name}',
f'--secureboot-private-key={key.name}',
]

opts = ukify.parse_args(args)

ukify.check_inputs(opts)
ukify.make_uki(opts)
Expand All @@ -668,6 +681,7 @@ def test_inspect(kernel_initrd, tmp_path, capsys):

shutil.rmtree(tmp_path)

@pytest.mark.skipif(not slow_tests, reason='slow')
def test_pcr_signing(kernel_initrd, tmp_path):
if kernel_initrd is None:
pytest.skip('linux+initrd not found')
Expand Down Expand Up @@ -734,6 +748,7 @@ def test_pcr_signing(kernel_initrd, tmp_path):

shutil.rmtree(tmp_path)

@pytest.mark.skipif(not slow_tests, reason='slow')
def test_pcr_signing2(kernel_initrd, tmp_path):
if kernel_initrd is None:
pytest.skip('linux+initrd not found')
Expand Down

0 comments on commit c0b5b74

Please sign in to comment.