3 # Copyright 2012 LinkedIn, Inc
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 # use this file except in compliance with the License. You may obtain a copy of
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations under
20 echo "bin/repeat-junit.sh num_times"
23 Invoke bin/repeat-junit.sh from the root of a Voldemort
24 checkout. bin/repeat-junit.sh invokes 'ant junit' num_times.
26 The argument num_times must be an integer.
28 The pretty html junit output that ends up in dist/junit-reports on a
29 single invocation of 'ant junit' is collected in a temp
30 directory. This circumvents the normal behavior of ant in which
31 dist/junit-reports is overwritten with each invocation of 'ant
34 bin/repeat-junit.sh is useful to run after making some substantial
35 changes, or when trying to track down intermittent failures (that
36 occur more on your local box then on a Hudson test machine...).
41 echo "ERROR: Incorrect number of arguments: $# provided, 1 needed." >&2
47 if [[ ! $NUMTIMES == +([0-9]) ]]
49 echo "ERROR: argument num_times is not an integer: $NUMTIMES." >&2
54 TMPDIR
=`mktemp -d -p '/tmp/'`
56 for ((i
=1;i
<=$NUMTIMES;i
++)); do
58 echo "STARTING ITERATION $i"
61 # Run junit and capture stdout to .out and stderr to .err
62 junitiout
="$TMPDIR/junit-$i.out"
63 junitierr
="$TMPDIR/junit-$i.err"
64 ant junit
> >(tee $junitiout) 2> >(tee $junitierr >&2)
67 junitidir
="$TMPDIR/junit-reports-$i"
69 echo "COLLECTING RESULTS OF ITERATION $i IN $junitidir"
70 cp -r dist
/junit-reports
$junitidir
71 mv $junitiout $junitidir
72 mv $junitierr $junitidir