OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Tests for our tools. | 3 # Tests for our tools. |
4 # | 4 # |
5 # TODO: currently, this only passes on Linux (which is the platform that | 5 # TODO: currently, this only passes on Linux (which is the platform that |
6 # the housekeeper bot runs on, e.g. | 6 # the housekeeper bot runs on, e.g. |
7 # http://70.32.156.51:10117/builders/Skia_PerCommit_House_Keeping/builds/1415/st
eps/RunToolSelfTests/logs/stdio ) | 7 # http://70.32.156.51:10117/builders/Skia_PerCommit_House_Keeping/builds/1415/st
eps/RunToolSelfTests/logs/stdio ) |
8 # See https://code.google.com/p/skia/issues/detail?id=677 | 8 # See https://code.google.com/p/skia/issues/detail?id=677 |
9 # ('make tools/tests/run.sh work cross-platform') | 9 # ('make tools/tests/run.sh work cross-platform') |
10 # Ideally, these tests should pass on all development platforms... | 10 # Ideally, these tests should pass on all development platforms... |
11 # otherwise, how can developers be expected to test them before committing a | 11 # otherwise, how can developers be expected to test them before committing a |
12 # change? | 12 # change? |
13 | 13 |
14 # cd into .../trunk so all the paths will work | 14 # cd into .../trunk so all the paths will work |
15 cd $(dirname $0)/../.. | 15 cd $(dirname $0)/../.. |
16 | 16 |
17 # TODO: make it look in Release and/or Debug | 17 # TODO: make it look in Release and/or Debug |
18 SKDIFF_BINARY=out/Debug/skdiff | 18 SKDIFF_BINARY=out/Debug/skdiff |
19 | 19 |
20 # Suffixes of all the raw bench data files we want to process. | 20 # Suffixes of the raw bench data files we want to process. |
21 BENCHDATA_FILE_SUFFIXES_YES_INDIVIDUAL_TILES=\ | 21 BENCHDATA_FILE_SUFFIXES_YES_INDIVIDUAL_TILES=\ |
22 "data_skp_device_bitmap_multi_2_mode_tile_256_256_timeIndividualTiles "\ | 22 "data_skp_scale_1.3061_config_8888_mode_tile_256_256_timeIndividualTiles_bbh_rtr
ee "\ |
23 "data_skp_device_bitmap_multi_3_mode_tile_256_256_timeIndividualTiles "\ | 23 "data_skp_scale_1.3061_config_8888_mode_tile_256_256_timeIndividualTiles" |
24 "data_skp_device_bitmap_multi_4_mode_tile_256_256_timeIndividualTiles "\ | |
25 "data_skp_device_bitmap_mode_record_bbh_rtree" | |
26 BENCHDATA_FILE_SUFFIXES_NO_INDIVIDUAL_TILES=\ | 24 BENCHDATA_FILE_SUFFIXES_NO_INDIVIDUAL_TILES=\ |
27 "data_skp_device_bitmap_multi_2_mode_tile_256_256 "\ | 25 "data_skp_multi_4_scale_1.3061_config_8888_mode_tile_256_256 "\ |
28 "data_skp_device_bitmap_multi_3_mode_tile_256_256 "\ | 26 "data_skp_scale_1.3061_config_8888_mode_record" |
29 "data_skp_device_bitmap_multi_4_mode_tile_256_256 "\ | |
30 "data_skp_device_bitmap_mode_record_bbh_rtree" | |
31 | 27 |
32 # Compare contents of all files within directories $1 and $2, | 28 # Compare contents of all files within directories $1 and $2, |
33 # EXCEPT for any dotfiles. | 29 # EXCEPT for any dotfiles. |
34 # If there are any differences, a description is written to stdout and | 30 # If there are any differences, a description is written to stdout and |
35 # we exit with a nonzero return value. | 31 # we exit with a nonzero return value. |
36 # Otherwise, we write nothing to stdout and return. | 32 # Otherwise, we write nothing to stdout and return. |
37 function compare_directories { | 33 function compare_directories { |
38 if [ $# != 2 ]; then | 34 if [ $# != 2 ]; then |
39 echo "compare_directories requires exactly 2 parameters, got $#" | 35 echo "compare_directories requires exactly 2 parameters, got $#" |
40 exit 1 | 36 exit 1 |
(...skipping 25 matching lines...) Expand all Loading... |
66 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 62 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
67 | 63 |
68 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 64 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
69 } | 65 } |
70 | 66 |
71 # Download a subset of the raw bench data for platform $1 at revision $2. | 67 # Download a subset of the raw bench data for platform $1 at revision $2. |
72 # (For the subset, download all files matching any of the suffixes in | 68 # (For the subset, download all files matching any of the suffixes in |
73 # whitespace-separated list $3.) | 69 # whitespace-separated list $3.) |
74 # If any of those files already exist locally, we assume that they are | 70 # If any of those files already exist locally, we assume that they are |
75 # correct and up to date, and we don't download them again. | 71 # correct and up to date, and we don't download them again. |
76 function benchgraph_download_rawdata { | 72 function download_bench_rawdata { |
77 if [ $# != 3 ]; then | 73 if [ $# != 3 ]; then |
78 echo "benchgraph_download_rawdata requires exactly 3 parameters, got $#" | 74 echo "download_bench_rawdata requires exactly 3 parameters, got $#" |
79 exit 1 | 75 exit 1 |
80 fi | 76 fi |
81 PLATFORM="$1" | 77 PLATFORM="$1" |
82 REV="$2" | 78 REV="$2" |
83 FILE_SUFFIXES="$3" | 79 FILE_SUFFIXES="$3" |
84 | 80 |
85 PLATFORM_DIR="tools/tests/benchgraphs/$PLATFORM" | 81 PLATFORM_DIR="tools/tests/benchalerts/$PLATFORM" |
86 RAW_BENCH_DATA_DIR="$PLATFORM_DIR/raw-bench-data" | 82 RAW_BENCH_DATA_DIR="$PLATFORM_DIR/raw-bench-data" |
87 mkdir -p $RAW_BENCH_DATA_DIR | 83 mkdir -p $RAW_BENCH_DATA_DIR |
88 | 84 |
89 for FILE_SUFFIX in $FILE_SUFFIXES; do | 85 for FILE_SUFFIX in $FILE_SUFFIXES; do |
90 FILE=bench_r${REV}_${FILE_SUFFIX} | 86 FILE=bench_${REV}_${FILE_SUFFIX} |
91 DESTFILE=$RAW_BENCH_DATA_DIR/$FILE | 87 DESTFILE=$RAW_BENCH_DATA_DIR/$FILE |
92 if [ ! -f $DESTFILE ]; | 88 if [ ! -f $DESTFILE ]; |
93 then | 89 then |
94 URL=http://chromium-skia-gm.commondatastorage.googleapis.com/playback/perf
data/${PLATFORM}/data/${FILE} | 90 URL=http://chromium-skia-gm.commondatastorage.googleapis.com/perfdata/${PL
ATFORM}/${FILE} |
95 echo Downloading $URL ... | 91 echo Downloading $URL ... |
96 curl $URL --output $DESTFILE | 92 curl $URL --output $DESTFILE |
97 fi | 93 fi |
98 done | 94 done |
99 } | 95 } |
100 | 96 |
101 # Run bench_graph_svg.py across the data from platform $1, | 97 # Run check_bench_regressions.py across the data from platform $1, |
102 # writing its output to output-actual and comparing those results against | 98 # writing its output to output-actual and comparing those results against |
103 # output-expected. | 99 # output-expected. |
104 function benchgraph_test { | 100 function benchalert_test { |
105 if [ $# != 1 ]; then | 101 if [ $# != 2 ]; then |
106 echo "benchgraph_test requires exactly 1 parameter, got $#" | 102 echo "benchalert_test requires exactly 2 parameter, got $#" |
107 exit 1 | 103 exit 1 |
108 fi | 104 fi |
109 PLATFORM="$1" | 105 PLATFORM="$1" |
| 106 REVISION="$2" |
110 | 107 |
111 PLATFORM_DIR="tools/tests/benchgraphs/$PLATFORM" | 108 PLATFORM_DIR="tools/tests/benchalerts/$PLATFORM" |
112 RAW_BENCH_DATA_DIR="$PLATFORM_DIR/raw-bench-data" | 109 RAW_BENCH_DATA_DIR="$PLATFORM_DIR/raw-bench-data" |
113 ACTUAL_OUTPUT_DIR="$PLATFORM_DIR/output-actual" | 110 ACTUAL_OUTPUT_DIR="$PLATFORM_DIR/output-actual" |
114 EXPECTED_OUTPUT_DIR="$PLATFORM_DIR/output-expected" | 111 EXPECTED_OUTPUT_DIR="$PLATFORM_DIR/output-expected" |
115 | 112 |
116 # Run bench_graph_svg.py . | 113 # Run check_bench_regressions.py . |
117 rm -rf $ACTUAL_OUTPUT_DIR | 114 rm -rf $ACTUAL_OUTPUT_DIR |
118 mkdir -p $ACTUAL_OUTPUT_DIR | 115 mkdir -p $ACTUAL_OUTPUT_DIR |
119 COMMAND="python bench/bench_graph_svg.py -d $RAW_BENCH_DATA_DIR -r -150 -f -15
0 -x 1024 -y 768 -l Title -m 25th -o $ACTUAL_OUTPUT_DIR/graph.xhtml" | 116 COMMAND="python bench/check_bench_regressions.py -a 25th -b $PLATFORM -d $RAW_
BENCH_DATA_DIR -e $PLATFORM_DIR/expectations.txt -r $REVISION" |
120 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line | 117 echo "$COMMAND" >$ACTUAL_OUTPUT_DIR/command_line |
121 START_TIMESTAMP=$(date +%s) | 118 START_TIMESTAMP=$(date +%s) |
122 $COMMAND &>$ACTUAL_OUTPUT_DIR/stdout | 119 $COMMAND 2>$ACTUAL_OUTPUT_DIR/stderr |
123 echo $? >$ACTUAL_OUTPUT_DIR/return_value | 120 echo $? >$ACTUAL_OUTPUT_DIR/return_value |
124 END_TIMESTAMP=$(date +%s) | 121 END_TIMESTAMP=$(date +%s) |
125 | 122 |
126 SECONDS_RUN=$(expr $END_TIMESTAMP - $START_TIMESTAMP) | 123 SECONDS_RUN=$(expr $END_TIMESTAMP - $START_TIMESTAMP) |
127 echo "bench_graph_svg.py for $PLATFORM took $SECONDS_RUN seconds to complete" | 124 echo "check_bench_regressions.py took $SECONDS_RUN seconds to complete" |
128 | 125 |
129 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR | 126 compare_directories $EXPECTED_OUTPUT_DIR $ACTUAL_OUTPUT_DIR |
130 } | 127 } |
131 | 128 |
132 # Test rebaseline.py's JSON-format expectations rebaselining capability. | 129 # Test rebaseline.py's JSON-format expectations rebaselining capability. |
133 # | 130 # |
134 # Copy expected-results.json files from $1 into a dir where they can be modified
. | 131 # Copy expected-results.json files from $1 into a dir where they can be modified
. |
135 # Run rebaseline.py with arguments in $2, recording its output. | 132 # Run rebaseline.py with arguments in $2, recording its output. |
136 # Then compare the output (and modified expected-results.json files) to the | 133 # Then compare the output (and modified expected-results.json files) to the |
137 # content of $2/output-expected. | 134 # content of $2/output-expected. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 # - don't generate HTML output files | 199 # - don't generate HTML output files |
203 skdiff_test "--failonresult DifferentPixels --failonresult DifferentSizes --fail
onresult Unknown --failonstatus CouldNotDecode,CouldNotRead any --failonstatus a
ny CouldNotDecode,CouldNotRead --listfilenames --nodiffs $SKDIFF_TESTDIR/baseDir
$SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/test2" | 200 skdiff_test "--failonresult DifferentPixels --failonresult DifferentSizes --fail
onresult Unknown --failonstatus CouldNotDecode,CouldNotRead any --failonstatus a
ny CouldNotDecode,CouldNotRead --listfilenames --nodiffs $SKDIFF_TESTDIR/baseDir
$SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/test2" |
204 | 201 |
205 # Run skdiff over just the files that have identical bits. | 202 # Run skdiff over just the files that have identical bits. |
206 skdiff_test "--nodiffs --match identical-bits $SKDIFF_TESTDIR/baseDir $SKDIFF_TE
STDIR/comparisonDir" "$SKDIFF_TESTDIR/identical-bits" | 203 skdiff_test "--nodiffs --match identical-bits $SKDIFF_TESTDIR/baseDir $SKDIFF_TE
STDIR/comparisonDir" "$SKDIFF_TESTDIR/identical-bits" |
207 | 204 |
208 # Run skdiff over just the files that have identical bits or identical pixels. | 205 # Run skdiff over just the files that have identical bits or identical pixels. |
209 skdiff_test "--nodiffs --match identical-bits --match identical-pixels $SKDIFF_T
ESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/identical-bits-or
-pixels" | 206 skdiff_test "--nodiffs --match identical-bits --match identical-pixels $SKDIFF_T
ESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir" "$SKDIFF_TESTDIR/identical-bits-or
-pixels" |
210 | 207 |
211 # | 208 # |
212 # Run benchgraph tests... | 209 # Run bench alerts tests... |
213 # | 210 # |
214 | 211 |
215 # Parse a collection of bench data leading up to | 212 # Parse a collection of bench data |
216 # http://70.32.156.53:10117/builders/Skia_Shuttle_Ubuntu12_ATI5770_Float_Bench_3
2/builds/878/steps/GenerateWebpagePictureBenchGraphs/logs/stdio | 213 PLATFORM=Perf-Android-Nexus7-Tegra3-Arm7-Release |
217 # (this was during the period when the bench data included a ton of per-tile, | 214 REVISION=69c9e1a7261a3c8361e2b2c109d6340862149e34 |
218 # per-iteration data) | 215 download_bench_rawdata $PLATFORM $REVISION "$BENCHDATA_FILE_SUFFIXES_NO_INDIVIDU
AL_TILES" |
219 PLATFORM=Skia_Shuttle_Ubuntu12_ATI5770_Float_Bench_32 | 216 download_bench_rawdata $PLATFORM $REVISION "$BENCHDATA_FILE_SUFFIXES_YES_INDIVID
UAL_TILES" |
220 benchgraph_download_rawdata $PLATFORM 7618 "$BENCHDATA_FILE_SUFFIXES_NO_INDIVIDU
AL_TILES" | 217 benchalert_test $PLATFORM $REVISION |
221 benchgraph_download_rawdata $PLATFORM 7671 "$BENCHDATA_FILE_SUFFIXES_YES_INDIVID
UAL_TILES" | |
222 benchgraph_download_rawdata $PLATFORM 7679 "$BENCHDATA_FILE_SUFFIXES_YES_INDIVID
UAL_TILES" | |
223 benchgraph_download_rawdata $PLATFORM 7686 "$BENCHDATA_FILE_SUFFIXES_YES_INDIVID
UAL_TILES" | |
224 #TODO(bensong): fixes this test. | |
225 #benchgraph_test $PLATFORM | |
226 | 218 |
227 # | 219 # |
228 # Run self test for skimage ... | 220 # Run self test for skimage ... |
229 # | 221 # |
230 | 222 |
231 COMMAND="python tools/tests/skimage_self_test.py" | 223 COMMAND="python tools/tests/skimage_self_test.py" |
232 echo "$COMMAND" | 224 echo "$COMMAND" |
233 $COMMAND | 225 $COMMAND |
234 ret=$? | 226 ret=$? |
235 if [ $ret -ne 0 ]; then | 227 if [ $ret -ne 0 ]; then |
(...skipping 14 matching lines...) Expand all Loading... |
250 # | 242 # |
251 # Test jsondiff.py ... | 243 # Test jsondiff.py ... |
252 # | 244 # |
253 | 245 |
254 JSONDIFF_INPUT=tools/tests/jsondiff/input | 246 JSONDIFF_INPUT=tools/tests/jsondiff/input |
255 JSONDIFF_OUTPUT=tools/tests/jsondiff/output | 247 JSONDIFF_OUTPUT=tools/tests/jsondiff/output |
256 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT
PUT/old-vs-new" | 248 jsondiff_test "$JSONDIFF_INPUT/old.json $JSONDIFF_INPUT/new.json" "$JSONDIFF_OUT
PUT/old-vs-new" |
257 | 249 |
258 | 250 |
259 echo "All tests passed." | 251 echo "All tests passed." |
OLD | NEW |