summaryrefslogtreecommitdiff
path: root/glib/gtester.c
Commit message (Collapse)AuthorAgeFilesLines
* glib: Add SPDX license headers automaticallyPhilip Withnall2022-05-181-0/+2
| | | | | | | | | | | | | | Add SPDX license (but not copyright) headers to all files which follow a certain pattern in their existing non-machine-readable header comment. This commit was entirely generated using the command: ``` git ls-files glib/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs' ``` Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1415
* gtestutils: Handle empty argv array passed to g_test_init()Philip Withnall2022-02-111-2/+2
| | | | | | | | | | | This can happen if a caller (ab)uses `execve()` to execute a gtest process with an empty `argv` array. `g_test_init()` has to gracefully handle such a situation. Fix a few problem areas in the code, and add a simple test which checks that `g_test_init()` doesn’t crash when called with an empty `argv`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* tests: Drop use of g_test_bug_base()Philip Withnall2021-05-131-0/+1
| | | | | | | | | | | | Include the base URI in the `g_test_bug()` calls instead. This resolves inconsistencies between the old bug base (bugzilla.gnome.org) and the new bug base (gitlab.gnome.org). It also has the advantage that the URI passed to `g_test_bug()` is now clickable in the code editor, rather than being split across two locations. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/275#note_303175 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* glib: Deprecate gtester and gtester-reportPhilip Withnall2019-05-141-0/+12
| | | | | | | | | | | 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
* Fixing signedness in glib/gtester.cEmmanuel Fleury2019-03-171-1/+1
| | | | | | | glib/gtester.c: In function ‘main’: glib/gtester.c:705:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare] for (ui = 1; ui < argc; ui++) ^
* Fixing signedness warning in sindent():gtester.cEmmanuel Fleury2019-01-281-1/+1
| | | | | | | | | | | | | | | | ../glib.git/glib/gtester.c: In function ‘sindent’: ../glib.git/glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare] #define MIN(a, b) (((a) < (b)) ? (a) : (b)) ^ ../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’ n = MIN (n, l); ^~~ ../glib.git/glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘int’ to ‘guint’ {aka ‘unsigned int’} due to unsignedness of other operand [-Werror=sign-compare] #define MIN(a, b) (((a) < (b)) ? (a) : (b)) ^~~ ../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’ n = MIN (n, l); ^~~
* Spelling: Fix a common en_FR spelling of "information"Simon McVittie2018-09-251-1/+1
| | | | | | Detected by Debian's Lintian tool. Signed-off-by: Simon McVittie <smcv@collabora.com>
* gtester: fix test result in gtester XML reportSven Neumann2018-05-281-1/+1
| | | | | This was accidentally broken with the changes done for https://bugzilla.gnome.org/show_bug.cgi?id=790934
* gtester: fix -Wduplicated-branchesErnestas Kulik2018-02-161-4/+2
| | | | | | | | One of the “quick” or “slow” test run modes is always added to the argument list, making the branching pointless, which, coincidentally, now causes a warning. https://bugzilla.gnome.org/show_bug.cgi?id=793399
* gtester: do not consider skipped tests as failuresCarlos Garcia Campos2017-11-281-5/+21
| | | | | | | | | This is happening since f591366eee341f2c40516821e8a5a0bc7a9bd288, that changed the way tests were skipped to use g_test_skip() instead of just ignoring them. They are now reported to the log with G_TEST_RUN_SKIPPED as result. https://bugzilla.gnome.org/show_bug.cgi?id=790934
* Consistently save errno immediately after the operation setting itPhilip Withnall2017-08-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Prevent the situation where errno is set by function A, then function B is called (which is typically _(), but could be anything else) and it overwrites errno, then errno is checked by the caller. errno is a horrific API, and we need to be careful to save its value as soon as a function call (which might set it) returns. i.e. Follow the pattern: int errsv, ret; ret = some_call_which_might_set_errno (); errsv = errno; if (ret < 0) puts (strerror (errsv)); This patch implements that pattern throughout GLib. There might be a few places in the test code which still use errno directly. They should be ported as necessary. It doesn’t modify all the call sites like this: if (some_call_which_might_set_errno () && errno == ESOMETHING) since the refactoring involved is probably more harmful than beneficial there. It does, however, refactor other call sites regardless of whether they were originally buggy. https://bugzilla.gnome.org/show_bug.cgi?id=785577
* glib/: LGPLv2+ -> LGPLv2.1+Sébastien Wilmet2017-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All glib/*.{c,h} files have been processed, as well as gtester-report. 12 of those files are not licensed under LGPL: gbsearcharray.h gconstructor.h glibintl.h gmirroringtable.h gscripttable.h gtranslit-data.h gunibreak.h gunichartables.h gunicomp.h gunidecomp.h valgrind.h win_iconv.c Some of them are generated files, some are licensed under a BSD-style license and win_iconv.c is in the public domain. Sub-directories inside glib/: deprecated/: processed in a previous commit glib-mirroring-tab/: already LGPLv2.1+ gnulib/: not modified, the code is copied from gnulib libcharset/: a copy pcre/: a copy tests/: processed in a previous commit https://bugzilla.gnome.org/show_bug.cgi?id=776504
* Use g_abort() instead of abort() where possibleРуслан Ижбулатов2016-04-271-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=665446
* Updated FSF's addressDaniel Mustieles2014-01-311-3/+1
|
* gtester: only remove source if not already deadRyan Lortie2013-10-231-1/+3
| | | | | | | Don't attempt to g_source_remove() a source for which we already returned FALSE from the handler. https://bugzilla.gnome.org/show_bug.cgi?id=710724
* Add start/stop suite log messagesMatthias Clasen2013-08-171-0/+2
| | | | | | | | These will be used in the following commits, when implementing support for TAP as an alternative test driver protocol. https://bugzilla.gnome.org/show_bug.cgi?id=692125
* gtester: Use FD_CLOEXEC when creating pipesColin Walters2013-01-231-3/+5
| | | | | | | We were already unsetting the cloexec flag for the child later, just not actually starting with it. https://bugzilla.gnome.org/show_bug.cgi?id=692404
* gtester: Add #include config.hYuri Sedunov2013-01-151-0/+2
| | | | | | | Missed #include "config.h" so, in particular, large file support (_FILE_OFFSET_BITS) ignored. https://bugzilla.gnome.org/show_bug.cgi?id=691624
* GTest: Improve --help outputMatthias Clasen2012-08-161-16/+17
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=550433
* comments/docs: Fix couple of typosRavi Sankar Guntur2012-01-281-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=668857
* Add undefined/no-undefined mode options to GTesterSimon McVittie2011-12-271-0/+10
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=666116
* gtester: Add command line option to skip testsCarlos Garcia Campos2011-11-271-0/+18
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=664809
* gtester: Remove SIGCHLD race workaroundsRyan Lortie2011-09-091-23/+0
| | | | With the GMainLoop changes, gtester should now be race-free.
* gtester: Count inability to run a test in a binary as a failureBenjamin Otte2011-07-181-0/+4
| | | | | | | | | | Previously, when a binary did not run a single test - for whatever reason, from the binary not existing to the binary not using the gtester framework - no failures were recorded. Now we record a non-successful run of a binary that did not start any tests as a failure, too. Note that this does not change the behavior of any binaries that exit successfully or that report the start of any gtester test.
* gtester: Return a failure exit code when a test failsBenjamin Otte2011-07-181-4/+4
| | | | | | | | Previously, gtester used the testcase_fail_count as the number of tests that failed in the latest run testcase, but then use that as the return value of main(). Now we count the failed testcases of the whole run.
* Bug 578295 - gtester has a race conditionRyan Lortie2010-08-071-0/+9
| | | | Deal with the race in GMainLoop by installing a do-nothing timeout.
* gtester should fail even if -k is passedCody Russell2009-11-231-1/+1
|
* Bug 526619 – make test-report crashMatthias Clasen2008-04-081-1/+1
| | | | | | | | * glib/gtester.c: Allocate enough space for argv. Patch by Hiroyuki Ikezoe svn path=/trunk/; revision=6832
* Don't use ARG_MAX. (#522335, patch by Sebastian Dröge)Matthias Clasen2008-03-311-1/+31
| | | | | | | | | | | 2008-03-30 Matthias Clasen <mclasen@redhat.com> * glib/gtester.c: Don't use ARG_MAX. (#522335, patch by Sebastian Dröge) svn path=/trunk/; revision=6782
* /bin/ksh can't handle a for-loop with no arguments, so add a "." for whenMatthias Clasen2008-02-101-2/+2
| | | | | | | | | | | | | | | | | | 2008-02-09 Matthias Clasen <mclasen@redhat.com> * Makefile.decl: /bin/ksh can't handle a for-loop with no arguments, so add a "." for when $(SUBDIRS) is empty. * glib/tests/option-context.c: * glib/tests/testing.c: * gthread/gthread-posix.c: * tets/testingbase64.c: * glib/gtester.c: * glib/gsequence.c: Portability fixes. (#515154) svn path=/trunk/; revision=6487
* Bring up to GLib coding standards: remove C99 comments, trailing commas inMatthias Clasen2007-12-211-4/+4
| | | | | | | | | | | | | | 2007-12-21 Matthias Clasen <mclasne@redhat.com> * glib/gtestutils.h: Bring up to GLib coding standards: remove C99 comments, trailing commas in enumerations and extra ; after G_BEGIN/END_DECLS. Among other things, this makes xulrunner build against GLib 2.15. * glib/gtester.c: More of the same svn path=/trunk/; revision=6185
* capture g_log() messages and send to gtester. also, send assertion20:30:18 Tim Janik2007-12-191-6/+25
| | | | | | | | | | | | | | | 2007-12-19 20:30:18 Tim Janik <timj@imendio.com> * glib/gtestutils.c: capture g_log() messages and send to gtester. also, send assertion messages to gtester. * glib/gtester.c: add error messages to output log file. force child poll loop to abort if waitpid() signaled child exit, eventhough the child's report file descriptor wasn't closed. svn path=/trunk/; revision=6163
* detect non-blocking fd EOF by read()==0 following poll(), needed on MacOS.13:29:00 Tim Janik2007-12-061-2/+11
| | | | | | | | | | | 2007-12-06 13:29:00 Tim Janik <timj@imendio.com> * glib/gtester.c (child_report_cb): detect non-blocking fd EOF by read()==0 following poll(), needed on MacOS. svn path=/trunk/; revision=6059
* added -m=thorough support to gtester.17:58:18 Tim Janik2007-12-051-2/+3
| | | | | | | | | | 2007-12-05 17:58:18 Tim Janik <timj@imendio.com> * glib/gtester.c: added -m=thorough support to gtester. svn path=/trunk/; revision=6053
* print out random seed for verbose tests, also adapted test result17:21:05 Tim Janik2007-12-051-6/+13
| | | | | | | | | | | | | | | | | | 2007-12-05 17:21:05 Tim Janik <timj@imendio.com> * glib/glib/gtestutils.c: print out random seed for verbose tests, also adapted test result reporting slightly in verbose mode to allow custom debugging output. support "thorough" as test mode alis for "slow". * glib/glib/gtestutils.h: added g_test_thorough(). * glib/glib/gtester.c: print out the last random seed when tests fail. added result attribute to test case status logging to easily spot failing tests in log files. disabled debugging output when skipping tests. svn path=/trunk/; revision=6052
* added g_test_add_data_func() to pass data into tests. allow data arguments11:43:22 Tim Janik2007-12-051-4/+7
| | | | | | | | | | | | | | | | | | 2007-12-05 11:43:22 Tim Janik <timj@imendio.com> * glib/gtestutils.[hc]: added g_test_add_data_func() to pass data into tests. allow data arguments for fixture tests. * glib/gtestutils.c: fixed fatal log flag setup, so tests really abort upon criticals/warnings/errors. * glib/tests/testing.c: test test_data arguments. * glib/gtester.c: some prototype fixups. svn path=/trunk/; revision=6049
* initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional21:06:47 Tim Janik2007-11-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-11-21 21:06:47 Tim Janik <timj@imendio.com> * Makefile.decl: initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional appending via += in other makefiles. define recursive test targets: test, test-report, perf-report, full-report, as described here: http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00000.html * Makefile.am: * build/win32/vs8/Makefile.am, build/win32/dirent/Makefile.am: * build/win32/Makefile.am, build/Makefile.am: * docs/Makefile.am, docs/reference/Makefile.am: * docs/reference/glib/Makefile.am, docs/reference/gobject/Makefile.am: * gmodule/Makefile.am, tests/Makefile.am: * tests/refcount/Makefile.am, tests/gobject/Makefile.am: * glib/update-pcre/Makefile.am, glib/libcharset/Makefile.am: * glib/tests/Makefile.am, glib/pcre/Makefile.am: * glib/gnulib/Makefile.am, gobject/Makefile.am, m4macros/Makefile.am: * gthread/Makefile.am, glib/Makefile.am: include $(top_srcdir)/Makefile.decl, adapted EXTRA_DIST assignments. * glib/tests/Makefile.am: removed example testing rules. * glib/tests/testing.c: conditionalized performance and slow tests. * glib/gtestutils.h: * glib/gtestutils.c: work around g_test_config_vars not changing its exported value after value assignments, aparently due to symbol aliases. * glib/gtester.c: fixed off-by-one error which produced junk in logs. * configure.in: check for python >= 2.4 and provide $PYTHON for scripts. svn path=/trunk/; revision=5914
* Added g_test_bug() and related API.Tim Janik2007-11-201-0/+8
| | | | | | | | | * gtester.c: handle G_TEST_LOG_MESSAGE and test test message API. * gtestframework.h, gtestframework.c: added test message API and convenience API to send test messages about bug URLs. svn path=/trunk/; revision=5906
* gtester: implemented logic to handle failing tests, self tests, and validate ↵Tim Janik2007-11-201-21/+132
| | | | | | | | | | | | | | | | | | | | | | XML reports. * gtester.c: terminate when tests failed. keep XML valid when test cases fail. restart test binaries when tests fail, resuming after the last processed test. support --gtester-selftest to run gtester itself as test program. support --test-arg=<arg> to pass args along to test programs. added main_selftest() which does a simplistic fixture test. fail if exit code of test programs is not 0. * gtestframework.h: added G_TEST_LOG_SKIP_CASE test log message type. * gtestframework.c: support --GTestSkipCount=<n> to skip a number of tests. * tests/Makefile.am: added test-report: for demonstration purposes. added gtester-xmllint-check: and hooked it up into check:, this rule calls gtester as test program, running it's selftest, and then uses xmllint to validate the generate XML test log file. svn path=/trunk/; revision=5904
* gtester: implemented XML logging.Tim Janik2007-11-201-28/+140
| | | | | | | | | | | * glib/gtester.c: log test messages to XML output file. beautified normal test result output. * glib/gtestframework.c: fixed GTimer leak. * glib/tests/Makefile.am: start gtester with --verbose. svn path=/trunk/; revision=5903
* glib/gtester.c: fixed debugging flag.Tim Janik2007-11-201-1/+1
| | | | svn path=/trunk/; revision=5900
* fixed bogus unistd.h include.Tim Janik2007-11-201-1/+0
| | | | svn path=/trunk/; revision=5899
* Implemented test log IPC.Tim Janik2007-11-201-32/+102
| | | | | | | | | | | | | * gtester.c: read and decode log messages from test binary child processes. fixed GIOChannel and child watch handling to process all messages and avoid hangs. pass --verbose and --quiet on to children, default to --quiet. * gtestframework.h: export g_test_log_type_name(). * gtestframework.c: send test log to --GTestLogFD=<fd> if given, removed bogus -o-option. svn path=/trunk/; revision=5898
* gtester.c: support test case listing through gtester.Tim Janik2007-11-201-0/+2
| | | | svn path=/trunk/; revision=5897
* gtester.c: adapted to become a rudimentary test binary launcher.Tim Janik2007-11-201-51/+269
| | | | | | | | | | | | * gtester.c: increased read buffer size to match common unix pipe buffer size. added argument parsing and usage. changed io handling to capture and replicate stdout. fixed io handlers to be cleaned up when the child process exits (catch G_IO_ERR | G_IO_HUP). we now use pending/iteration instead of a main loop structure, to keep running until the child process exits and all io has been processed. launch the test binaries given on the command line. don't quit when a child couldn't be launched but --keep-going was specified. svn path=/trunk/; revision=5895
* Integrated gtester program into build process.Tim Janik2007-11-201-66/+60
| | | | | | | | * Makefile.am: build and install gtester binary. * gtester.c: fixed up coding style and removed hard wired test coded. svn path=/trunk/; revision=5894
* glib/gtester.c:Small -Wall fixTim Janik2007-11-201-1/+1
| | | | svn path=/trunk/; revision=5893
* glib/gtester.c:Implemented nonblocking reading properly nowTim Janik2007-11-201-29/+45
| | | | svn path=/trunk/; revision=5892
* glib/gtester.c:Quit the application when the output is parsed completely, ↵Tim Janik2007-11-201-8/+13
| | | | | | not just the process finished svn path=/trunk/; revision=5891
* glib/gtester.c:Read the output of the child processTim Janik2007-11-201-3/+32
| | | | svn path=/trunk/; revision=5890