I got a spurious test failure on t5504 while running the test suite
today. This is the result of my quest through the SIGPIPE rabbit hole.

Since this is not the first time I've investigated tests failing under
load, I finally broke down and wrote a helper script. It probably needs
some adapting for other people's environments, but I'll share it here in
case anyone is interested:

-- >8 --
#!/bin/sh

test=$1; shift
test=$(cd t && echo $test*.sh)
: ${GIT_STRESS_LOAD:=$(( 2 * $(grep -c ^processor /proc/cpuinfo)))}
: ${GIT_STRESS_ROOT:=/var/ram/git-stress}

mkdir -p "$GIT_STRESS_ROOT" || exit 1
rm -f "$GIT_STRESS_ROOT/fail"
trap 'echo aborted >"$GIT_STRESS_ROOT/fail"' TERM INT HUP
for i in $(seq $GIT_STRESS_LOAD); do
        (
                cd t &&
                while ! test -e "$GIT_STRESS_ROOT/fail"
                do
                        if ./$test \
                           --root="$GIT_STRESS_ROOT/trash-$i" \
                           -v -i >"$GIT_STRESS_ROOT/output-$i" 2>&1
                        then
                                echo >&2 "OK $i"
                        else
                                echo >&2 "FAIL $i"
                                cp "$GIT_STRESS_ROOT/output-$i" 
"$GIT_STRESS_ROOT/fail"
                        fi
                done
        ) &
done
wait
cat "$GIT_STRESS_ROOT/fail"
-- 8< --

You can run it like "./stress t5504", and it will run t5504 over and
over in parallel until one instance fails. Without this patch series,
t5504 generally fails for me within 30 seconds or so. With it, I can run
for several minutes without problems.

  [1/4]: write_or_die: handle EPIPE in async threads
  [2/4]: fetch-pack: ignore SIGPIPE in sideband demuxer
  [3/4]: test_must_fail: report number of unexpected signal
  [4/4]: t5504: handle expected output from SIGPIPE death

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to