Index: gm/tests/run.sh |
=================================================================== |
--- gm/tests/run.sh (revision 9099) |
+++ gm/tests/run.sh (working copy) |
@@ -44,6 +44,28 @@ |
fi |
} |
+# Run a command, and validate that it succeeds (returns 0). |
+function assert_passes { |
+ COMMAND="$1" |
+ OUTPUT=$($COMMAND 2>&1) |
+ if [ $? != 0 ]; then |
+ echo "This command was supposed to pass, but failed: [$COMMAND]" |
+ echo $OUTPUT |
+ ENCOUNTERED_ANY_ERRORS=1 |
+ fi |
+} |
+ |
+# Run a command, and validate that it fails (returns nonzero). |
+function assert_fails { |
+ COMMAND="$1" |
+ OUTPUT=$($COMMAND 2>&1) |
+ if [ $? == 0 ]; then |
+ echo "This command was supposed to fail, but passed: [$COMMAND]" |
+ echo $OUTPUT |
+ ENCOUNTERED_ANY_ERRORS=1 |
+ fi |
+} |
+ |
# Run gm... |
# - with the arguments in $1 |
# - writing stdout into $2/$OUTPUT_ACTUAL_SUBDIR/stdout |
@@ -186,6 +208,11 @@ |
# Ignore some error types (including ExpectationsMismatch) |
gm_test "--ignoreErrorTypes ExpectationsMismatch NoGpuContext --verbose --hierarchy --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels.json" "$GM_OUTPUTS/ignore-expectations-mismatch" |
+# Exercise confirm_no_failures_in_json.py |
rmistry
2013/05/13 12:25:39
Everything looks the same in the below 3 lines exc
epoger
2013/05/14 15:03:00
Made it two loops (one for passing cases, one for
|
+assert_passes "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/compared-against-identical-bytes-json/$OUTPUT_EXPECTED_SUBDIR/json-summary.txt" |
+assert_passes "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/compared-against-identical-pixels-json/$OUTPUT_EXPECTED_SUBDIR/json-summary.txt" |
+assert_fails "python gm/confirm_no_failures_in_json.py $GM_OUTPUTS/compared-against-different-pixels-json/$OUTPUT_EXPECTED_SUBDIR/json-summary.txt" |
+ |
if [ $ENCOUNTERED_ANY_ERRORS == 0 ]; then |
echo "All tests passed." |
exit 0 |