1 # Interoperability testing framework. Each script should source
2 # this after setting default $VERSION_A and $VERSION_B variables.
4 . ..
/..
/GIT-BUILD-OPTIONS
6 BUILD_ROOT
=$INTEROP_ROOT/build
11 echo >&2 "error: test script did not set default versions"
17 git rev-parse
--show-toplevel
21 sha1
=$
(git rev-parse
"$1^{tree}") ||
return 1
24 if test -e "$dir/.built"
30 echo >&2 "==> Building $1..."
32 mkdir
-p "$dir" ||
return 1
34 (cd "$(git rev-parse --show-cdup)" && git archive
--format=tar "$sha1") |
35 (cd "$dir" && tar x
) ||
38 for config
in config.mak config.mak.autogen config.status
40 if test -e "$INTEROP_ROOT/../../$config"
42 cp "$INTEROP_ROOT/../../$config" "$dir/" ||
return 1
48 make $GIT_INTEROP_MAKE_OPTS >&2 &&
55 # Old versions of git don't have bin-wrappers, so let's give a rough emulation.
57 write_script
"$1" <<-EOF
66 generate_wrappers
() {
68 wrap_git .bin
/git.a
"$DIR_A" &&
69 wrap_git .bin
/git.b
"$DIR_B" &&
70 write_script .bin
/git
<<-\EOF &&
71 echo >&2 fatal: test tried to run generic git
74 PATH=$(pwd)/.bin:$PATH
77 VERSION_A=${GIT_TEST_VERSION_A:-$VERSION_A}
78 VERSION_B=${GIT_TEST_VERSION_B:-$VERSION_B}
80 if ! DIR_A=$(build_version "$VERSION_A") ||
81 ! DIR_B=$(build_version "$VERSION_B")
83 echo >&2 "fatal: unable to build git versions"
87 TEST_DIRECTORY=$INTEROP_ROOT/..
88 TEST_OUTPUT_DIRECTORY=$INTEROP_ROOT
90 . "$TEST_DIRECTORY"/test-lib.sh
92 generate_wrappers || die "unable to set up interop test environment"