Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: common/dirwalk/test.sh

Issue 2054763004: luci-go/common/dirwalk: Code for walking a directory tree efficiently Base URL: https://github.com/luci/luci-go@master
Patch Set: Major rewrite of the code. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/dirwalk/test.sh
diff --git a/common/dirwalk/test.sh b/common/dirwalk/test.sh
new file mode 100755
index 0000000000000000000000000000000000000000..3dc4481cf9dc60ed99c11426dd4b1cc9261de367
--- /dev/null
+++ b/common/dirwalk/test.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# Copyright 2016 The LUCI Authors. All rights reserved.
+# Use of this source code is governed under the Apache License, Version 2.0
+# that can be found in the LICENSE file.
+
+set -e
+set -x
+
+TESTS=common/dirwalk/tests/*.json
+
+go install github.com/luci/luci-go/common/dirwalk/tests/tools/gendir
+go install github.com/luci/luci-go/common/dirwalk/tests/tools/walkdir
+
+echo "Generating the test directories"
+echo "----------------------------------"
+TMPDIR=/usr/local/google/tmp/luci-tests
+mkdir -p $TMPDIR
+for TESTFILE in $TESTS; do
+ TESTNAME="$(basename $TESTFILE .json)"
+ TESTDIR="$TMPDIR/$TESTNAME"
+ if ! [ -d $TESTDIR ]; then
+ echo "Generating test directory for $TESTNAME"
+ gendir -config $TESTFILE -outdir $TESTDIR
+ du -h $TESTDIR
+ fi
+done
+echo "All test directories done."
+echo
+echo
+
+echo "Verifying the walks"
+echo "----------------------------------"
+for METHOD in basic nostat parallel; do
+ for TESTFILE in $TESTS; do
+ TESTNAME="$(basename $TESTFILE .json)"
+ TESTDIR="$TMPDIR/$TESTNAME"
+ echo "Verifying $METHOD on $TESTNAME"
+ walkdir --dir $TESTDIR --method $METHOD --do verify || exit 1
+ echo
+ done
+ echo
+ echo
+ echo
+done
+echo "All test directories done."
+echo
+echo
+
+echo "Running the performance tests"
+echo "----------------------------------"
+for METHOD in basic nostat parallel; do
+ echo "Running $METHOD"
+ for TESTFILE in $TESTS; do
+ TESTNAME="$(basename $TESTFILE .json)"
+ TESTDIR="$TMPDIR/$TESTNAME"
+ OUTPUT=output.$METHOD.$TESTNAME
+ echo "Running $METHOD.$TESTNAME"
+ rm $OUTPUT
+ $(which time) --verbose --output=$OUTPUT --append walkdir --dir $TESTDIR --method $METHOD $@ 2> $OUTPUT
+ tail -n 20 $OUTPUT
+ echo
+ done
+ echo
+ echo
+ echo
+done
+echo "All perf tests done."
+echo
+echo

Powered by Google App Engine
This is Rietveld 408576698