BUG=http://code.google.com/p/skia/issues/detail?id=1068
Review URL: https://codereview.appspot.com/7164043

git-svn-id: http://skia.googlecode.com/svn/trunk@7284 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
epoger@google.com 2013-01-18 19:19:47 +00:00
Родитель 2124446ebb
Коммит 407f8da4f4
15 изменённых файлов: 72 добавлений и 27 удалений

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 24 KiB

Просмотреть файл

@ -1 +0,0 @@
This directory intentionally left empty. Except for this file.

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 27 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 25 KiB

Просмотреть файл

@ -2,7 +2,7 @@
"actual-results" : {
"failed" : {
"8888/dashing2" : {
"checksum" : 16595425910463109922
"checksum" : FAKE
}
},
"failure-ignored" : null,
@ -11,7 +11,7 @@
},
"expected-results" : {
"8888/dashing2" : {
"checksums" : [ 15161495552186645995 ],
"checksums" : [ FAKE ],
"ignore-failure" : false
}
}

Просмотреть файл

@ -1,6 +1,4 @@
Non-default runtime configuration options:
reading from gm/tests/inputs/different-pixels
writing to gm/tests/outputs/compared-against-different-pixels/output-actual/images
drawing... dashing2 [640 480]
Ran 1 tests: 0 passed, 1 failed, 0 missing reference images
8888/dashing2 pixel_error

Просмотреть файл

@ -4,7 +4,7 @@
"failure-ignored" : null,
"no-comparison" : {
"8888/dashing2" : {
"checksum" : 16595425910463109922
"checksum" : FAKE
}
},
"succeeded" : null

Просмотреть файл

@ -1,4 +1,3 @@
Non-default runtime configuration options:
reading from gm/tests/inputs/empty-dir
writing to gm/tests/outputs/compared-against-empty-dir/output-actual/images
drawing... dashing2 [640 480]

Просмотреть файл

@ -5,13 +5,13 @@
"no-comparison" : null,
"succeeded" : {
"8888/dashing2" : {
"checksum" : 16595425910463109922
"checksum" : FAKE
}
}
},
"expected-results" : {
"8888/dashing2" : {
"checksums" : [ 16595425910463109922 ],
"checksums" : [ FAKE ],
"ignore-failure" : false
}
}

Просмотреть файл

@ -1,4 +1,3 @@
Non-default runtime configuration options:
reading from gm/tests/inputs/identical-bytes
writing to gm/tests/outputs/compared-against-identical-bytes/output-actual/images
drawing... dashing2 [640 480]

Просмотреть файл

@ -5,13 +5,13 @@
"no-comparison" : null,
"succeeded" : {
"8888/dashing2" : {
"checksum" : 16595425910463109922
"checksum" : FAKE
}
}
},
"expected-results" : {
"8888/dashing2" : {
"checksums" : [ 16595425910463109922 ],
"checksums" : [ FAKE ],
"ignore-failure" : false
}
}

Просмотреть файл

@ -1,4 +1,3 @@
Non-default runtime configuration options:
reading from gm/tests/inputs/identical-pixels
writing to gm/tests/outputs/compared-against-identical-pixels/output-actual/images
drawing... dashing2 [640 480]

Просмотреть файл

@ -4,7 +4,7 @@
"failure-ignored" : null,
"no-comparison" : {
"8888/dashing2" : {
"checksum" : 16595425910463109922
"checksum" : FAKE
}
},
"succeeded" : null

Просмотреть файл

@ -1,4 +1,3 @@
Non-default runtime configuration options:
writing to gm/tests/outputs/no-readpath/output-actual/images
drawing... dashing2 [640 480]
Ran 1 tests: 0 passed, 0 failed, 1 missing reference images

Просмотреть файл

