123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #!/bin/bash
- # tfkit - Shellfu's movable test framework
- # See LICENSE file for copyright and license details.
-
- TF_VERSION="0.0.7"
-
- die() {
- echo "$@" && exit 9
- }
-
- usage() {
- echo "usage: $(basename "$0") [-c|-C] [-t tests_re] [-s subtest_re] [-p binpath] [-v] [-d]" >&2
- exit 2
- }
-
- version() {
- echo "TFKit (A trivial test kit) $TF_VERSION"
- exit 0
- }
-
- LC_ALL=C
- TF_DIR=${TF_DIR:-$(dirname "$0")}
- TF_SUITE="${TF_SUITE:-tests}"
- TF_ARTIFACTS="${TF_ARTIFACTS:-tfkit-artifacts}"
- TF_COLLECT="${TF_COLLECT:-auto}"
-
- while true; do case "$1" in
- -c|--collect) TF_COLLECT=always; shift ;;
- -C|--no-collect) TF_COLLECT=never; shift ;;
- -d|--debug) TF_DEBUG=true; shift ;;
- -p|--prefix) export PATH="$(readlink -f "$2")/bin:$PATH"
- shift 2 || usage ;;
- -s|--filter-subtest) TF_FILTER_SUBTEST="$2"; shift 2 || usage ;;
- -t|--filter-test) TF_FILTER_TEST="$2"; shift 2 || usage ;;
- -v|--verbose) TF_VERBOSE=true; shift ;;
- --version-semver) echo "$TF_VERSION"; exit 0 ;;
- --version) version ;;
- "") break ;;
- *) usage ;;
- esac done
-
- export LC_ALL
- export TF_DIR TF_SUITE TF_ARTIFACTS
- export TF_COLLECT TF_FILTER_SUBTEST TF_FILTER_TEST
- export TF_DEBUG TF_VERBOSE
- export TF_VERSION
-
- . "$TF_DIR/include/harness.sh" \
- || die "cannot import harness; is TF_DIR set properly?: $TF_DIR"
-
- time tf_run_tests
|