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
This commit is contained in:
epoger@google.com 2013-05-21 15:41:35 +00:00
parent 14f584b353
commit 37d747d383
10 changed files with 82 additions and 26 deletions

View File

@ -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

View File

@ -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
}
}
}

View File

@ -0,0 +1 @@
[contents of gm/tests/outputs/no-hierarchy/output-actual/mismatchPath/selftest1_565.png]

View File

@ -0,0 +1 @@
[contents of gm/tests/outputs/no-hierarchy/output-actual/mismatchPath/selftest1_8888.png]

View File

@ -0,0 +1 @@
255

View File

@ -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)

View File

@ -0,0 +1 @@
[contents of gm/tests/outputs/no-hierarchy/output-actual/writePath/selftest1_565.png]

View File

@ -0,0 +1 @@
[contents of gm/tests/outputs/no-hierarchy/output-actual/writePath/selftest1_8888.png]

View File

@ -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"