[gnome-desktop/wip/hadess/ci-improvements: 4/8] tests: Output reftest output in meson-logs



commit 9a621065bdccff49c9effeeb742a4c4f64b76401
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 8 16:16:27 2019 +0100

    tests: Output reftest output in meson-logs
    
    So that failed tests can have their data exported via the CI.

 tests/wallclock-reftest.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/tests/wallclock-reftest.c b/tests/wallclock-reftest.c
index 6428ebe4..fe71b5a5 100644
--- a/tests/wallclock-reftest.c
+++ b/tests/wallclock-reftest.c
@@ -27,6 +27,8 @@
 #define GNOME_DESKTOP_USE_UNSTABLE_API 1
 #include <libgnome-desktop/gnome-wall-clock.h>
 
+static const char *output_dir = NULL;
+
 typedef enum {
   SNAPSHOT_WINDOW,
   SNAPSHOT_DRAW
@@ -39,14 +41,16 @@ static char *
 get_output_file (const char *test_file,
                  const char *extension)
 {
-  const char *output_dir = g_get_tmp_dir ();
   char *result, *base;
 
   base = g_path_get_basename (test_file);
   if (g_str_has_suffix (base, ".ui"))
     base[strlen (base) - strlen (".ui")] = '\0';
 
-  result = g_strconcat (output_dir, G_DIR_SEPARATOR_S, base, extension, NULL);
+  if (output_dir)
+    result = g_strconcat (output_dir, G_DIR_SEPARATOR_S, "..", G_DIR_SEPARATOR_S, "meson-logs", 
G_DIR_SEPARATOR_S, base, extension, NULL);
+  else
+    result = g_strconcat (g_get_tmp_dir (), G_DIR_SEPARATOR_S, base, extension, NULL);
   g_free (base);
 
   return result;
@@ -578,6 +582,7 @@ main (int argc, char **argv)
   basedir = g_getenv ("G_TEST_SRCDIR");
   if (basedir == NULL)
     basedir = INSTALLED_TEST_DIR;
+  output_dir = g_getenv ("G_TEST_BUILDDIR");
 
   file = g_file_new_for_commandline_arg (basedir);
   add_test_for_file (file, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]