X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Fbenchmark%2Fcommon.sh;h=4dbc5671edbb0f91b09dae3aba3d296440d434dc;hp=9eb03f831c00491050fee072f05fff265a67e716;hb=4b2d70a71f5d7ac75c9eb2589c3df26a2ed0684a;hpb=f5ab766ee2c8300cb00ca5878b1cb464f960a66d diff --git a/tests/benchmark/common.sh b/tests/benchmark/common.sh old mode 100644 new mode 100755 index 9eb03f8..4dbc567 --- a/tests/benchmark/common.sh +++ b/tests/benchmark/common.sh @@ -2,11 +2,35 @@ # This file is meant to be sourced from other tests scripts. # +cleanup() { + if [ x"$TMPFILE" != "x" ]; then + rm -f "$TMPFILE" + fi + + # Call the tap.sh exit cleanup code + _exit +} + +xseq() { + i=$1 + while [[ "$i" -le "$2" ]]; do + echo "$i" + i=$(( i + 1 )) + done +} + +# Set TEST_TIME_BIN if [ -x "$URCU_TEST_TIME_BIN" ]; then - test_time_bin="$URCU_TEST_TIME_BIN" + TEST_TIME_BIN="$URCU_TEST_TIME_BIN" elif [ -x "/usr/bin/time" ]; then - test_time_bin="/usr/bin/time" + TEST_TIME_BIN="/usr/bin/time" else - test_time_bin="" + TEST_TIME_BIN="" fi +export TEST_TIME_BIN + +# Create a temporary file for tests output +TMPFILE=$(mktemp) +# Set traps to delete the temporary file on exit +trap cleanup EXIT