@ -20,6 +20,9 @@ cd $(dirname $0)/../..
# TODO(epoger): make it look in Release and/or Debug
GM_BINARY=out/Debug/gm
OUTPUT_ACTUAL_SUBDIR=output-actual
OUTPUT_EXPECTED_SUBDIR=output-expected
# Compare contents of all files within directories $1 and $2,
# EXCEPT for any dotfiles.
# If there are any differences, a description is written to stdout and
@ -39,40 +42,89 @@ function compare_directories {
# Run gm...
# - with the arguments in $1
# - writing resulting images into $2/output-actual/images
# - writing stdout into $2/output-actual/stdout
# - writing json summary into $2/output-actual/json-summary.txt
# - writing return value into $2/output-actual/return_value
# Then compare all of those against $2/output-expected .
# - writing resulting images into $2/$OUTPUT_ACTUAL_SUBDIR/images
# - writing stdout into $2/$OUTPUT_ACTUAL_SUBDIR/stdout
# - writing json summary into $2/$OUTPUT_ACTUAL_SUBDIR/json-summary.txt
# - writing return value into $2/$OUTPUT_ACTUAL_SUBDIR/return_value
# Then compare all of those against $2/$OUTPUT_EXPECTED_SUBDIR .
function gm_test {
if [ $# != 2 ]; then
echo "gm_test requires exactly 2 parameters, got $#"
exit 1
fi
GM_ARGS="$1"
ACTUAL_OUTPUT_DIR="$2/output-actual"
EXPECTED_OUTPUT_DIR="$2/output-expected"
ACTUAL_OUTPUT_DIR="$2/$OUTPUT_ACTUAL_SUBDIR"
EXPECTED_OUTPUT_DIR="$2/$OUTPUT_EXPECTED_SUBDIR"
JSON_SUMMARY_FILE="$ACTUAL_OUTPUT_DIR/json-summary.txt"
rm -rf $ACTUAL_OUTPUT_DIR
mkdir -p $ACTUAL_OUTPUT_DIR
COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummary $ACTUAL_OUTPUT_DIR/json-summary.txt -w $ACTUAL_OUTPUT_DIR/images"
COMMAND="$GM_BINARY $GM_ARGS --writeJsonSummary $JSON_SUMMARY_FILE -w $ACTUAL_OUTPUT_DIR/images"
echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line
$COMMAND &>$ACTUAL_OUTPUT_DIR/stdout
echo $? >$ACTUAL_OUTPUT_DIR/return_value
# Temporary hack to alleviate
# http://code.google.com/p/skia/issues/detail?id=1068 ('GM self-test failures')
# (Remove instance-counting lines from the Debug output)
grep -v Leaked $ACTUAL_OUTPUT_DIR/stdout >$ACTUAL_OUTPUT_DIR/stdout-tmp
# Only compare selected lines in the output, to ignore any spurious lines
# as noted in http://code.google.com/p/skia/issues/detail?id=1068 .
#
# TODO(epoger): This is still hacky... we need to rewrite this script in
# Python soon, and make stuff like this more maintainable.
grep --regexp=^reading --regexp=^writing --regexp=^drawing \
--regexp=^FAILED --regexp=^Ran $ACTUAL_OUTPUT_DIR/stdout \
>$ACTUAL_OUTPUT_DIR/stdout-tmp
mv $ACTUAL_OUTPUT_DIR/stdout-tmp $ACTUAL_OUTPUT_DIR/stdout
# Replace particular checksums in json output with a placeholder, so
# we don't need to rebaseline these json files when our drawing routines
# change.
sed -e 's/"checksum" : [0-9]*/"checksum" : FAKE/g' \
--in-place $JSON_SUMMARY_FILE
sed -e 's/"checksums" : \[ [0-9]* \]/"checksums" : [ FAKE ]/g' \
--in-place $JSON_SUMMARY_FILE
compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR
}
# Create input dir (at path $1) with images that match or mismatch
# as appropriate.
#
# We used to check these files into SVN, but then we needed to rebasline 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.
function create_inputs_dir {
if [ $# != 1 ]; then
echo "create_inputs_dir requires exactly 1 parameter, got $#"
exit 1
fi
INPUTS_DIR="$1"
mkdir -p $INPUTS_DIR
mkdir -p $INPUTS_DIR/identical-bytes
$GM_BINARY --hierarchy --match dashing2 --config 8888 \
-w $INPUTS_DIR/identical-bytes
mkdir -p $INPUTS_DIR/identical-pixels
$GM_BINARY --hierarchy --match dashing2 --config 8888 \
-w $INPUTS_DIR/identical-pixels
echo "more bytes that do not change the image pixels" \
>> $INPUTS_DIR/identical-pixels/8888/dashing2.png
mkdir -p $INPUTS_DIR/different-pixels
$GM_BINARY --hierarchy --match dashing3 --config 8888 \
-w $INPUTS_DIR/different-pixels
mv $INPUTS_DIR/different-pixels/8888/dashing3.png \
$INPUTS_DIR/different-pixels/8888/dashing2.png
mkdir -p $INPUTS_DIR/empty-dir
}
GM_TESTDIR=gm/tests
GM_INPUTS=$GM_TESTDIR/inputs
GM_OUTPUTS=$GM_TESTDIR/outputs
create_inputs_dir $GM_INPUTS
# Compare generated image against an input image file with identical bytes.
gm_test "--hierarchy --match dashing2 --config 8888 -r $GM_INPUTS/identical-bytes" "$GM_OUTPUTS/compared-against-identical-bytes"