Add a self-test for gm, similar to our self-test for skdiff.
Review URL: https://codereview.appspot.com/6827068
git-svn-id: http://skia.googlecode.com/svn/trunk@6380 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/tests/run.sh b/tools/tests/run.sh
index 7f00ced..3e36191 100755
--- a/tools/tests/run.sh
+++ b/tools/tests/run.sh
@@ -2,7 +2,9 @@
# Tests for our tools.
# TODO: for now, it only tests skdiff
-# TODO: for now, assumes that it is being run from .../trunk
+
+# cd into .../trunk so all the paths will work
+cd $(dirname $0)/../..
# TODO: make it look in Release and/or Debug
SKDIFF_BINARY=out/Debug/skdiff
@@ -13,6 +15,10 @@
# we exit with a nonzero return value.
# Otherwise, we write nothing to stdout and return.
function compare_directories {
+ if [ $# != 2 ]; then
+ echo "compare_directories requires exactly 2 parameters, got $#"
+ exit 1
+ fi
diff --exclude=.* $1 $2
if [ $? != 0 ]; then
echo "failed in: compare_directories $1 $2"
@@ -24,6 +30,10 @@
# to write its output, if any, to directory $2/output-actual).
# Then compare its results against those in $2/output-expected.
function skdiff_test {
+ if [ $# != 2 ]; then
+ echo "skdiff_test requires exactly 2 parameters, got $#"
+ exit 1
+ fi
SKDIFF_ARGS="$1"
ACTUAL_OUTPUT_DIR="$2/output-actual"
EXPECTED_OUTPUT_DIR="$2/output-expected"