test: wait for userspace mount options applied (#38327)

Hopefully fixes #32712.
This commit is contained in:
Luca Boccassi
2025-07-25 10:57:13 +01:00
committed by GitHub
6 changed files with 193 additions and 153 deletions
+4
View File
@@ -133,6 +133,10 @@ that make use of `run_testcases`.
`TEST_SKIP_TESTCASE=testcase`: takes a space separated list of testcases to skip.
`TEST_SAVE_JOURNAL=0|1|fail`: When `0`, journal file will be removed on exit.
When `1`, journal file will be saved at `$BUILD_DIR/test/journal`. When `fail`,
journal file will be saved only when the test is failed. Defaults to `fail`.
`TEST_JOURNAL_USE_TMP=1`: Write test journal to `/tmp` while the test is in
progress and only move the journal to its final location in the build directory
(`$BUILD_DIR/test/journal`) when the test is finished.
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
},
]
@@ -660,7 +660,12 @@ def main() -> None:
journal_file = Path(shutil.move(journal_file, dst))
if shell or (result.returncode in (args.exit_code, 77) and not coredumps and not sanitizer):
exit(0 if shell or result.returncode == args.exit_code else 77)
exit_code = 0 if shell or result.returncode == args.exit_code else 77
exit_str = 'succeeded' if exit_code == 0 else 'skipped'
else:
# 0 also means we failed so translate that to a non-zero exit code to mark the test as failed.
exit_code = result.returncode or 1
exit_str = 'failed'
if journal_file.exists():
ops = []
@@ -678,10 +683,11 @@ def main() -> None:
ops += [f'journalctl --file {journal_file} --no-hostname -o short-monotonic -u {args.unit} -p info']
print(f'Test failed, relevant logs can be viewed with: \n\n{(" && ".join(ops))}\n', file=sys.stderr)
print(
f'Test {exit_str}, relevant logs can be viewed with: \n\n{(" && ".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)
exit(exit_code)
if __name__ == '__main__':
+1
View File
@@ -43,6 +43,7 @@ foreach dirname : [
'TEST-07-PID1',
'TEST-08-INITRD',
'TEST-09-REBOOT',
'TEST-10-MOUNT',
'TEST-13-NSPAWN',
'TEST-15-DROPIN',
'TEST-16-EXTEND-TIMEOUT',