...
 
Commits (15)
......@@ -18,5 +18,5 @@
bin_PROGRAMS += gnome-desktop-testing-runner
gnome_desktop_testing_runner_SOURCES = src/gnome-desktop-testing-runner.c
gnome_desktop_testing_runner_CPPFLAGS = $(AM_CPPFLAGS)
gnome_desktop_testing_runner_CFLAGS = $(BUILDDEP_GDT_CFLAGS) $(SYSTEMD_JOURNAL_CFLAGS)
gnome_desktop_testing_runner_LDADD = $(BUILDDEP_GDT_LIBS) $(SYSTEMD_JOURNAL_LIBS)
gnome_desktop_testing_runner_CFLAGS = $(BUILDDEP_GDT_CFLAGS)
gnome_desktop_testing_runner_LDADD = $(BUILDDEP_GDT_LIBS)
AC_PREREQ([2.63])
AC_INIT([gnome-desktop-testing], [2016.1], [walters@verbum.org], [gnome-desktop-testing], [https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests/])
AC_INIT([gnome-desktop-testing], [2018.1], [walters@verbum.org], [gnome-desktop-testing], [https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests/])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
......@@ -27,20 +27,9 @@ AC_SUBST(WARN_CFLAGS)
LT_PREREQ([2.2.4])
LT_INIT([disable-static])
PKG_CHECK_MODULES(BUILDDEP_GDT, [gio-unix-2.0 >= 2.34.0 libgsystem])
PKG_CHECK_MODULES(BUILDDEP_GDT, [gio-unix-2.0 >= 2.34.0 libsystemd])
GIO_UNIX_CFLAGS="$GIO_UNIX_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36"
AC_ARG_WITH(systemd-journal,
AS_HELP_STRING([--without-systemd-journal], [Use systemd @<:@default=auto@:>@]),
[], [with_systemd_journal=auto])
AS_IF([test x$with_systemd_journal != xno], [
PKG_CHECK_MODULES([SYSTEMD_JOURNAL], [libsystemd], have_systemd_journal=yes, have_systemd_journal=no)
])
AM_CONDITIONAL(ENABLE_SYSTEMD_JOURNAL, test x$have_systemd_journal = xyes)
AS_IF([test x$have_systemd_journal = xyes], [
AC_DEFINE([ENABLE_SYSTEMD_JOURNAL],[1],[Define if you want to build with systemd journal support])
])
AC_CONFIG_FILES([
Makefile
])
......
gnome-desktop-testing (2016.1-3) UNRELEASED; urgency=medium
gnome-desktop-testing (2018.1-1) unstable; urgency=medium
* Team upload
[ Jeremy Bicha ]
* Update Vcs fields for migration to https://salsa.debian.org/
-- Jeremy Bicha <jbicha@debian.org> Fri, 19 Jan 2018 20:11:18 -0500
[ Simon McVittie ]
* New upstream release
* d/p/Factor-out-test_log-to-wrap-sd_journal_send.patch,
d/p/Output-messages-by-default-if-stdout-is-not-the-Journal.patch,
d/p/Make-libsystemd-optional-again.patch,
d/p/Add-a-TAP-output-mode.patch:
Add patches from upstream git to re-introduce portability to
non-Linux systems (and add a --tap option)
* Bump Standards-Version to 4.1.4
* Remove dependency on libgsystem, no longer required
* Use debhelper 11
* Drop obsolete build-dependency on libgirepository1.0-dev
-- Simon McVittie <smcv@debian.org> Tue, 15 May 2018 12:50:13 +0100
gnome-desktop-testing (2016.1-2) unstable; urgency=medium
......
# This file is autogenerated. DO NOT EDIT!
#
#
# Modifications should be made to debian/control.in instead.
# This file is regenerated automatically in the clean target.
Source: gnome-desktop-testing
......@@ -7,13 +7,11 @@ Section: gnome
Priority: optional
Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Uploaders: Iain Lane <laney@debian.org>, Jeremy Bicha <jbicha@debian.org>
Build-Depends: debhelper (>= 10),
Build-Depends: debhelper (>= 11~),
gnome-pkg-tools (>= 0.6),
libgirepository1.0-dev,
libglib2.0-dev (>= 2.34.0),
libgsystem-dev,
libsystemd-dev [linux-any],
Standards-Version: 4.1.2
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/gnome-team/gnome-desktop-testing
Vcs-Git: https://salsa.debian.org/gnome-team/gnome-desktop-testing.git
Homepage: https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests
......
......@@ -3,13 +3,11 @@ Section: gnome
Priority: optional
Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Uploaders: @GNOME_TEAM@
Build-Depends: debhelper (>= 10),
Build-Depends: debhelper (>= 11~),
gnome-pkg-tools (>= 0.6),
libgirepository1.0-dev,
libglib2.0-dev (>= 2.34.0),
libgsystem-dev,
libsystemd-dev [linux-any],
Standards-Version: 4.1.2
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/gnome-team/gnome-desktop-testing
Vcs-Git: https://salsa.debian.org/gnome-team/gnome-desktop-testing.git
Homepage: https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests
......
......@@ -3,7 +3,9 @@ Upstream-Name: gnome-desktop-testing
Source: https://download.gnome.org/sources/gnome-desktop-testing/
Files: *
Copyright: 2011-2013 Colin Walters <walters@verbum.org>
Copyright:
2009 Codethink Limited
2011-2013 Colin Walters <walters@verbum.org>
License: LGPL-2+
Files: debian/*
......
From: Simon McVittie <smcv@debian.org>
Date: Thu, 21 Dec 2017 17:18:03 +0000
Subject: Add a TAP output mode
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788470
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Applied-upstream: 2018.2, commit:5fbc6024220496f7f48470bcf017632e05ad400a
---
src/gnome-desktop-testing-runner.c | 130 ++++++++++++++++++++++++++++++++++++-
1 file changed, 127 insertions(+), 3 deletions(-)
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index 5e53511..03d94af 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -1,6 +1,7 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
+ * Copyright (C) 2009 Codethink Limited
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,6 +23,9 @@
#include "config.h"
#include <gio/gio.h>
+
+#include <unistd.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -68,6 +72,7 @@ static const char * const test_log_message_ids[] = {
};
static gboolean opt_quiet = FALSE;
+static gboolean opt_tap = FALSE;
static void
test_log (TestLog what,
@@ -105,13 +110,109 @@ test_log (TestLog what,
g_printerr ("%s: %s\n", msgid, message);
#endif
- if (!opt_quiet)
+ if (opt_tap)
+ {
+ switch (what)
+ {
+ default:
+ /* fall through */
+ case TEST_LOG_RUNNING_STATUS:
+ /* fall through */
+ case TEST_LOG_COMPLETE:
+ g_print ("# %s\n", message);
+ break;
+
+ case TEST_LOG_ONE_FAILED:
+ g_print ("# %s\n", message);
+ g_print ("not ok - %s\n", test_name);
+ break;
+
+ case TEST_LOG_ONE_SKIPPED:
+ g_print ("ok # SKIP - %s\n", test_name);
+ break;
+
+ case TEST_LOG_ONE_SUCCESS:
+ g_print ("ok - %s\n", test_name);
+ break;
+
+ case TEST_LOG_ONE_TIMED_OUT:
+ g_print ("not ok - %s\n", message);
+ break;
+
+ case TEST_LOG_EXCEPTION:
+ g_print ("Bail out! %s\n", message);
+ break;
+
+ case TEST_LOG_ARBITRARY:
+ /* do nothing, just print to the Journal */
+ break;
+ }
+ }
+ else if (!opt_quiet)
{
if (what != TEST_LOG_ARBITRARY)
g_print ("%s\n", message);
}
}
+/* Taken from gio/gunixfdlist.c */
+static int
+dup_close_on_exec_fd (gint fd,
+ GError **error)
+{
+ gint new_fd;
+ gint s;
+
+#ifdef F_DUPFD_CLOEXEC
+ do
+ new_fd = fcntl (fd, F_DUPFD_CLOEXEC, 0l);
+ while (new_fd < 0 && (errno == EINTR));
+
+ if (new_fd >= 0)
+ return new_fd;
+
+ /* if that didn't work (new libc/old kernel?), try it the other way. */
+#endif
+
+ do
+ new_fd = dup (fd);
+ while (new_fd < 0 && (errno == EINTR));
+
+ if (new_fd < 0)
+ {
+ int saved_errno = errno;
+
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (saved_errno),
+ "dup: %s", g_strerror (saved_errno));
+
+ return -1;
+ }
+
+ do
+ {
+ s = fcntl (new_fd, F_GETFD);
+
+ if (s >= 0)
+ s = fcntl (new_fd, F_SETFD, (long) (s | FD_CLOEXEC));
+ }
+ while (s < 0 && (errno == EINTR));
+
+ if (s < 0)
+ {
+ int saved_errno = errno;
+
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (saved_errno),
+ "fcntl: %s", g_strerror (saved_errno));
+ close (new_fd);
+
+ return -1;
+ }
+
+ return new_fd;
+}
+
static gboolean
rm_rf (GFile *path, GError **error)
{
@@ -303,6 +404,7 @@ static GOptionEntry options[] = {
{ "log-msgid", 0, 0, G_OPTION_ARG_STRING, &opt_log_msgid, "Log unique message with id MSGID=MESSAGE", "MSGID" },
{ "timeout", 't', 0, G_OPTION_ARG_INT, &opt_cancel_timeout, "Cancel test after timeout seconds; defaults to 5 minutes", "TIMEOUT" },
{ "quiet", 0, 0, G_OPTION_ARG_NONE, &opt_quiet, "Don't output test results", NULL },
+ { "tap", 0, 0, G_OPTION_ARG_NONE, &opt_tap, "Output test results as TAP", NULL },
{ NULL }
};
@@ -501,7 +603,7 @@ run_test_async (GdtrTest *test,
task = g_task_new (test, cancellable, callback, user_data);
- g_print ("Running test: %s\n", test->name);
+ g_print ("%sRunning test: %s\n", opt_tap ? "# " : "", test->name);
test_squashed_name = g_regex_replace_literal (slash_regex, test->name, -1,
0, "_", 0, NULL);
@@ -548,6 +650,20 @@ run_test_async (GdtrTest *test,
if (opt_report_directory || opt_log_directory)
flags |= G_SUBPROCESS_FLAGS_STDERR_MERGE;
proc_context = g_subprocess_launcher_new (flags);
+
+ if (opt_tap && !(opt_report_directory || opt_log_directory))
+ {
+ /* We can't put the test's output on our stdout, or it'd be
+ * misinterpreted as our structured TAP output. Put it on our
+ * stderr instead */
+ int copy_of_stderr;
+
+ copy_of_stderr = dup_close_on_exec_fd (STDERR_FILENO, error);
+ if (copy_of_stderr < 0)
+ goto out;
+ g_subprocess_launcher_take_stdout_fd (proc_context, copy_of_stderr);
+ }
+
g_subprocess_launcher_set_cwd (proc_context, test_tmpdir);
g_subprocess_launcher_set_environ (proc_context, test->envp);
if (opt_report_directory)
@@ -840,6 +956,14 @@ main (int argc, char **argv)
{
gboolean show_status;
+ if (opt_tap)
+ {
+ if (total_tests == 0)
+ g_print ("1..0 # SKIP - nothing to do\n");
+ else
+ g_print ("1..%d\n", total_tests);
+ }
+
fisher_yates_shuffle (app->tests);
reschedule_tests (app->cancellable);
@@ -921,7 +1045,7 @@ main (int argc, char **argv)
NULL);
for (i = 0; i < app->failed_test_msgs->len; i++)
- g_print ("%s\n", (char *) app->failed_test_msgs->pdata[i]);
+ g_print ("%s%s\n", opt_tap ? "# " : "", (char *) app->failed_test_msgs->pdata[i]);
}
g_clear_pointer (&app->pending_tests, g_hash_table_unref);
g_clear_pointer (&app->tests, g_ptr_array_unref);
From: Simon McVittie <smcv@debian.org>
Date: Thu, 9 Nov 2017 13:26:11 +0000
Subject: Factor out test_log() to wrap sd_journal_send
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788470
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Applied-upstream: 2018.2, commit:0447403f6c8e7c8602123aef237d368437414002
---
src/gnome-desktop-testing-runner.c | 111 ++++++++++++++++++++++++++-----------
1 file changed, 79 insertions(+), 32 deletions(-)
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index 07148ca..fa1168f 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -30,6 +30,7 @@
#include <systemd/sd-journal.h>
#define TEST_SKIP_ECODE 77
+
#define TEST_RUNNING_STATUS_MSGID "ed6199045dd38bb5321e551d9578f3d9"
#define TESTS_COMPLETE_MSGID "4d013788dd704743b826436c951e551d"
#define ONE_TEST_FAILED_MSGID "0eee66bf98514369bef9868327a43cf1"
@@ -37,6 +38,63 @@
#define ONE_TEST_SUCCESS_MSGID "142bf5d40e9742e99d3ac8c1ace83b36"
#define ONE_TEST_TIMED_OUT_MSGID "db8f25eab14a4da68ef3ab3ce4b2c0bb"
+/* Types of test_log() call */
+typedef enum {
+ TEST_LOG_RUNNING_STATUS,
+ TEST_LOG_COMPLETE,
+ TEST_LOG_ONE_FAILED,
+ TEST_LOG_ONE_SKIPPED,
+ TEST_LOG_ONE_SUCCESS,
+ TEST_LOG_ONE_TIMED_OUT,
+ TEST_LOG_EXCEPTION,
+ TEST_LOG_ARBITRARY,
+} TestLog;
+
+/* Message IDs used for test_log() calls */
+static const char * const test_log_message_ids[] = {
+ [TEST_LOG_RUNNING_STATUS] = TEST_RUNNING_STATUS_MSGID,
+ [TEST_LOG_COMPLETE] = TESTS_COMPLETE_MSGID,
+ [TEST_LOG_ONE_FAILED] = ONE_TEST_FAILED_MSGID,
+ [TEST_LOG_ONE_SKIPPED] = ONE_TEST_SKIPPED_MSGID,
+ [TEST_LOG_ONE_SUCCESS] = ONE_TEST_SUCCESS_MSGID,
+ [TEST_LOG_ONE_TIMED_OUT] = ONE_TEST_TIMED_OUT_MSGID,
+ /* Reusing ONE_TEST_FAILED_MSGID is not quite right, but whatever */
+ [TEST_LOG_EXCEPTION] = ONE_TEST_FAILED_MSGID,
+ /* Special-cased: the "test name" is really the message ID */
+ [TEST_LOG_ARBITRARY] = NULL,
+};
+
+static void
+test_log (TestLog what,
+ const char *test_name,
+ const char *format,
+ ...)
+{
+ const char *msgid = test_log_message_ids[what];
+ g_autofree char *message = NULL;
+ va_list ap;
+
+ if (what == TEST_LOG_ARBITRARY)
+ {
+ msgid = test_name;
+ test_name = NULL;
+ }
+
+ va_start (ap, format);
+ message = g_strdup_vprintf (format, ap);
+ va_end (ap);
+
+ if (test_name)
+ sd_journal_send ("MESSAGE_ID=%s", msgid,
+ "GDTR_TEST=%s", test_name,
+ "MESSAGE=%s", message,
+ NULL);
+ else
+ sd_journal_send ("MESSAGE_ID=%s", msgid,
+ "MESSAGE=%s", message,
+ NULL);
+}
+
static gboolean
rm_rf (GFile *path, GError **error)
{
@@ -299,31 +357,25 @@ log_test_completion (GdtrTest *test,
const char *reason)
{
const char *msgid_value;
- g_autofree char *msg = NULL;
if (test->state == TEST_STATE_COMPLETE_SUCCESS)
{
- msgid_value = ONE_TEST_SUCCESS_MSGID;
- msg = g_strconcat ("PASS: ", test->name, NULL);
+ test_log (TEST_LOG_ONE_SUCCESS, test->name, "PASS: %s", test->name);
}
else if (test->state == TEST_STATE_COMPLETE_FAILED)
{
- msgid_value = ONE_TEST_FAILED_MSGID;
- msg = g_strconcat ("FAIL: ", test->name, " (", reason, ")", NULL);
+ g_autofree char *msg = g_strconcat ("FAIL: ", test->name, " (", reason,
+ ")", NULL);
+
+ test_log (TEST_LOG_ONE_FAILED, test->name, "%s", msg);
g_ptr_array_add (app->failed_test_msgs, g_strdup (msg));
}
else if (test->state == TEST_STATE_COMPLETE_SKIPPED)
{
- msgid_value = ONE_TEST_SKIPPED_MSGID;
- msg = g_strconcat ("SKIP: ", test->name, NULL);
+ test_log (TEST_LOG_ONE_SKIPPED, test->name, "SKIP: %s", test->name);
}
else
g_assert_not_reached ();
-
- sd_journal_send ("MESSAGE_ID=%s", msgid_value,
- "GDTR_TEST=%s", test->name,
- "MESSAGE=%s", msg,
- NULL);
}
static void
@@ -397,10 +449,8 @@ cancel_test (gpointer data)
{
GSubprocess*proc = data;
g_subprocess_force_exit (proc);
- sd_journal_send ("MESSAGE_ID=%s", ONE_TEST_TIMED_OUT_MSGID,
- "MESSAGE=Test timed out after %u seconds",
- opt_cancel_timeout,
- NULL);
+ test_log (TEST_LOG_ONE_TIMED_OUT, NULL, "Test timed out after %u seconds",
+ opt_cancel_timeout);
return FALSE;
}
@@ -592,10 +642,8 @@ idle_output_status (gpointer data)
first = FALSE;
g_string_append (status_str, test->name);
}
- sd_journal_send ("MESSAGE_ID=%s", TEST_RUNNING_STATUS_MSGID,
- "MESSAGE=%s", status_str->str,
- NULL);
+ test_log (TEST_LOG_RUNNING_STATUS, NULL, "%s", status_str->str);
return TRUE;
}
@@ -694,9 +742,8 @@ main (int argc, char **argv)
g_autofree char *msgid = NULL;
g_assert (eq);
msgid = g_strndup (opt_log_msgid, eq - opt_log_msgid);
- sd_journal_send ("MESSAGE_ID=%s", msgid,
- "MESSAGE=%s", eq + 1,
- NULL);
+
+ test_log (TEST_LOG_ARBITRARY, msgid, "%s", eq + 1);
exit (0);
}
@@ -805,10 +852,9 @@ main (int argc, char **argv)
if (!ret)
{
g_assert (local_error);
- /* Reusing ONE_TEST_FAILED_MSGID is not quite right, but whatever */
- sd_journal_send ("MESSAGE_ID=%s", ONE_TEST_FAILED_MSGID,
- "MESSAGE=Caught exception during testing: %s", local_error->message,
- NULL);
+ test_log (TEST_LOG_EXCEPTION, NULL,
+ "Caught exception during testing: %s",
+ local_error->message);
g_clear_error (&local_error);
}
if (!opt_list)
@@ -844,12 +890,13 @@ main (int argc, char **argv)
child_rusage.ru_maxrss);
}
- sd_journal_send ("MESSAGE_ID=%s", TESTS_COMPLETE_MSGID,
- "MESSAGE=SUMMARY%s: total=%u; passed=%d; skipped=%d; failed=%d%s",
- ret ? "" : " (incomplete)",
- total_tests, n_passed, n_skipped, n_failed,
- rusage_str != NULL ? rusage_str : "",
- NULL);
+ test_log (TEST_LOG_COMPLETE, NULL,
+ "SUMMARY%s: total=%u; passed=%d; skipped=%d; failed=%d%s",
+ ret ? "" : " (incomplete)",
+ total_tests, n_passed, n_skipped, n_failed,
+ rusage_str != NULL ? rusage_str : "",
+ NULL);
+
for (i = 0; i < app->failed_test_msgs->len; i++)
g_print ("%s\n", (char *) app->failed_test_msgs->pdata[i]);
}
From: Simon McVittie <smcv@debian.org>
Date: Thu, 21 Dec 2017 17:30:32 +0000
Subject: Make libsystemd optional again
As much as I'd like to stop supporting non-systemd Linux systems, some
people get very upset by the suggestion that systemd is mandatory on
Linux, and it isn't portable to non-Linux in any case.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788470
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Applied-upstream: 2018.2, commit:802cfd283372a1ae3a5d91afe84afb2cbf89912e
---
Makefile-tests.am | 4 ++--
configure.ac | 4 +++-
src/gnome-desktop-testing-runner.c | 9 +++++++++
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Makefile-tests.am b/Makefile-tests.am
index 02585f1..f91c13d 100644
--- a/Makefile-tests.am
+++ b/Makefile-tests.am
@@ -18,5 +18,5 @@
bin_PROGRAMS += gnome-desktop-testing-runner
gnome_desktop_testing_runner_SOURCES = src/gnome-desktop-testing-runner.c
gnome_desktop_testing_runner_CPPFLAGS = $(AM_CPPFLAGS)
-gnome_desktop_testing_runner_CFLAGS = $(BUILDDEP_GDT_CFLAGS)
-gnome_desktop_testing_runner_LDADD = $(BUILDDEP_GDT_LIBS)
+gnome_desktop_testing_runner_CFLAGS = $(BUILDDEP_GDT_CFLAGS) $(SYSTEMD_CFLAGS)
+gnome_desktop_testing_runner_LDADD = $(BUILDDEP_GDT_LIBS) $(SYSTEMD_LIBS)
diff --git a/configure.ac b/configure.ac
index 7718329..82dc535 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,9 @@ AC_SUBST(WARN_CFLAGS)
LT_PREREQ([2.2.4])
LT_INIT([disable-static])
-PKG_CHECK_MODULES(BUILDDEP_GDT, [gio-unix-2.0 >= 2.34.0 libsystemd])
+PKG_CHECK_MODULES(BUILDDEP_GDT, [gio-unix-2.0 >= 2.34.0])
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no])
+AS_IF([test "x$have_systemd" = xyes], [AC_DEFINE([HAVE_SYSTEMD], [1], [Define if you have libsystemd])])
GIO_UNIX_CFLAGS="$GIO_UNIX_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36"
AC_CONFIG_FILES([
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index 62e5d5e..5e53511 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -27,7 +27,10 @@
#include <errno.h>
#include <sys/time.h>
#include <sys/resource.h>
+
+#ifdef HAVE_SYSTEMD
#include <systemd/sd-journal.h>
+#endif
#define TEST_SKIP_ECODE 77
@@ -86,6 +89,7 @@ test_log (TestLog what,
message = g_strdup_vprintf (format, ap);
va_end (ap);
+#ifdef HAVE_SYSTEMD
if (test_name)
sd_journal_send ("MESSAGE_ID=%s", msgid,
"GDTR_TEST=%s", test_name,
@@ -95,6 +99,11 @@ test_log (TestLog what,
sd_journal_send ("MESSAGE_ID=%s", msgid,
"MESSAGE=%s", message,
NULL);
+#else
+ /* we can't log this to the Journal, so do *something* with it */
+ if (what == TEST_LOG_ARBITRARY)
+ g_printerr ("%s: %s\n", msgid, message);
+#endif
if (!opt_quiet)
{
From: Simon McVittie <smcv@debian.org>
Date: Thu, 21 Dec 2017 16:27:20 +0000
Subject: Output messages by default if stdout is not the Journal
Otherwise the change in behaviour since 2016.1 would be a regression.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788470
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Applied-upstream: 2018.2, commit:cd78f8f946822f29a71e7acedc4d3db6b5e43730
---
src/gnome-desktop-testing-runner.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index fa1168f..62e5d5e 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -64,6 +64,8 @@ static const char * const test_log_message_ids[] = {
[TEST_LOG_ARBITRARY] = NULL,
};
+static gboolean opt_quiet = FALSE;
+
static void
test_log (TestLog what,
const char *test_name,
@@ -93,6 +95,12 @@ test_log (TestLog what,
sd_journal_send ("MESSAGE_ID=%s", msgid,
"MESSAGE=%s", message,
NULL);
+
+ if (!opt_quiet)
+ {
+ if (what != TEST_LOG_ARBITRARY)
+ g_print ("%s\n", message);
+ }
}
static gboolean
@@ -285,6 +293,7 @@ static GOptionEntry options[] = {
{ "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" },
{ "timeout", 't', 0, G_OPTION_ARG_INT, &opt_cancel_timeout, "Cancel test after timeout seconds; defaults to 5 minutes", "TIMEOUT" },
+ { "quiet", 0, 0, G_OPTION_ARG_NONE, &opt_quiet, "Don't output test results", NULL },
{ NULL }
};
@@ -727,6 +736,11 @@ main (int argc, char **argv)
/* avoid gvfs (http://bugzilla.gnome.org/show_bug.cgi?id=526454) */
g_setenv ("GIO_USE_VFS", "local", TRUE);
+ /* There's no point in logging to the Journal every time we log to
+ * the Journal */
+ if (g_log_writer_is_journald (STDOUT_FILENO))
+ opt_quiet = TRUE;
+
context = g_option_context_new ("[PREFIX...] - Run installed tests");
g_option_context_add_main_entries (context, options, NULL);
Factor-out-test_log-to-wrap-sd_journal_send.patch
Output-messages-by-default-if-stdout-is-not-the-Journal.patch
Make-libsystemd-optional-again.patch
Add-a-TAP-output-mode.patch
This diff is collapsed.