summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 18:50:50 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 18:50:50 +0000
commit496034c82857371cda3ce133e1bb6d409b37f44c (patch)
tree41b7f5ecc6c2b812c389865a3ba731fb07b917f4 /tools
parentc9b562fe60a0142de904f12bb4ae9dd01cf773d4 (diff)
downloadchromium_src-496034c82857371cda3ce133e1bb6d409b37f44c.zip
chromium_src-496034c82857371cda3ce133e1bb6d409b37f44c.tar.gz
chromium_src-496034c82857371cda3ce133e1bb6d409b37f44c.tar.bz2
Example script to run all tests under valgrind
Review URL: http://codereview.chromium.org/113365 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/valgrind/shard-all-tests.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/tools/valgrind/shard-all-tests.sh b/tools/valgrind/shard-all-tests.sh
new file mode 100644
index 0000000..e3e9c99
--- /dev/null
+++ b/tools/valgrind/shard-all-tests.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Script to run all tests under tools/valgrind/chrome_tests.sh
+# in a loop looking for rare/flaky valgrind warnings, and
+# generate suppressions for them, to be later filed as bugs
+# and added to our suppressions file.
+#
+# FIXME: Layout tests are a bit funny - they have their own
+# sharding control, and should probably be tweaked to obey
+# GTEST_SHARD_INDEX/GTEST_TOTAL_SHARDS like the rest,
+# but they take days and days to run, so they are left
+# out of this script.
+
+if test ! -d chrome
+then
+ echo "Please run from parent directory of chrome and build directories"
+ exit 1
+fi
+
+set -x
+set -e
+
+# Regexp to match any valgrind error
+PATTERN="ERROR SUMMARY: [^0]|are definitely|uninitialised|Unhandled exception:\
+Invalid read|Invalid write|Invalid free|Source and desti|Mismatched free|\
+unaddressable byte|vex x86"
+
+# List of test executables to build and run
+# You might want to trim this list down to just one if you have an idea
+# which test has interesting problems (e.g. ui_tests)
+TESTS="base_unittests googleurl_unittests ipc_tests media_unittests \
+ net_unittests printing_unittests startup_tests \
+ test_shell_tests ui_tests unit_tests"
+
+# Build the tests (if we know how)
+OS=`uname`
+case $OS in
+Linux)
+ cd build
+ hammer $TESTS
+ cd ..
+ ;;
+*) echo "don't know how to build on os $OS"
+ ;;
+esac
+
+# Divide each test suite up into 50 shards, as first step
+# in tracking down exact source of errors.
+export GTEST_TOTAL_SHARDS=50
+
+iter=0
+while test $iter -lt 1000
+do
+ for testname in $TESTS
+ do
+ export GTEST_SHARD_INDEX=0
+ while test $GTEST_SHARD_INDEX -lt $GTEST_TOTAL_SHARDS
+ do
+ i=$GTEST_SHARD_INDEX
+ sh tools/valgrind/chrome_tests.sh -t ${testname} --generate_suppressions\
+ > ${testname}_$i.vlog 2>&1
+ GTEST_SHARD_INDEX=`expr $GTEST_SHARD_INDEX + 1`
+ done
+ done
+
+ # Save any interesting log files from this iteration
+ # Also show interesting lines on stdout, to make tail -f more interesting
+ if egrep "$PATTERN" *.vlog
+ then
+ mkdir -p shard-results/$iter
+ mv `egrep -l "$PATTERN" *.vlog` shard-results/$iter
+ fi
+
+ rm *.vlog
+ iter=`expr $iter + 1`
+done