t / perf / runon commit Merge branch 'jk/run-command-eacces' into maint (8c1ba21)
   1#!/bin/sh
   2
   3case "$1" in
   4        --help)
   5                echo "usage: $0 [other_git_tree...] [--] [test_scripts]"
   6                exit 0
   7                ;;
   8esac
   9
  10die () {
  11        echo >&2 "error: $*"
  12        exit 1
  13}
  14
  15run_one_dir () {
  16        if test $# -eq 0; then
  17                set -- p????-*.sh
  18        fi
  19        echo "=== Running $# tests in ${GIT_TEST_INSTALLED:-this tree} ==="
  20        for t in "$@"; do
  21                ./$t $GIT_TEST_OPTS
  22        done
  23}
  24
  25unpack_git_rev () {
  26        rev=$1
  27        mkdir -p build/$rev
  28        (cd "$(git rev-parse --show-cdup)" && git archive --format=tar $rev) |
  29        (cd build/$rev && tar x)
  30}
  31build_git_rev () {
  32        rev=$1
  33        cp ../../config.mak build/$rev/config.mak
  34        (cd build/$rev && make $GIT_PERF_MAKE_OPTS) ||
  35        die "failed to build revision '$mydir'"
  36}
  37
  38run_dirs_helper () {
  39        mydir=${1%/}
  40        shift
  41        while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
  42                shift
  43        done
  44        if test $# -gt 0 -a "$1" = --; then
  45                shift
  46        fi
  47        if [ ! -d "$mydir" ]; then
  48                rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
  49                die "'$mydir' is neither a directory nor a valid revision"
  50                if [ ! -d build/$rev ]; then
  51                        unpack_git_rev $rev
  52                fi
  53                build_git_rev $rev
  54                mydir=build/$rev
  55        fi
  56        if test "$mydir" = .; then
  57                unset GIT_TEST_INSTALLED
  58        else
  59                GIT_TEST_INSTALLED="$mydir/bin-wrappers"
  60                export GIT_TEST_INSTALLED
  61        fi
  62        run_one_dir "$@"
  63}
  64
  65run_dirs () {
  66        while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
  67                run_dirs_helper "$@"
  68                shift
  69        done
  70}
  71
  72GIT_PERF_AGGREGATING_LATER=t
  73export GIT_PERF_AGGREGATING_LATER
  74
  75cd "$(dirname $0)"
  76. ../../GIT-BUILD-OPTIONS
  77
  78if test $# = 0 -o "$1" = -- -o -f "$1"; then
  79        set -- . "$@"
  80fi
  81run_dirs "$@"
  82./aggregate.perl "$@"