summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurav Sachidanand <sauravsachidanand@gmail.com>2018-05-30 23:41:51 +0530
committerSaurav Sachidanand <sauravsachidanand@gmail.com>2018-05-31 00:04:07 +0530
commitdbbbb606e54ea854ed676987b3963bdac958a687 (patch)
tree1072a5d483bafd8a764560b196fd614188db12e5
parentf17210327623f59d4b1fbec538850b145f2fc069 (diff)
downloadlibrsvg-dbbbb606e54ea854ed676987b3963bdac958a687.tar.gz
Write test artifacts to tests/output
-rw-r--r--.gitlab-ci.yml6
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/README.md15
-rw-r--r--tests/rsvg-test.c14
4 files changed, 25 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 03c2fa48..84414324 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6005eb2e..dde39443 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
diff --git a/tests/README.md b/tests/README.md
index b703b75c..3b03177b 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -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
diff --git a/tests/rsvg-test.c b/tests/rsvg-test.c
index 03456f48..1839e7ca 100644
--- a/tests/rsvg-test.c
+++ b/tests/rsvg-test.c
@@ -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;
@@ -139,10 +142,19 @@ compare_surfaces (cairo_surface_t *surface_a,
}
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);