test: Rename testsuite-XX units to match test name
Having these named differently than the test itself mostly creates unecessary confusion and makes writing logic against the tests harder so let's rename the testsuite-xx units and scripts to just use the test name itself.
This commit is contained in:
+15
-16
@@ -146,10 +146,9 @@ if ! [[ "$TESTNAME" =~ ^TEST\-([0-9]+)\-.+$ ]]; then
|
||||
echo "ERROR: Test name '$TESTNAME' is not in the expected format: TEST-[0-9]+-*" >&2
|
||||
exit 1
|
||||
fi
|
||||
TESTID="${BASH_REMATCH[1]:?}"
|
||||
|
||||
if [[ ! -f "$TEST_UNITS_DIR/testsuite-$TESTID.service" ]]; then
|
||||
echo "ERROR: Test '$TESTNAME' is missing its service file '$TEST_UNITS_DIR/testsuite-$TESTID.service" >&2
|
||||
if [[ ! -f "$TEST_UNITS_DIR/$TESTNAME.service" ]]; then
|
||||
echo "ERROR: Test '$TESTNAME' is missing its service file '$TEST_UNITS_DIR/$TESTNAME.service" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -566,9 +565,9 @@ run_qemu() {
|
||||
"loglevel=2"
|
||||
"init=$PATH_TO_INIT"
|
||||
"console=$CONSOLE"
|
||||
"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$1.units:/usr/lib/systemd/tests/testdata/units:"
|
||||
"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/$1.units:/usr/lib/systemd/tests/testdata/units:"
|
||||
"systemd.unit=testsuite.target"
|
||||
"systemd.wants=testsuite-$1.service"
|
||||
"systemd.wants=$1.service"
|
||||
"noresume"
|
||||
"oops=panic"
|
||||
${TEST_MATCH_SUBTEST:+"systemd.setenv=TEST_MATCH_SUBTEST=$TEST_MATCH_SUBTEST"}
|
||||
@@ -658,13 +657,13 @@ run_nspawn() {
|
||||
"--register=no"
|
||||
"--kill-signal=SIGKILL"
|
||||
"--directory=${1:?}"
|
||||
"--setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$2.units:/usr/lib/systemd/tests/testdata/units:"
|
||||
"--machine=TEST-$TESTID"
|
||||
"--setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/$2.units:/usr/lib/systemd/tests/testdata/units:"
|
||||
"--machine=$2"
|
||||
)
|
||||
local kernel_params=(
|
||||
"$PATH_TO_INIT"
|
||||
"systemd.unit=testsuite.target"
|
||||
"systemd.wants=testsuite-$2.service"
|
||||
"systemd.wants=$2.service"
|
||||
${TEST_MATCH_SUBTEST:+"systemd.setenv=TEST_MATCH_SUBTEST=$TEST_MATCH_SUBTEST"}
|
||||
${TEST_MATCH_TESTCASE:+"systemd.setenv=TEST_MATCH_TESTCASE=$TEST_MATCH_TESTCASE"}
|
||||
)
|
||||
@@ -1745,10 +1744,10 @@ save_journal() {
|
||||
dest_name="system.journal"
|
||||
fi
|
||||
|
||||
# Show messages from the testsuite-XX.service or messages with priority "warning" and higher
|
||||
# Show messages from the TEST-XX-XXX.service or messages with priority "warning" and higher
|
||||
echo " --- $source_dir ---"
|
||||
"$JOURNALCTL" --all --no-pager --no-hostname -o short-monotonic -D "$source_dir" \
|
||||
_SYSTEMD_UNIT="testsuite-${TESTID:?}.service" + SYSLOG_IDENTIFIER="testsuite-$TESTID.sh" + \
|
||||
_SYSTEMD_UNIT="${TESTNAME:?}.service" + SYSLOG_IDENTIFIER="$TESTNAME.sh" + \
|
||||
PRIORITY=4 + PRIORITY=3 + PRIORITY=2 + PRIORITY=1 + PRIORITY=0
|
||||
|
||||
if get_bool "$save"; then
|
||||
@@ -3325,11 +3324,11 @@ test_setup() {
|
||||
}
|
||||
|
||||
test_run() {
|
||||
local test_id="${1:?}"
|
||||
local test_name="${1:?}"
|
||||
mount_initdir
|
||||
|
||||
if ! get_bool "${TEST_NO_QEMU:=}"; then
|
||||
if run_qemu "$test_id"; then
|
||||
if run_qemu "$test_name"; then
|
||||
check_result_qemu || { echo "qemu test failed"; return 1; }
|
||||
else
|
||||
dwarn "can't run qemu, skipping"
|
||||
@@ -3337,7 +3336,7 @@ test_run() {
|
||||
fi
|
||||
if ! get_bool "${TEST_NO_NSPAWN:=}"; then
|
||||
mount_initdir
|
||||
if run_nspawn "${initdir:?}" "$test_id"; then
|
||||
if run_nspawn "${initdir:?}" "$test_name"; then
|
||||
check_result_nspawn "$initdir" || { echo "nspawn-root test failed"; return 1; }
|
||||
else
|
||||
dwarn "can't run systemd-nspawn, skipping"
|
||||
@@ -3345,7 +3344,7 @@ test_run() {
|
||||
|
||||
if get_bool "${RUN_IN_UNPRIVILEGED_CONTAINER:=}"; then
|
||||
dir="$TESTDIR/unprivileged-nspawn-root"
|
||||
if NSPAWN_ARGUMENTS="-U --private-network ${NSPAWN_ARGUMENTS:-}" run_nspawn "$dir" "$test_id"; then
|
||||
if NSPAWN_ARGUMENTS="-U --private-network ${NSPAWN_ARGUMENTS:-}" run_nspawn "$dir" "$test_name"; then
|
||||
check_result_nspawn "$dir" || { echo "unprivileged-nspawn-root test failed"; return 1; }
|
||||
else
|
||||
dwarn "can't run systemd-nspawn, skipping"
|
||||
@@ -3401,7 +3400,7 @@ do_test() {
|
||||
case $1 in
|
||||
--run)
|
||||
echo "${testname} RUN: $TEST_DESCRIPTION"
|
||||
test_run "$TESTID"
|
||||
test_run "$TESTNAME"
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
echo "${testname} RUN: $TEST_DESCRIPTION [OK]"
|
||||
@@ -3433,7 +3432,7 @@ do_test() {
|
||||
test_setup_cleanup </dev/null >>"$TESTLOG" 2>&1 || ret=$?
|
||||
fi
|
||||
if [ $ret -eq 0 ]; then
|
||||
test_run "$TESTID" </dev/null >>"$TESTLOG" 2>&1 || ret=$?
|
||||
test_run "$TESTNAME" </dev/null >>"$TESTLOG" 2>&1 || ret=$?
|
||||
fi
|
||||
test_cleanup
|
||||
if [ $ret -eq 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user