From: Daan De Meyer Date: Thu, 27 Mar 2025 15:10:03 +0000 (+0100) Subject: test: Use /dev/shm for TEST_JOURNAL_USE_TMP if /tmp isn't tmpfs X-Git-Tag: v258-rc1~995^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7df838a073dd6a1de41636dfa55f0ef33151dd6;p=thirdparty%2Fsystemd.git test: Use /dev/shm for TEST_JOURNAL_USE_TMP if /tmp isn't tmpfs If /dev/shm is a tmpfs and /tmp isn't, use /dev/shm instead. --- diff --git a/test/integration-tests/integration-test-wrapper.py b/test/integration-tests/integration-test-wrapper.py index 7335611eb7b..18b35eec7c2 100755 --- a/test/integration-tests/integration-test-wrapper.py +++ b/test/integration-tests/integration-test-wrapper.py @@ -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()