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

Unified Diff: tools/tests/run.sh

Issue 18103005: Create jsondiff tool to capture diffs between two JSON expectations files. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: fix_self_test Created 7 years, 6 months 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
« tools/jsondiff.py ('K') | « tools/tests/rebaseline.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/tests/run.sh
===================================================================
--- tools/tests/run.sh (revision 9864)
+++ tools/tests/run.sh (working copy)
@@ -150,8 +150,29 @@
compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
}
+# Run jsondiff.py with arguments in $1, recording its output.
+# Then compare that output to the content of $2/output-expected.
+function jsondiff_test {
+ if [ $# != 2 ]; then
+ echo "jsondiff_test requires exactly 2 parameters, got $#"
+ exit 1
+ fi
+ ARGS="$1"
+ ACTUAL_OUTPUT_DIR="$2/output-actual"
+ EXPECTED_OUTPUT_DIR="$2/output-expected"
+ rm -rf $ACTUAL_OUTPUT_DIR
+ mkdir -p $ACTUAL_OUTPUT_DIR
+ COMMAND="python tools/jsondiff.py $ARGS"
+ echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line
+ $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout
+ echo $? >$ACTUAL_OUTPUT_DIR/return_value
+ compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
+}
+
+
+
#
# Run skdiff tests...
#
@@ -215,4 +236,13 @@
rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float --add-new" "$REBASELINE_OUTPUT/using-json1-add-new"
rebaseline_test "--json-base-url file:$REBASELINE_INPUT/json1 --subdirs base-android-galaxy-nexus base-shuttle-win7-intel-float --expectations-root $REBASELINE_INPUT/json1" "$REBASELINE_OUTPUT/using-json1-expectations"
+#
+# Test jsondiff.py ...
+#
+
+JSONDIFF_INPUT=tools/tests/jsondiff/input
+JSONDIFF_OUTPUT=tools/tests/jsondiff/output
+jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUTPUT/old-vs-new"
+
+
echo "All tests passed."
« tools/jsondiff.py ('K') | « tools/tests/rebaseline.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698