t / perf / runon commit Merge branch 'bw/push-options-recursively-to-submodules' (a49794d)
   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        echo "=== Unpacking $rev in build/$rev ==="
  28        mkdir -p build/$rev
  29        (cd "$(git rev-parse --show-cdup)" && git archive --format=tar $rev) |
  30        (cd build/$rev && tar x)
  31}
  32build_git_rev () {
  33        rev=$1
  34        for config in config.mak config.mak.autogen config.status
  35        do
  36                if test -e "../../$config"
  37                then
  38                        cp "../../$config" "build/$rev/"
  39                fi
  40        done
  41        echo "=== Building $rev ==="
  42        (
  43                cd build/$rev &&
  44                if test -n "$GIT_PERF_MAKE_COMMAND"
  45                then
  46                        sh -c "$GIT_PERF_MAKE_COMMAND"
  47                else
  48                        make $GIT_PERF_MAKE_OPTS
  49                fi
  50        ) || die "failed to build revision '$mydir'"
  51}
  52
  53run_dirs_helper () {
  54        mydir=${1%/}
  55        shift
  56        while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
  57                shift
  58        done
  59        if test $# -gt 0 -a "$1" = --; then
  60                shift
  61        fi
  62        if [ ! -d "$mydir" ]; then
  63                rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
  64                die "'$mydir' is neither a directory nor a valid revision"
  65                if [ ! -d build/$rev ]; then
  66                        unpack_git_rev $rev
  67                fi
  68                build_git_rev $rev
  69                mydir=build/$rev
  70        fi
  71        if test "$mydir" = .; then
  72                unset GIT_TEST_INSTALLED
  73        else
  74                GIT_TEST_INSTALLED="$mydir/bin-wrappers"
  75                # Older versions of git lacked bin-wrappers; fallback to the
  76                # files in the root.
  77                test -d "$GIT_TEST_INSTALLED" || GIT_TEST_INSTALLED=$mydir
  78                export GIT_TEST_INSTALLED
  79        fi
  80        run_one_dir "$@"
  81}
  82
  83run_dirs () {
  84        while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
  85                run_dirs_helper "$@"
  86                shift
  87        done
  88}
  89
  90GIT_PERF_AGGREGATING_LATER=t
  91export GIT_PERF_AGGREGATING_LATER
  92
  93cd "$(dirname $0)"
  94. ../../GIT-BUILD-OPTIONS
  95
  96if test $# = 0 -o "$1" = -- -o -f "$1"; then
  97        set -- . "$@"
  98fi
  99run_dirs "$@"
 100./aggregate.perl "$@"