summaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-09-26 15:57:45 +0500
committerEgor Tensin <egor@tensin.name>2026-09-26 15:57:45 +0500
commita2fa0f452bdefe3cf3acb5698d17059c5b2bb598 (patch)
tree4fef5481be56a6bbc430e0ebeb4c95bc16f88c81 /test
parenttest/docker: apt-get -> apt (diff)
downloadconfig-links-a2fa0f452bdefe3cf3acb5698d17059c5b2bb598.tar.gz
config-links-a2fa0f452bdefe3cf3acb5698d17059c5b2bb598.zip
test/local: allow filtering tests
Diffstat (limited to 'test')
-rwxr-xr-xtest/local/main.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/local/main.sh b/test/local/main.sh
index 5713366..52b19ad 100755
--- a/test/local/main.sh
+++ b/test/local/main.sh
@@ -12,6 +12,8 @@ shopt -s lastpipe
script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
script_dir="$( cd -- "$script_dir" && pwd )"
readonly script_dir
+script_name="$( basename -- "${BASH_SOURCE[0]}" )"
+readonly script_name
source "$script_dir/lib/log.sh"
@@ -45,15 +47,24 @@ run_test_file() {
}
main() {
+ if [ "$#" -gt 1 ]; then
+ echo "usage: $script_name [PATTERN]" >&2
+ return 1
+ fi
+
local -a test_files=()
local test_file
+ local pattern='*'
+ [ "$#" -gt 0 ] && pattern="$1"
+
find "$script_dir" \
-mindepth 1 \
-maxdepth 1 \
-type f \
-regex '.*/tst-.*\.sh$' \
-regextype posix-basic \
+ -name "$pattern" \
-printf '%P\0' \
| sort -z \
| \
@@ -65,4 +76,4 @@ main() {
log_tests_summary
}
-main
+main "$@"