]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Use /dev/shm for TEST_JOURNAL_USE_TMP if /tmp isn't tmpfs
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 27 Mar 2025 15:10:03 +0000 (16:10 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 28 Mar 2025 10:40:39 +0000 (11:40 +0100)
If /dev/shm is a tmpfs and /tmp isn't, use /dev/shm instead.

test/integration-tests/integration-test-wrapper.py

index 7335611eb7b158af898d5e0fbb0520e4560172ce..18b35eec7c29da3aa0b4d8bb1bdda1b269f811cd 100755 (executable)
@@ -350,6 +350,15 @@ def process_coverage(args: argparse.Namespace, summary: Summary, name: str, jour
             print(f'Wrote coverage report for {name} to {output}', file=sys.stderr)
 
 
+def statfs(path: Path) -> str:
+    return subprocess.run(
+        ['stat', '--file-system', os.fspath(path), '--format=%T'],
+        stdout=subprocess.PIPE,
+        text=True,
+        check=True,
+    ).stdout.strip()
+
+
 def main() -> None:
     parser = argparse.ArgumentParser(description=__doc__)
     parser.add_argument('--mkosi', required=True)
@@ -442,7 +451,12 @@ def main() -> None:
         )
 
     if os.getenv('TEST_JOURNAL_USE_TMP', '0') == '1':
-        journal_file = Path(f'/tmp/systemd-integration-tests/journal/{name}.journal')
+        if statfs(Path('/tmp')) != 'tmpfs' and statfs(Path('/dev/shm')) == 'tmpfs':
+            tmp = Path('/dev/shm')
+        else:
+            tmp = Path('/tmp')
+
+        journal_file = tmp / f'systemd-integration-tests/journal/{name}.journal'
     else:
         journal_file = (args.meson_build_dir / f'test/journal/{name}.journal').absolute()