Skip to content

Commit 6497cf7

Browse files
committed
cli: Don't rely on image generation for diff-image tests.
Use static images instead.
1 parent 8956eb5 commit 6497cf7

File tree

4 files changed

+4
-25
lines changed

4 files changed

+4
-25
lines changed

cli/cli-diff-images-mismatch.script

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
# The first two steps are just as in cli-diff-images. Dump images from
2-
# a trace into an empty directory.
3-
4-
rm_and_mkdir ./tri-out
5-
apitrace dump-images --call-nos=no -o ./tri-out/tri tri.trace
6-
7-
# Compare the dumped image with a doctored image to provoke a failure.
8-
# The EXPECT_FAILURE attribute causes the test driver to look for a
9-
# non-zero return value from apitrace and fail the test if it is not
10-
# seen.
11-
12-
EXPECT_FAILURE: apitrace diff-images -v ./tri-ref-mismatch ./tri-out
1+
EXPECT_FAILURE: apitrace diff-images --verbose images/white-1x1/ images/black-1x1/
132

143
# In addition to getting the return value indicating an error, let's
154
# also require that "apitrace diff-images" gave us the output we
165
# expect.
176

18-
expect "Comparing ./tri-ref-mismatch/tri0000000000.png and ./tri-out/tri0000000000.png ... MISMATCH\n"
7+
expect "Comparing images/white-1x1/0.png and images/black-1x1/0.png ... MISMATCH\n"

cli/cli-diff-images.script

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Make a directory for the output images
2-
3-
rm_and_mkdir ./tri-out
4-
5-
# Generate images for every frame (only 1) of a trace
6-
7-
apitrace dump-images --call-nos=no -o ./tri-out/tri tri.trace
8-
9-
# Compare the result of "apitrace dump-images" with our reference
10-
11-
apitrace diff-images -v ./tri-ref ./tri-out
1+
apitrace diff-images --verbose images/white-1x1/ images/white-1x1/
122

133
# Ensure that the "apitrace diff-images" actually did something. This
144
# is important since if it couldn't find images in one directory or
155
# the other then it would just silently return 0 and this test would
166
# incorrectly pass.
177

18-
expect "Comparing ./tri-ref/tri0000000000.png and ./tri-out/tri0000000000.png ... MATCH\n"
8+
expect "Comparing images/white-1x1/0.png and images/white-1x1/0.png ... MATCH\n"

cli/images/black-1x1/0.png

216 Bytes
Loading

cli/images/white-1x1/0.png

216 Bytes
Loading

0 commit comments

Comments
 (0)