test-lib: parse options in a for loop to keep $@ intact
[gitweb.git] / t / perf / perf-lib.sh
index a54be0951667e0bb3d00e7129912b5052b0ebab0..2e33ab3ec3ef9838962c7a8b1a997faeed11f071 100644 (file)
@@ -82,7 +82,7 @@ test_perf_do_repo_symlink_config_ () {
 
 test_perf_create_repo_from () {
        test "$#" = 2 ||
-       error "bug in the test script: not 2 parameters to test-create-repo"
+       BUG "not 2 parameters to test-create-repo"
        repo="$1"
        source="$2"
        source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
@@ -184,7 +184,7 @@ test_wrapper_ () {
        test_start_
        test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
        test "$#" = 2 ||
-       error "bug in the test script: not 2 or 3 parameters to test-expect-success"
+       BUG "not 2 or 3 parameters to test-expect-success"
        export test_prereq
        if ! test_skip "$@"
        then
@@ -231,6 +231,19 @@ test_perf () {
        test_wrapper_ test_perf_ "$@"
 }
 
+test_size_ () {
+       say >&3 "running: $2"
+       if test_eval_ "$2" 3>"$base".size; then
+               test_ok_ "$1"
+       else
+               test_failure_ "$@"
+       fi
+}
+
+test_size () {
+       test_wrapper_ test_size_ "$@"
+}
+
 # We extend test_done to print timings at the end (./run disables this
 # and does it after running everything)
 test_at_end_hook_ () {