Skip to content

Commit

Permalink
perf: export some important test-lib variables
Browse files Browse the repository at this point in the history
The only bug right now is that $GIT_TEST_CMP is needed for test_cmp to
work.

However, we also export the three most important paths for tests:

  TEST_DIRECTORY
  TRASH_DIRECTORY
  GIT_BUILD_DIR

Since they are available within test_expect_success, a future test
writer may expect them to also be defined in test_perf.

Signed-off-by: Thomas Rast <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
trast authored and gitster committed Mar 8, 2012
1 parent 1cbc324 commit 561ae06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion t/perf/p0000-perf-lib-sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@ test_expect_success 'test_export works with weird vars' '
test "$bar" = "weird # variable"
'

test_perf 'important variables available in subshells' '
test -n "$HOME" &&
test -n "$TEST_DIRECTORY" &&
test -n "$TRASH_DIRECTORY" &&
test -n "$GIT_BUILD_DIR"
'

test_perf 'test-lib-functions correctly loaded in subshells' '
: >a &&
test_path_is_file a
test_path_is_file a &&
: >b &&
test_cmp a b
'

test_done
4 changes: 4 additions & 0 deletions t/perf/perf-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ TEST_NO_CREATE_REPO=t

. ../test-lib.sh

# Variables from test-lib that are normally internal to the tests; we
# need to export them for test_perf subshells
export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP

perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
mkdir -p "$perf_results_dir"
rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
Expand Down

0 comments on commit 561ae06

Please sign in to comment.