Commit dbbbb606 authored by Saurav Sachidanand's avatar Saurav Sachidanand

Write test artifacts to tests/output

parent f1721032
......@@ -45,15 +45,11 @@ stages:
- ./autogen.sh --enable-gtk-doc --enable-vala
- make check
after_script:
- mkdir png_artifacts
- cp /tmp/*.png png_artifacts
artifacts:
when: on_failure
paths:
- tests/*.log
- png_artifacts
- tests/output/
cache:
# JOB_NAME - Each job will have it's own cache
......
......@@ -87,3 +87,6 @@ dist_installed_test_data = \
fixtures/styles/bug614643.svg \
fixtures/styles/bug418823.svg \
fixtures/styles/order.svg
clean-local:
rm -rf output
\ No newline at end of file
......@@ -94,8 +94,9 @@ If there are differences in the output, the test will fail; see
These files can go anywhere under the `fixtures/reftests`
directory; the `rsvg-test` program will recursively look inside
`fixtures/reftests` for all SVG files, render them, and compare them to
the `-ref.png` reference images.
`fixtures/reftests` for all SVG files, render them to `tests/output`, and
compare them to the `-ref.png` reference images. The rendered files can
later be removed by running `make clean`.
**Ignoring tests:** SVG test files or entire subdirectories in
`fixtures/reftests` whose names begin with "`ignore`" will be skipped from
......@@ -126,10 +127,10 @@ Let's say you run `make check` and see that one of the tests fails.
For example, `rsvg-test.log` may have lines that look like
```
# Storing test result image at /tmp/paths-data-18-f-out.png
# Storing test result image at tests/output/paths-data-18-f-out.png
# 6798 pixels differ (with maximum difference of 255) from reference image
# Storing test result image at /tmp/paths-data-18-f-diff.png
# Storing test result image at tests/output/paths-data-18-f-diff.png
not ok 29 /rsvg-test/reftests/svg1.1/paths-data-18-f.svg
FAIL: rsvg-test 29 /rsvg-test/reftests/svg1.1/paths-data-18-f.svg
```
......@@ -141,11 +142,11 @@ test file `fixtures/reftests/svg1.1/paths-data-18-f.svg` got rendered,
and produced incorrect output when compared to
`fixtures/reftests/svg1.1/paths-data-18-f-ref.png`.
When a test fails, rsvg-test creates two images in `/tmp`:
When a test fails, rsvg-test creates two images in `tests/output`:
```
/tmp/foo-out.png
/tmp/foo-diff.png
tests/output/foo-out.png
tests/output/foo-diff.png
```
In this case, `foo-out.png` is the actual rendered output, which is presumed to
......
......@@ -34,11 +34,14 @@
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>
#include "librsvg/rsvg.h"
#include "test-utils.h"
static char *_output_dir;
typedef struct _buffer_diff_result {
unsigned int pixels_changed;
unsigned int max_diff;
......@@ -138,11 +141,20 @@ compare_surfaces (cairo_surface_t *surface_a,
result->pixels_changed, result->max_diff);
}
static char *
get_output_dir (void) {
if (_output_dir == NULL) {
_output_dir = g_strconcat (g_get_current_dir (), G_DIR_SEPARATOR_S, "output", NULL);
g_mkdir (_output_dir, 0777);
}
return _output_dir;
}
static char *
get_output_file (const char *test_file,
const char *extension)
{
const char *output_dir = g_get_tmp_dir ();
const char *output_dir = get_output_dir ();
char *result, *base;
base = g_path_get_basename (test_file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment