Skip to content

Commit

Permalink
test-lib: Don't write test-results when HARNESS_ACTIVE
Browse files Browse the repository at this point in the history
TAP harnesses don't need to read test-results/*, since they keep track
of the number of passing/failing tests internally. Skip the generation
of these files when HARNESS_ACTIVE is set.

It's now possible to run the Git test suite without writing anything
to the t/ directory at all if you use a TAP harness and the --root
switch:

    cd t
    sudo mount -t tmpfs none /tmp/memory -o size=300m
    prove -j9 ./t[0-9]*.sh :: --root=/tmp/memory

The I/O that the ~500 test-results/* files contributed was very
minimal, but I thought this was worth mentioning.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ævar Arnfjörð Bjarmason authored and Junio C Hamano committed Aug 18, 2010
1 parent 3d04589 commit 8ef1abe
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -633,16 +633,19 @@ test_create_repo () {

test_done () {
GIT_EXIT_OK=t
test_results_dir="$TEST_DIRECTORY/test-results"
mkdir -p "$test_results_dir"
test_results_path="$test_results_dir/${0%.sh}-$$.counts"

echo "total $test_count" >> $test_results_path
echo "success $test_success" >> $test_results_path
echo "fixed $test_fixed" >> $test_results_path
echo "broken $test_broken" >> $test_results_path
echo "failed $test_failure" >> $test_results_path
echo "" >> $test_results_path

if test -z "$HARNESS_ACTIVE"; then
test_results_dir="$TEST_DIRECTORY/test-results"
mkdir -p "$test_results_dir"
test_results_path="$test_results_dir/${0%.sh}-$$.counts"

echo "total $test_count" >> $test_results_path
echo "success $test_success" >> $test_results_path
echo "fixed $test_fixed" >> $test_results_path
echo "broken $test_broken" >> $test_results_path
echo "failed $test_failure" >> $test_results_path
echo "" >> $test_results_path
fi

if test "$test_fixed" != 0
then
Expand Down

0 comments on commit 8ef1abe

Please sign in to comment.