test: assume run-unit-tests.py and unit tests are installed in the same directory

This avoids hard coding the path of the directory where the unit tests are
installed.
This commit is contained in:
Franck Bui 2023-01-26 16:14:01 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent ccde62954c
commit 693c3e1a59

View file

@ -2,7 +2,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
import argparse
import glob
import os
import pathlib
import subprocess
@ -33,9 +32,11 @@ def argument_parser():
opts = argument_parser().parse_args()
tests = glob.glob('/usr/lib/systemd/tests/test-*')
unittestdir = pathlib.Path(__file__).parent.absolute()
tests = list(unittestdir.glob('test-*'))
if opts.unsafe:
tests += glob.glob('/usr/lib/systemd/tests/unsafe/test-*')
tests += unittestdir.glob('unsafe/test-*')
if not opts.artifact_directory and os.getenv('ARTIFACT_DIRECTORY'):
opts.artifact_directory = os.getenv('ARTIFACT_DIRECTORY')