Skip to content

Commit 67e3ec1

Browse files
committed
Merge branch 'jk/perf-lib-tee'
Code cleanup in the test framework. * jk/perf-lib-tee: perf-lib.sh: rely on test-lib.sh for --tee handling
2 parents 04116ec + 0baf78e commit 67e3ec1

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

t/perf/perf-lib.sh

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,25 @@
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see http://www.gnu.org/licenses/ .
1919

20-
# do the --tee work early; it otherwise confuses our careful
21-
# GIT_BUILD_DIR mangling
22-
case "$GIT_TEST_TEE_STARTED, $* " in
23-
done,*)
24-
# do not redirect again
25-
;;
26-
*' --tee '*|*' --va'*)
27-
mkdir -p test-results
28-
BASE=test-results/$(basename "$0" .sh)
29-
(GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1;
30-
echo $? > $BASE.exit) | tee $BASE.out
31-
test "$(cat $BASE.exit)" = 0
32-
exit
33-
;;
34-
esac
35-
20+
# These variables must be set before the inclusion of test-lib.sh below,
21+
# because it will change our working directory.
3622
TEST_DIRECTORY=$(pwd)/..
3723
TEST_OUTPUT_DIRECTORY=$(pwd)
38-
if test -z "$GIT_TEST_INSTALLED"; then
39-
perf_results_prefix=
40-
else
41-
perf_results_prefix=$(printf "%s" "${GIT_TEST_INSTALLED%/bin-wrappers}" | tr -c "[a-zA-Z0-9]" "[_*]")"."
42-
# make the tested dir absolute
43-
GIT_TEST_INSTALLED=$(cd "$GIT_TEST_INSTALLED" && pwd)
44-
fi
24+
ABSOLUTE_GIT_TEST_INSTALLED=$(
25+
test -n "$GIT_TEST_INSTALLED" && cd "$GIT_TEST_INSTALLED" && pwd)
4526

4627
TEST_NO_CREATE_REPO=t
4728
TEST_NO_MALLOC_CHECK=t
4829

4930
. ../test-lib.sh
5031

32+
if test -z "$GIT_TEST_INSTALLED"; then
33+
perf_results_prefix=
34+
else
35+
perf_results_prefix=$(printf "%s" "${GIT_TEST_INSTALLED%/bin-wrappers}" | tr -c "[a-zA-Z0-9]" "[_*]")"."
36+
GIT_TEST_INSTALLED=$ABSOLUTE_GIT_TEST_INSTALLED
37+
fi
38+
5139
# Variables from test-lib that are normally internal to the tests; we
5240
# need to export them for test_perf subshells
5341
export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP

0 commit comments

Comments
 (0)