| 1 | # |
| 2 | # This file is meant to be sourced from other tests scripts. |
| 3 | # |
| 4 | |
| 5 | cleanup() { |
| 6 | if [ x"$TMPFILE" != "x" ]; then |
| 7 | rm -f "$TMPFILE" |
| 8 | fi |
| 9 | |
| 10 | # Call the tap.sh exit cleanup code |
| 11 | _exit |
| 12 | } |
| 13 | |
| 14 | xseq() { |
| 15 | i=$1 |
| 16 | while [[ "$i" -le "$2" ]]; do |
| 17 | echo "$i" |
| 18 | i=$(( i + 1 )) |
| 19 | done |
| 20 | } |
| 21 | |
| 22 | # Set TEST_TIME_BIN |
| 23 | if [ -x "$URCU_TEST_TIME_BIN" ]; then |
| 24 | TEST_TIME_BIN="$URCU_TEST_TIME_BIN" |
| 25 | elif [ -x "/usr/bin/time" ]; then |
| 26 | TEST_TIME_BIN="/usr/bin/time" |
| 27 | else |
| 28 | TEST_TIME_BIN="" |
| 29 | fi |
| 30 | export TEST_TIME_BIN |
| 31 | |
| 32 | # Create a temporary file for tests output |
| 33 | TMPFILE=$(mktemp) |
| 34 | |
| 35 | # Set traps to delete the temporary file on exit |
| 36 | trap cleanup EXIT |