export timeout_rc=124
export logfile=/dev/stdout
export per_test_logging=
+export per_test_log_dir=/tmp
export RUN_IN_NETNS=
# Defaults for "settings" file fields:
BASENAME_TEST=$(basename $TEST)
test_num=$(( test_num + 1 ))
if [ -n "$per_test_logging" ]; then
- logfile="/tmp/$BASENAME_TEST"
+ logfile="$per_test_log_dir/$BASENAME_TEST"
cat /dev/null > "$logfile"
fi
if [ -n "$RUN_IN_NETNS" ]; then
cat <<EOF
Usage: $0 [OPTIONS]
-s | --summary Print summary with detailed log in output.log (conflict with -p)
- -p | --per-test-log Print test log in /tmp with each test name (conflict with -s)
+ -p | --per-test-log [DIR] Print test log in /tmp or DIR with each test name (conflict with -s)
-t | --test COLLECTION:TEST Run TEST from COLLECTION
-S | --skip COLLECTION:TEST Skip TEST from COLLECTION
-c | --collection COLLECTION Run all tests from COLLECTION
shift ;;
-p | --per-test-log)
per_test_logging=1
- shift ;;
+ if [ -n "$2" ] && [ "${2#-}" = "$2" ]; then
+ per_test_log_dir="$2"
+ if [ -e "$per_test_log_dir" ] && [ ! -d "$per_test_log_dir" ]; then
+ echo "Per-test log path is not a dir:" \
+ "$per_test_log_dir" >&2
+ exit 1
+ fi
+ if [ ! -d "$per_test_log_dir" ] && \
+ ! mkdir -p "$per_test_log_dir"; then
+ echo "Could not create log dir:" \
+ "$per_test_log_dir" >&2
+ exit 1
+ fi
+ per_test_log_dir=$(cd "$per_test_log_dir" && pwd -P)
+ if [ -z "$per_test_log_dir" ]; then
+ echo "Could not resolve per-test log directory" >&2
+ exit 1
+ fi
+ if [ ! -w "$per_test_log_dir" ]; then
+ echo "Per-test log dir is not writable:" \
+ "$per_test_log_dir" >&2
+ exit 1
+ fi
+ shift 2
+ else
+ shift
+ fi ;;
-t | --test)
TESTS="$TESTS $2"
shift 2 ;;