Simple Makefile target helper https://pagure.io/mkit

runtests 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # ffoo test framework
  3. # See LICENSE file for copyright and license details.
  4. export TF_VERSION="0.0.4"
  5. die() {
  6. echo "$@" && exit 9
  7. }
  8. export LC_ALL=C
  9. export TF_DIR=${TF_DIR:-$(dirname "$0")}
  10. export TF_SUITE="${TF_SUITE:-tests}"
  11. export TF_ARTIFACTS="${TF_ARTIFACTS:-tfkit-artifacts}"
  12. export TF_COLLECT="${TF_COLLECT:-auto}"
  13. usage() {
  14. echo "usage: $(basename "$0") [-c|-C] [-t tests_re] [-s subtest_re] [-p binpath] [-v] [-d]" >&2
  15. exit 2
  16. }
  17. version() {
  18. echo "TFKit (A trivial test kit) $TF_VERSION"
  19. exit 0
  20. }
  21. while true; do case "$1" in
  22. -c|--collect) TF_COLLECT=always; shift ;;
  23. -C|--no-collect) TF_COLLECT=never; shift ;;
  24. -t|--filter-test) export TF_FILTER_TEST="$2"; shift 2 ;;
  25. -s|--filter-subtest) export TF_FILTER_SUBTEST="$2"; shift 2 ;;
  26. -p|--prefix) export PATH="$(readlink -f "$2")/bin:$PATH"; shift 2 ;;
  27. -d|--debug) export TF_DEBUG=true; shift ;;
  28. -v|--verbose) export TF_VERBOSE=true; shift ;;
  29. --version) version ;;
  30. --version-semver) echo "$TF_VERSION"; exit 0 ;;
  31. "") break ;;
  32. *) usage ;;
  33. esac done
  34. . "$TF_DIR/include/harness.sh" \
  35. || die "cannot import harness; is TF_DIR set properly?: $TF_DIR"
  36. time tf_run_tests