test: propagate log env vars in run-unit-tests.py wrapper

To make it easier to debug unit test failures
This commit is contained in:
Luca Boccassi
2025-09-10 12:42:33 +01:00
parent e52a1acb81
commit 994af53395

View File

@@ -35,6 +35,12 @@ def argument_parser():
opts = argument_parser().parse_args()
env = {}
if 'SYSTEMD_LOG_LEVEL' in os.environ:
env['SYSTEMD_LOG_LEVEL'] = os.environ['SYSTEMD_LOG_LEVEL']
if 'SYSTEMD_LOG_TARGET' in os.environ:
env['SYSTEMD_LOG_TARGET'] = os.environ['SYSTEMD_LOG_TARGET']
unittestdir = pathlib.Path(__file__).parent.absolute() / 'unit-tests'
tests = list(unittestdir.glob('test-*'))
@@ -53,7 +59,7 @@ for test in sorted(tests):
total.skip += 1
continue
ex = subprocess.run(test, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ex = subprocess.run(test, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
if ex.returncode == 0:
print(f'{GREEN}PASS: {name}{RESET_ALL}')
total.good += 1