summaryrefslogtreecommitdiffstats
path: root/test/units
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-05-19 18:48:07 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2023-05-19 20:03:34 +0200
commit305aa43815bb66e4c512d0f0900a0727940dfecb (patch)
tree3894860299d6df278bbf0ad2a189c5609e3632c1 /test/units
parenttest: check if we correctly handle invalid UTF-8 in mount stuff (diff)
downloadsystemd-305aa43815bb66e4c512d0f0900a0727940dfecb.tar.xz
systemd-305aa43815bb66e4c512d0f0900a0727940dfecb.zip
tests: run all functions with testcase_ prefix automagically
Diffstat (limited to 'test/units')
-rwxr-xr-xtest/units/testsuite-73.sh27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh
index 39992a844b..8e2bca1005 100755
--- a/test/units/testsuite-73.sh
+++ b/test/units/testsuite-73.sh
@@ -51,7 +51,7 @@ restore_locale() {
fi
}
-test_locale() {
+testcase_locale() {
local i output
if [[ -f /etc/locale.conf ]]; then
@@ -222,7 +222,7 @@ wait_vconsole_setup() {
return 1
}
-test_vc_keymap() {
+testcase_vc_keymap() {
local i output vc
if [[ -z "$(localectl list-keymaps)" ]]; then
@@ -292,7 +292,7 @@ test_vc_keymap() {
assert_in "VC Keymap: .unset." "$(localectl)"
}
-test_x11_keymap() {
+testcase_x11_keymap() {
local output
if [[ -z "$(localectl list-x11-keymap-layouts)" ]]; then
@@ -431,7 +431,7 @@ XKBMODEL=pc105+inet"
assert_not_in "X11 Options:" "$output"
}
-test_convert() {
+testcase_convert() {
if [[ -z "$(localectl list-keymaps)" ]]; then
echo "No vconsole keymap installed, skipping test."
return
@@ -552,7 +552,7 @@ test_convert() {
assert_not_in "X11 Options:" "$output"
}
-test_validate() {
+testcase_validate() {
if [[ -z "$(localectl list-keymaps)" ]]; then
echo "No vconsole keymap installed, skipping test."
return
@@ -656,11 +656,18 @@ EOF
export SYSTEMD_KBD_MODEL_MAP=/usr/lib/systemd/tests/testdata/test-keymap-util/kbd-model-map
enable_debug
-test_locale
-test_vc_keymap
-test_x11_keymap
-test_convert
-test_validate
+
+# Create a list of all functions prefixed with testcase_
+mapfile -t TESTCASES < <(declare -F | awk '$3 ~ /^testcase_/ {print $3;}')
+
+if [[ "${#TESTCASES[@]}" -eq 0 ]]; then
+ echo >&2 "No test cases found, this is most likely an error"
+ exit 1
+fi
+
+for testcase in "${TESTCASES[@]}"; do
+ "$testcase"
+done
touch /testok
rm /failed