OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. |
| 5 |
| 6 set -e |
| 7 set -x |
| 8 |
| 9 TESTS=common/dirwalk/tests/*.json |
| 10 |
| 11 go install github.com/luci/luci-go/common/dirwalk/tests/tools/gendir |
| 12 go install github.com/luci/luci-go/common/dirwalk/tests/tools/walkdir |
| 13 |
| 14 echo "Generating the test directories" |
| 15 echo "----------------------------------" |
| 16 TMPDIR=/usr/local/google/tmp/luci-tests |
| 17 mkdir -p $TMPDIR |
| 18 for TESTFILE in $TESTS; do |
| 19 TESTNAME="$(basename $TESTFILE .json)" |
| 20 TESTDIR="$TMPDIR/$TESTNAME" |
| 21 if ! [ -d $TESTDIR ]; then |
| 22 echo "Generating test directory for $TESTNAME" |
| 23 gendir -config $TESTFILE -outdir $TESTDIR |
| 24 du -h $TESTDIR |
| 25 fi |
| 26 done |
| 27 echo "All test directories done." |
| 28 echo |
| 29 echo |
| 30 |
| 31 echo "Verifying the walks" |
| 32 echo "----------------------------------" |
| 33 for METHOD in basic nostat parallel; do |
| 34 for TESTFILE in $TESTS; do |
| 35 TESTNAME="$(basename $TESTFILE .json)" |
| 36 TESTDIR="$TMPDIR/$TESTNAME" |
| 37 echo "Verifying $METHOD on $TESTNAME" |
| 38 walkdir --dir $TESTDIR --method $METHOD --do verify || exit 1 |
| 39 echo |
| 40 done |
| 41 echo |
| 42 echo |
| 43 echo |
| 44 done |
| 45 echo "All test directories done." |
| 46 echo |
| 47 echo |
| 48 |
| 49 echo "Running the performance tests" |
| 50 echo "----------------------------------" |
| 51 for METHOD in basic nostat parallel; do |
| 52 echo "Running $METHOD" |
| 53 for TESTFILE in $TESTS; do |
| 54 TESTNAME="$(basename $TESTFILE .json)" |
| 55 TESTDIR="$TMPDIR/$TESTNAME" |
| 56 OUTPUT=output.$METHOD.$TESTNAME |
| 57 echo "Running $METHOD.$TESTNAME" |
| 58 rm $OUTPUT |
| 59 $(which time) --verbose --output=$OUTPUT --append walkdir --dir
$TESTDIR --method $METHOD $@ 2> $OUTPUT |
| 60 tail -n 20 $OUTPUT |
| 61 echo |
| 62 done |
| 63 echo |
| 64 echo |
| 65 echo |
| 66 done |
| 67 echo "All perf tests done." |
| 68 echo |
| 69 echo |
OLD | NEW |