[gnome-desktop-testing] Add a --log-directory option



commit bc7aa4477d02fbd7be26f3019c927938f9f53091
Author: Colin Walters <walters verbum org>
Date:   Tue Sep 26 21:07:57 2017 -0400

    Add a --log-directory option
    
    This contains just the test output (stdout/stderr), and is
    always generated even on success.  This is really what we want
    for libostree at least; see https://github.com/ostreedev/ostree/pull/1218

 src/gnome-desktop-testing-runner.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index dd2121a..a610748 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -211,6 +211,7 @@ static gboolean opt_list;
 static int opt_firstroot;
 static int opt_parallel = 1;
 static int opt_cancel_timeout = 5*60;
+static char * opt_log_directory;
 static char * opt_report_directory;
 static char **opt_dirs;
 static char *opt_status;
@@ -221,6 +222,7 @@ static GOptionEntry options[] = {
   { "list", 'l', 0, G_OPTION_ARG_NONE, &opt_list, "List matching tests", NULL },
   { "parallel", 'p', 0, G_OPTION_ARG_INT, &opt_parallel, "Specify parallelization to PROC processors; 0 will 
be dynamic)", "PROC" },
   { "first-root", 0, 0, G_OPTION_ARG_NONE, &opt_firstroot, "Only use first entry in XDG_DATA_DIRS", "PROC" },
+  { "log-directory", 'L', 0, G_OPTION_ARG_FILENAME, &opt_log_directory, "Create a subdirectory with test 
logs", "DIR" },
   { "report-directory", 0, 0, G_OPTION_ARG_FILENAME, &opt_report_directory, "Create a subdirectory per 
failing test in DIR", "DIR" },
   { "status", 0, 0, G_OPTION_ARG_STRING, &opt_status, "Output status information", "yes/no/auto" },
   { "log-msgid", 0, 0, G_OPTION_ARG_STRING, &opt_log_msgid, "Log unique message with id MSGID=MESSAGE", 
"MSGID" },
@@ -476,7 +478,7 @@ run_test_async (GdtrTest                *test,
   }
 
   GSubprocessFlags flags = G_SUBPROCESS_FLAGS_NONE;
-  if (opt_report_directory)
+  if (opt_report_directory || opt_log_directory)
     flags |= G_SUBPROCESS_FLAGS_STDERR_MERGE;
   proc_context = g_subprocess_launcher_new (flags);
   g_subprocess_launcher_set_cwd (proc_context, test_tmpdir);
@@ -487,6 +489,11 @@ run_test_async (GdtrTest                *test,
       g_autofree char *test_output_path = g_build_filename (test_tmpdir, test_output_filename, NULL);
       g_subprocess_launcher_set_stdout_file_path (proc_context, test_output_path);
     }
+  else if (opt_log_directory)
+    {
+      g_autofree char *test_output_path = g_strconcat (opt_log_directory, "/", test_squashed_name, ".txt", 
NULL);
+      g_subprocess_launcher_set_stdout_file_path (proc_context, test_output_path);
+    }
 
   proc = g_subprocess_launcher_spawnv (proc_context, (const char *const*)test->argv, error);
   if (!proc)


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