t / perf / runon commit Merge branch 'bw/ls-files-recurse-submodules' (1c2b1f7)
   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        for config in config.mak config.mak.autogen config.status
  34        do
  35                if test -e "../../$config"
  36                then
  37                        cp "../../$config" "build/$rev/"
  38                fi
  39        done
  40        (cd build/$rev && make $GIT_PERF_MAKE_OPTS) ||
  41        die "failed to build revision '$mydir'"
  42}
  43
  44run_dirs_helper () {
  45        mydir=${1%/}
  46        shift
  47        while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
  48                shift
  49        done
  50        if test $# -gt 0 -a "$1" = --; then
  51                shift
  52        fi
  53        if [ ! -d "$mydir" ]; then
  54                rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
  55                die "'$mydir' is neither a directory nor a valid revision"
  56                if [ ! -d build/$rev ]; then
  57                        unpack_git_rev $rev
  58                fi
  59                build_git_rev $rev
  60                mydir=build/$rev
  61        fi
  62        if test "$mydir" = .; then
  63                unset GIT_TEST_INSTALLED
  64        else
  65                GIT_TEST_INSTALLED="$mydir/bin-wrappers"
  66                export GIT_TEST_INSTALLED
  67        fi
  68        run_one_dir "$@"
  69}
  70
  71run_dirs () {
  72        while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
  73                run_dirs_helper "$@"
  74                shift
  75        done
  76}
  77
  78GIT_PERF_AGGREGATING_LATER=t
  79export GIT_PERF_AGGREGATING_LATER
  80
  81cd "$(dirname $0)"
  82. ../../GIT-BUILD-OPTIONS
  83
  84if test $# = 0 -o "$1" = -- -o -f "$1"; then
  85        set -- . "$@"
  86fi
  87run_dirs "$@"
  88./aggregate.perl "$@"