[glib: 1/4] glib: Deprecate gtester and gtester-report
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/4] glib: Deprecate gtester and gtester-report
- Date: Fri, 17 May 2019 12:13:12 +0000 (UTC)
commit 662cddcb4b8dd756f9bef3280600bf3c315a15fd
Author: Philip Withnall <withnall endlessm com>
Date: Tue May 14 11:57:11 2019 +0100
glib: Deprecate gtester and gtester-report
Add warnings about their deprecation everywhere. The tools will continue
to work until we break API, but will be less well maintained. You should
use TAP for communicating test results to the test harness provided by
your build system or CI system instead.
Signed-off-by: Philip Withnall <withnall endlessm com>
Fixes: #1441
docs/reference/glib/glib-docs.xml | 4 ++++
docs/reference/glib/gtester-report.xml | 3 +++
docs/reference/glib/gtester.xml | 3 +++
glib/gtester-report.in | 11 +++++++++++
glib/gtester.c | 12 ++++++++++++
glib/gtestutils.c | 5 +++--
glib/tests/meson.build | 2 +-
7 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/glib/glib-docs.xml b/docs/reference/glib/glib-docs.xml
index 6d5c2ad4f..fa43eaff7 100644
--- a/docs/reference/glib/glib-docs.xml
+++ b/docs/reference/glib/glib-docs.xml
@@ -136,6 +136,10 @@
<chapter id="tools">
<title>GLib Tools</title>
<xi:include href="glib-gettextize.xml" />
+ </chapter>
+
+ <chapter id="deprecated-tools">
+ <title>Deprecated Tools</title>
<xi:include href="gtester.xml" />
<xi:include href="gtester-report.xml" />
</chapter>
diff --git a/docs/reference/glib/gtester-report.xml b/docs/reference/glib/gtester-report.xml
index 4fd0685c0..eee933784 100644
--- a/docs/reference/glib/gtester-report.xml
+++ b/docs/reference/glib/gtester-report.xml
@@ -35,6 +35,9 @@
<para><command>gtester-report</command> is a script which converts
the XML output generated by gtester into HTML.
</para>
+<para>Since GLib 2.62, <command>gtester-report</command> is deprecated. Use
+TAP for reporting test results instead, and feed it to the test harness provided
+by your build system.</para>
</refsect1>
<refsect1><title>Options</title>
diff --git a/docs/reference/glib/gtester.xml b/docs/reference/glib/gtester.xml
index b1c126bd9..5626d4df8 100644
--- a/docs/reference/glib/gtester.xml
+++ b/docs/reference/glib/gtester.xml
@@ -40,6 +40,9 @@
<para><command>gtester</command> is a utility to run unit tests that have
been written using the GLib test framework.
</para>
+<para>Since GLib 2.62, <command>gtester-report</command> is deprecated. Use
+TAP for reporting test results instead, and feed it to the test harness provided
+by your build system.</para>
<para>
When called with the <option>-o</option> option, <command>gtester</command>
writes an XML report of the test results, which can be converted
diff --git a/glib/gtester-report.in b/glib/gtester-report.in
index 01f6033f7..e5121f709 100644
--- a/glib/gtester-report.in
+++ b/glib/gtester-report.in
@@ -15,6 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
+# Deprecated: Since GLib 2.62, gtester and gtester-report have been deprecated
+# in favour of TAP.
+
import datetime
import optparse
import sys, re, xml.dom.minidom
@@ -343,6 +347,9 @@ class HTMLReportWriter(ReportWriter):
self.oprint ('<body>\n')
self.oprint ('<h2>GTester Unit Test Report</h2>\n')
self.handle_info ()
+ self.oprint ('<p style="color:red;font-weight:bold"><blink>'
+ 'Deprecated: Since GLib 2.62, gtester and gtester-report are '
+ 'deprecated. Port to TAP.</blink></p>\n');
self.oprint ('<table id="ResultTable" width="100%" border="1">\n<tr>\n')
self.oprint ('<th>Program / Testcase </th>\n')
self.oprint ('<th style="width:8em">Duration (sec)</th>\n')
@@ -474,6 +481,10 @@ def main():
options, files = parse_opts()
if options is None:
return 0
+
+ print("Deprecated: Since GLib 2.62, gtester and gtester-report are "
+ "deprecated. Port to TAP.", file=sys.stderr)
+
xd = xml.dom.minidom.parse (files[0])
rr = ReportReader()
rr.trampoline (xd)
diff --git a/glib/gtester.c b/glib/gtester.c
index 368fa8f3d..fdcdaca10 100644
--- a/glib/gtester.c
+++ b/glib/gtester.c
@@ -43,6 +43,7 @@ static gboolean gtester_quiet = FALSE;
static gboolean gtester_verbose = FALSE;
static gboolean gtester_list_tests = FALSE;
static gboolean gtester_selftest = FALSE;
+static gboolean gtester_ignore_deprecation = FALSE;
static gboolean subtest_running = FALSE;
static gint subtest_exitstatus = 0;
static gboolean subtest_io_pending = FALSE;
@@ -660,6 +661,11 @@ parse_args (gint *argc_p,
}
argv[i] = NULL;
}
+ else if (strcmp ("--i-know-this-is-deprecated", argv[i]) == 0)
+ {
+ gtester_ignore_deprecation = TRUE;
+ argv[i] = NULL;
+ }
}
/* collapse argv */
e = 1;
@@ -690,6 +696,10 @@ main (int argc,
return 1;
}
+ if (!gtester_ignore_deprecation)
+ g_warning ("Deprecated: Since GLib 2.62, gtester and gtester-report are "
+ "deprecated. Port to TAP.");
+
if (output_filename)
{
int errsv;
@@ -700,6 +710,8 @@ main (int argc,
}
test_log_printfe ("<?xml version=\"1.0\"?>\n");
+ test_log_printfe ("<!-- Deprecated: Since GLib 2.62, gtester and "
+ "gtester-report are deprecated. Port to TAP. -->\n");
test_log_printfe ("%s<gtester>\n", sindent (log_indent));
log_indent += 2;
for (ui = 1; ui < argc; ui++)
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index d129b8742..3eca0a4d3 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -60,7 +60,6 @@
* SECTION:testing
* @title: Testing
* @short_description: a test framework
- * @see_also: [gtester][gtester], [gtester-report][gtester-report]
*
* GLib provides a framework for writing and maintaining unit tests
* in parallel to the code they are testing. The API is designed according
@@ -235,7 +234,9 @@
* If you don't have access to the Autotools TAP harness, you can use the
* [gtester][gtester] and [gtester-report][gtester-report] tools, and use
* the [glib.mk](https://gitlab.gnome.org/GNOME/glib/blob/glib-2-58/glib.mk)
- * Automake template provided by GLib.
+ * Automake template provided by GLib. Note, however, that since GLib 2.62,
+ * [gtester][gtester] and [gtester-report][gtester-report] have been deprecated
+ * in favour of using TAP.
*/
/**
diff --git a/glib/tests/meson.build b/glib/tests/meson.build
index e6c5cbd22..7aa16d279 100644
--- a/glib/tests/meson.build
+++ b/glib/tests/meson.build
@@ -229,7 +229,7 @@ if not meson.is_cross_build() and host_system != 'windows'
if xmllint.found()
tmpsample_xml = custom_target('tmpsample.xml',
output : 'tmpsample.xml',
- command : [ gtester, '-k', '--quiet', '-o', '@OUTPUT@',
+ command : [ gtester, '-k', '--quiet', '--i-know-this-is-deprecated', '-o', '@OUTPUT@',
'--test-arg=--gtester-selftest', gtester])
test('gtester-xmllint-check', xmllint,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]