mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 00:16:15 +01:00
Merge branch '1441-1619-deprecate-gtester' into 'master'
Deprecate gtester and use TAP output for tests by default Closes #1619 and #1441 See merge request GNOME/glib!842
This commit is contained in:
commit
522e74982e
@ -136,6 +136,10 @@
|
|||||||
<chapter id="tools">
|
<chapter id="tools">
|
||||||
<title>GLib Tools</title>
|
<title>GLib Tools</title>
|
||||||
<xi:include href="glib-gettextize.xml" />
|
<xi:include href="glib-gettextize.xml" />
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="deprecated-tools">
|
||||||
|
<title>Deprecated Tools</title>
|
||||||
<xi:include href="gtester.xml" />
|
<xi:include href="gtester.xml" />
|
||||||
<xi:include href="gtester-report.xml" />
|
<xi:include href="gtester-report.xml" />
|
||||||
</chapter>
|
</chapter>
|
||||||
|
@ -35,6 +35,9 @@
|
|||||||
<para><command>gtester-report</command> is a script which converts
|
<para><command>gtester-report</command> is a script which converts
|
||||||
the XML output generated by gtester into HTML.
|
the XML output generated by gtester into HTML.
|
||||||
</para>
|
</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>
|
||||||
|
|
||||||
<refsect1><title>Options</title>
|
<refsect1><title>Options</title>
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
<para><command>gtester</command> is a utility to run unit tests that have
|
<para><command>gtester</command> is a utility to run unit tests that have
|
||||||
been written using the GLib test framework.
|
been written using the GLib test framework.
|
||||||
</para>
|
</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>
|
<para>
|
||||||
When called with the <option>-o</option> option, <command>gtester</command>
|
When called with the <option>-o</option> option, <command>gtester</command>
|
||||||
writes an XML report of the test results, which can be converted
|
writes an XML report of the test results, which can be converted
|
||||||
|
@ -678,7 +678,6 @@ foreach test_name, extra_args : gio_tests
|
|||||||
env : local_test_env,
|
env : local_test_env,
|
||||||
timeout : timeout,
|
timeout : timeout,
|
||||||
suite : suite,
|
suite : suite,
|
||||||
args : ['--tap'],
|
|
||||||
is_parallel : extra_args.get('is_parallel', true),
|
is_parallel : extra_args.get('is_parallel', true),
|
||||||
depends : extra_args.get('depends', []),
|
depends : extra_args.get('depends', []),
|
||||||
)
|
)
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# 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/>.
|
# 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 datetime
|
||||||
import optparse
|
import optparse
|
||||||
import sys, re, xml.dom.minidom
|
import sys, re, xml.dom.minidom
|
||||||
@ -343,6 +347,9 @@ class HTMLReportWriter(ReportWriter):
|
|||||||
self.oprint ('<body>\n')
|
self.oprint ('<body>\n')
|
||||||
self.oprint ('<h2>GTester Unit Test Report</h2>\n')
|
self.oprint ('<h2>GTester Unit Test Report</h2>\n')
|
||||||
self.handle_info ()
|
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 ('<table id="ResultTable" width="100%" border="1">\n<tr>\n')
|
||||||
self.oprint ('<th>Program / Testcase </th>\n')
|
self.oprint ('<th>Program / Testcase </th>\n')
|
||||||
self.oprint ('<th style="width:8em">Duration (sec)</th>\n')
|
self.oprint ('<th style="width:8em">Duration (sec)</th>\n')
|
||||||
@ -474,6 +481,10 @@ def main():
|
|||||||
options, files = parse_opts()
|
options, files = parse_opts()
|
||||||
if options is None:
|
if options is None:
|
||||||
return 0
|
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])
|
xd = xml.dom.minidom.parse (files[0])
|
||||||
rr = ReportReader()
|
rr = ReportReader()
|
||||||
rr.trampoline (xd)
|
rr.trampoline (xd)
|
||||||
|
@ -43,6 +43,7 @@ static gboolean gtester_quiet = FALSE;
|
|||||||
static gboolean gtester_verbose = FALSE;
|
static gboolean gtester_verbose = FALSE;
|
||||||
static gboolean gtester_list_tests = FALSE;
|
static gboolean gtester_list_tests = FALSE;
|
||||||
static gboolean gtester_selftest = FALSE;
|
static gboolean gtester_selftest = FALSE;
|
||||||
|
static gboolean gtester_ignore_deprecation = FALSE;
|
||||||
static gboolean subtest_running = FALSE;
|
static gboolean subtest_running = FALSE;
|
||||||
static gint subtest_exitstatus = 0;
|
static gint subtest_exitstatus = 0;
|
||||||
static gboolean subtest_io_pending = FALSE;
|
static gboolean subtest_io_pending = FALSE;
|
||||||
@ -660,6 +661,11 @@ parse_args (gint *argc_p,
|
|||||||
}
|
}
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
|
else if (strcmp ("--i-know-this-is-deprecated", argv[i]) == 0)
|
||||||
|
{
|
||||||
|
gtester_ignore_deprecation = TRUE;
|
||||||
|
argv[i] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* collapse argv */
|
/* collapse argv */
|
||||||
e = 1;
|
e = 1;
|
||||||
@ -690,6 +696,10 @@ main (int argc,
|
|||||||
return 1;
|
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)
|
if (output_filename)
|
||||||
{
|
{
|
||||||
int errsv;
|
int errsv;
|
||||||
@ -700,6 +710,8 @@ main (int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_log_printfe ("<?xml version=\"1.0\"?>\n");
|
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));
|
test_log_printfe ("%s<gtester>\n", sindent (log_indent));
|
||||||
log_indent += 2;
|
log_indent += 2;
|
||||||
for (ui = 1; ui < argc; ui++)
|
for (ui = 1; ui < argc; ui++)
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
* SECTION:testing
|
* SECTION:testing
|
||||||
* @title: Testing
|
* @title: Testing
|
||||||
* @short_description: a test framework
|
* @short_description: a test framework
|
||||||
* @see_also: [gtester][gtester], [gtester-report][gtester-report]
|
|
||||||
*
|
*
|
||||||
* GLib provides a framework for writing and maintaining unit tests
|
* GLib provides a framework for writing and maintaining unit tests
|
||||||
* in parallel to the code they are testing. The API is designed according
|
* in parallel to the code they are testing. The API is designed according
|
||||||
@ -235,7 +234,10 @@
|
|||||||
* If you don't have access to the Autotools TAP harness, you can use the
|
* 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
|
* [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)
|
* 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. The `--tap` argument to tests is enabled by default
|
||||||
|
* as of GLib 2.62.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -832,7 +834,7 @@ static char *test_trap_last_stdout = NULL;
|
|||||||
static char *test_trap_last_stderr = NULL;
|
static char *test_trap_last_stderr = NULL;
|
||||||
static char *test_uri_base = NULL;
|
static char *test_uri_base = NULL;
|
||||||
static gboolean test_debug_log = FALSE;
|
static gboolean test_debug_log = FALSE;
|
||||||
static gboolean test_tap_log = FALSE;
|
static gboolean test_tap_log = TRUE; /* default to TAP as of GLib 2.62; see #1619; the non-TAP output mode is deprecated */
|
||||||
static gboolean test_nonfatal_assertions = FALSE;
|
static gboolean test_nonfatal_assertions = FALSE;
|
||||||
static DestroyEntry *test_destroy_queue = NULL;
|
static DestroyEntry *test_destroy_queue = NULL;
|
||||||
static char *test_argv0 = NULL;
|
static char *test_argv0 = NULL;
|
||||||
@ -1108,6 +1110,9 @@ parse_args (gint *argc_p,
|
|||||||
test_log_fd = g_ascii_strtoull (argv[i], NULL, 0);
|
test_log_fd = g_ascii_strtoull (argv[i], NULL, 0);
|
||||||
}
|
}
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
|
|
||||||
|
/* Force non-TAP output when using gtester */
|
||||||
|
test_tap_log = FALSE;
|
||||||
}
|
}
|
||||||
else if (strcmp ("--GTestSkipCount", argv[i]) == 0 || strncmp ("--GTestSkipCount=", argv[i], 17) == 0)
|
else if (strcmp ("--GTestSkipCount", argv[i]) == 0 || strncmp ("--GTestSkipCount=", argv[i], 17) == 0)
|
||||||
{
|
{
|
||||||
@ -1135,6 +1140,10 @@ parse_args (gint *argc_p,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
|
|
||||||
|
/* Force non-TAP output when spawning a subprocess, since people often
|
||||||
|
* test the stdout/stderr of the subprocess strictly */
|
||||||
|
test_tap_log = FALSE;
|
||||||
}
|
}
|
||||||
else if (strcmp ("-p", argv[i]) == 0 || strncmp ("-p=", argv[i], 3) == 0)
|
else if (strcmp ("-p", argv[i]) == 0 || strncmp ("-p=", argv[i], 3) == 0)
|
||||||
{
|
{
|
||||||
|
@ -204,8 +204,7 @@ foreach test_name, extra_args : glib_tests
|
|||||||
|
|
||||||
suite = ['glib'] + extra_args.get('suite', [])
|
suite = ['glib'] + extra_args.get('suite', [])
|
||||||
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
||||||
test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
args : ['--tap'])
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
# test-spawn-echo helper binary required by the spawn tests above
|
# test-spawn-echo helper binary required by the spawn tests above
|
||||||
@ -229,7 +228,7 @@ if not meson.is_cross_build() and host_system != 'windows'
|
|||||||
if xmllint.found()
|
if xmllint.found()
|
||||||
tmpsample_xml = custom_target('tmpsample.xml',
|
tmpsample_xml = custom_target('tmpsample.xml',
|
||||||
output : '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-arg=--gtester-selftest', gtester])
|
||||||
|
|
||||||
test('gtester-xmllint-check', xmllint,
|
test('gtester-xmllint-check', xmllint,
|
||||||
|
@ -103,8 +103,7 @@ foreach test_name, extra_args : gobject_tests
|
|||||||
timeout = timeout * 10
|
timeout = timeout * 10
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
args: ['--tap'])
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
test(
|
test(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[Test]
|
[Test]
|
||||||
Type=session
|
Type=session
|
||||||
Exec=@env@@installed_tests_dir@/@program@ --tap
|
Exec=@env@@installed_tests_dir@/@program@
|
||||||
Output=TAP
|
Output=TAP
|
||||||
|
@ -60,7 +60,6 @@ foreach test_name, extra_args : gobject_tests
|
|||||||
extra_sources = extra_args.get('extra_sources', [])
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
install = installed_tests_enabled and extra_args.get('install', true)
|
install = installed_tests_enabled and extra_args.get('install', true)
|
||||||
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
|
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
|
||||||
test_command_args = extra_args.get('tap', false) ? ['--tap'] : []
|
|
||||||
|
|
||||||
if install
|
if install
|
||||||
test_conf = configuration_data()
|
test_conf = configuration_data()
|
||||||
@ -86,8 +85,7 @@ foreach test_name, extra_args : gobject_tests
|
|||||||
suite = ['gobject'] + extra_args.get('suite', [])
|
suite = ['gobject'] + extra_args.get('suite', [])
|
||||||
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
||||||
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
||||||
test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
args : test_command_args)
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
# Don't install these ones, and keep them out of 'make check' because they take too long...
|
# Don't install these ones, and keep them out of 'make check' because they take too long...
|
||||||
|
@ -103,7 +103,6 @@ foreach test_name, extra_args : tests
|
|||||||
extra_sources = extra_args.get('extra_sources', [])
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
install = installed_tests_enabled and extra_args.get('install', true)
|
install = installed_tests_enabled and extra_args.get('install', true)
|
||||||
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
|
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
|
||||||
test_command_args = extra_args.get('tap', false) ? ['--tap'] : []
|
|
||||||
|
|
||||||
if install
|
if install
|
||||||
test_conf = configuration_data()
|
test_conf = configuration_data()
|
||||||
@ -131,8 +130,7 @@ foreach test_name, extra_args : tests
|
|||||||
suite = ['glib'] + extra_args.get('suite', [])
|
suite = ['glib'] + extra_args.get('suite', [])
|
||||||
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
||||||
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
|
||||||
test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
|
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
|
||||||
args : test_command_args)
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
foreach program_name, extra_args : test_extra_programs
|
foreach program_name, extra_args : test_extra_programs
|
||||||
|
Loading…
Reference in New Issue
Block a user