diff options
author | epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-21 15:41:35 +0000 |
---|---|---|
committer | epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-21 15:41:35 +0000 |
commit | 37d747d383ea95d6f3f4bdd80aa4ec8fff81e682 (patch) | |
tree | 21ddb44801b30113c2c9016ee7edb6dc132017e9 | |
parent | 14f584b3537e88ce7926d1ae5502bd1f3d1fb9e3 (diff) |
GM self-tests: add testing for non --hierarchy case
R=scroggo@google.com
Review URL: https://codereview.chromium.org/15397007
git-svn-id: http://skia.googlecode.com/svn/trunk@9214 2bbb7eff-a529-9590-31e7-b0007b416f81
10 files changed, 82 insertions, 26 deletions
diff --git a/gm/tests/outputs/no-hierarchy/output-expected/command_line b/gm/tests/outputs/no-hierarchy/output-expected/command_line new file mode 100644 index 0000000000..7f8fa53903 --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/command_line @@ -0,0 +1 @@ +out/Debug/gm --verbose --match selftest1 --config 8888 565 -r gm/tests/inputs/json/different-pixels-no-hierarchy.json --writeJsonSummaryPath gm/tests/outputs/no-hierarchy/output-actual/json-summary.txt --writePath gm/tests/outputs/no-hierarchy/output-actual/writePath --mismatchPath gm/tests/outputs/no-hierarchy/output-actual/mismatchPath diff --git a/gm/tests/outputs/no-hierarchy/output-expected/json-summary.txt b/gm/tests/outputs/no-hierarchy/output-expected/json-summary.txt new file mode 100644 index 0000000000..fe6038e0ae --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/json-summary.txt @@ -0,0 +1,25 @@ +{ + "actual-results" : { + "failed" : { + "selftest1_565.png" : { + "bitmap-64bitMD5" : 12927999507540085554 + }, + "selftest1_8888.png" : { + "bitmap-64bitMD5" : 1209453360120438698 + } + }, + "failure-ignored" : null, + "no-comparison" : null, + "succeeded" : null + }, + "expected-results" : { + "selftest1_565.png" : { + "allowed-bitmap-64bitMD5s" : [ 8863920166200910451 ], + "ignore-failure" : false + }, + "selftest1_8888.png" : { + "allowed-bitmap-64bitMD5s" : [ 13451349865803053525 ], + "ignore-failure" : false + } + } +} diff --git a/gm/tests/outputs/no-hierarchy/output-expected/mismatchPath/selftest1_565.png b/gm/tests/outputs/no-hierarchy/output-expected/mismatchPath/selftest1_565.png new file mode 100644 index 0000000000..16040c53c0 --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/mismatchPath/selftest1_565.png @@ -0,0 +1 @@ +[contents of gm/tests/outputs/no-hierarchy/output-actual/mismatchPath/selftest1_565.png] diff --git a/gm/tests/outputs/no-hierarchy/output-expected/mismatchPath/selftest1_8888.png b/gm/tests/outputs/no-hierarchy/output-expected/mismatchPath/selftest1_8888.png new file mode 100644 index 0000000000..4d506f8619 --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/mismatchPath/selftest1_8888.png @@ -0,0 +1 @@ +[contents of gm/tests/outputs/no-hierarchy/output-actual/mismatchPath/selftest1_8888.png] diff --git a/gm/tests/outputs/no-hierarchy/output-expected/return_value b/gm/tests/outputs/no-hierarchy/output-expected/return_value new file mode 100644 index 0000000000..ace9d03621 --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/return_value @@ -0,0 +1 @@ +255 diff --git a/gm/tests/outputs/no-hierarchy/output-expected/stderr b/gm/tests/outputs/no-hierarchy/output-expected/stderr new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/stderr diff --git a/gm/tests/outputs/no-hierarchy/output-expected/stdout b/gm/tests/outputs/no-hierarchy/output-expected/stdout new file mode 100644 index 0000000000..c53e24408f --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/stdout @@ -0,0 +1,17 @@ +GM: These configs will be run: 8888 565 +GM: reading expectations from JSON summary file gm/tests/inputs/json/different-pixels-no-hierarchy.json +GM: writing to gm/tests/outputs/no-hierarchy/output-actual/writePath +GM: writing mismatches to gm/tests/outputs/no-hierarchy/output-actual/mismatchPath +GM: drawing... selftest1 [300 200] +GM: Ran 1 GMs +GM: ... over 2 configs ["8888", "565"] +GM: ... and 7 modes ["pipe", "pipe cross-process", "pipe cross-process, shared address", "replay", "rtree", "serialize", "tilegrid"] +GM: ... so there should be a total of 9 tests. +GM: Ran 9 tests: NoGpuContext=0 IntentionallySkipped=0 RenderModeMismatch=0 ExpectationsMismatch=2 MissingExpectations=0 WritingReferenceImage=0 +GM: [*] 0 NoGpuContext: +GM: [ ] 0 IntentionallySkipped: +GM: [*] 0 RenderModeMismatch: +GM: [*] 2 ExpectationsMismatch: selftest1_8888 selftest1_565 +GM: [ ] 0 MissingExpectations: +GM: [*] 0 WritingReferenceImage: +GM: (results marked with [*] will cause nonzero return value) diff --git a/gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_565.png b/gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_565.png new file mode 100644 index 0000000000..ddb053f75b --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_565.png @@ -0,0 +1 @@ +[contents of gm/tests/outputs/no-hierarchy/output-actual/writePath/selftest1_565.png] diff --git a/gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_8888.png b/gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_8888.png new file mode 100644 index 0000000000..1bf8130365 --- /dev/null +++ b/gm/tests/outputs/no-hierarchy/output-expected/writePath/selftest1_8888.png @@ -0,0 +1 @@ +[contents of gm/tests/outputs/no-hierarchy/output-actual/writePath/selftest1_8888.png] diff --git a/gm/tests/run.sh b/gm/tests/run.sh index 0ec576dd40..2038c49cc0 100755 --- a/gm/tests/run.sh +++ b/gm/tests/run.sh @@ -105,12 +105,14 @@ function gm_test { # 1. Image file encoding may vary by platform # 2. https://code.google.com/p/chromium/issues/detail?id=169600 # ('gcl/upload.py fail to upload binary files to rietveld') - for IMAGEFILE in $(ls $ACTUAL_OUTPUT_DIR/*/*/*.png); do + for IMAGEFILE in $(find $ACTUAL_OUTPUT_DIR -name *.png); do echo "[contents of $IMAGEFILE]" >$IMAGEFILE done - for MISMATCHDIR in $(ls -d $ACTUAL_OUTPUT_DIR/mismatchPath/*); do - echo "Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories." >$MISMATCHDIR/bogusfile - done + if [ -d $ACTUAL_OUTPUT_DIR/mismatchPath ]; then + for MISMATCHDIR in $(find $ACTUAL_OUTPUT_DIR/mismatchPath -mindepth 1 -type d); do + echo "Created additional file to make sure directory isn't empty, because self-test cannot handle empty directories." >$MISMATCHDIR/bogusfile + done + fi compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR } @@ -118,7 +120,7 @@ function gm_test { # Create input dir (at path $1) with expectations (both image and json) # that gm will match or mismatch as appropriate. # -# We used to check these files into SVN, but then we needed to rebasline them +# We used to check these files into SVN, but then we needed to rebaseline them # when our drawing changed at all... so, as proposed in # http://code.google.com/p/skia/issues/detail?id=1068 , we generate them # new each time. @@ -132,37 +134,40 @@ function create_inputs_dir { JSON_DIR=$INPUTS_DIR/json mkdir -p $IMAGES_DIR $JSON_DIR - mkdir -p $IMAGES_DIR/identical-bytes + THIS_IMAGE_DIR=$IMAGES_DIR/identical-bytes + mkdir -p $THIS_IMAGE_DIR # Run GM to write out the images actually generated. - $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ - -w $IMAGES_DIR/identical-bytes + $GM_BINARY --hierarchy --match selftest1 $CONFIGS -w $THIS_IMAGE_DIR # Run GM again to read in those images and write them out as a JSON summary. - $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ - -r $IMAGES_DIR/identical-bytes \ + $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ --writeJsonSummaryPath $JSON_DIR/identical-bytes.json - mkdir -p $IMAGES_DIR/identical-pixels - $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ - -w $IMAGES_DIR/identical-pixels + THIS_IMAGE_DIR=$IMAGES_DIR/identical-pixels + mkdir -p $THIS_IMAGE_DIR + $GM_BINARY --hierarchy --match selftest1 $CONFIGS -w $THIS_IMAGE_DIR echo "more bytes that do not change the image pixels" \ - >> $IMAGES_DIR/identical-pixels/8888/selftest1.png + >> $THIS_IMAGE_DIR/8888/selftest1.png echo "more bytes that do not change the image pixels" \ - >> $IMAGES_DIR/identical-pixels/565/selftest1.png - $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ - -r $IMAGES_DIR/identical-pixels \ + >> $THIS_IMAGE_DIR/565/selftest1.png + $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ --writeJsonSummaryPath $JSON_DIR/identical-pixels.json - mkdir -p $IMAGES_DIR/different-pixels - $GM_BINARY --hierarchy --match selftest2 $CONFIGS \ - -w $IMAGES_DIR/different-pixels - mv $IMAGES_DIR/different-pixels/8888/selftest2.png \ - $IMAGES_DIR/different-pixels/8888/selftest1.png - mv $IMAGES_DIR/different-pixels/565/selftest2.png \ - $IMAGES_DIR/different-pixels/565/selftest1.png - $GM_BINARY --hierarchy --match selftest1 $CONFIGS \ - -r $IMAGES_DIR/different-pixels \ + THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels + mkdir -p $THIS_IMAGE_DIR + $GM_BINARY --hierarchy --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR + mv $THIS_IMAGE_DIR/8888/selftest2.png $THIS_IMAGE_DIR/8888/selftest1.png + mv $THIS_IMAGE_DIR/565/selftest2.png $THIS_IMAGE_DIR/565/selftest1.png + $GM_BINARY --hierarchy --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ --writeJsonSummaryPath $JSON_DIR/different-pixels.json + THIS_IMAGE_DIR=$IMAGES_DIR/different-pixels-no-hierarchy + mkdir -p $THIS_IMAGE_DIR + $GM_BINARY --match selftest2 $CONFIGS -w $THIS_IMAGE_DIR + mv $THIS_IMAGE_DIR/selftest2_8888.png $THIS_IMAGE_DIR/selftest1_8888.png + mv $THIS_IMAGE_DIR/selftest2_565.png $THIS_IMAGE_DIR/selftest1_565.png + $GM_BINARY --match selftest1 $CONFIGS -r $THIS_IMAGE_DIR \ + --writeJsonSummaryPath $JSON_DIR/different-pixels-no-hierarchy.json + mkdir -p $IMAGES_DIR/empty-dir } @@ -208,6 +213,9 @@ gm_test "--verbose --hierarchy --match selftest1 selftest2 $CONFIGS" "$GM_OUTPUT # 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" +# Test non-hierarchical mode. +gm_test "--verbose --match selftest1 $CONFIGS -r $GM_INPUTS/json/different-pixels-no-hierarchy.json" "$GM_OUTPUTS/no-hierarchy" + # Exercise confirm_no_failures_in_json.py PASSING_CASES="compared-against-identical-bytes-json compared-against-identical-pixels-json" FAILING_CASES="compared-against-different-pixels-json" |