glib/tests
Philip Withnall 5cddde1fb2 Consistently save errno immediately after the operation setting it
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
2017-08-03 10:21:13 +01:00
..
collate
gobject Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
refcount meson: add tests/gobject and tests/refcount 2017-07-13 19:03:39 -04:00
.gitignore build: Drop nmake/MSC build system for GLib 2017-07-10 11:22:40 +01:00
assert-msg-test.c
assert-msg-test.gdb assert-msg-test: Explicitly quit gdb session to avoid zombie 2014-06-10 08:57:54 -04:00
asyncqueue-test.c tests: replace most g_print() with g_printerr() 2015-05-11 20:24:56 +01:00
atomic-test.c
bit-test.c all: remove use of 'register' keyword 2014-06-28 13:07:52 -04:00
casefold.txt unicode: Update test data files for unicode 10.0.0 2017-07-05 17:53:07 +02:00
casemap.txt unicode: Update test data files for unicode 10.0.0 2017-07-05 17:53:07 +02:00
child-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
completion-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
cxx-test.C
datetime.c License headers: replace current FSF address by a link to gnu.org 2017-01-04 19:12:57 +01:00
dirname-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
env-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
file-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
gen-casefold-txt.pl Restore executability for other files 2014-01-31 09:36:52 -05:00
gen-casemap-txt.pl Restore executability for other files 2014-01-31 09:36:52 -05:00
gio-ls.c
gio-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
iochannel-test-infile
iochannel-test.c iochannel-test: Fix leaks in test 2013-11-10 22:45:04 +01:00
libmoduletestplugin_a.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
libmoduletestplugin_b.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
mainloop-test.c Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
Makefile.am build: Drop nmake/MSC build system for GLib 2017-07-10 11:22:40 +01:00
mapping-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
memchunks.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
meson.build meson: add tests/gobject and tests/refcount 2017-07-13 19:03:39 -04:00
module-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
onceinit.c
qsort-test.c
relation-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
run-assert-msg-test.sh
run-collate-tests.sh
slice-color.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
slice-concurrent.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
slice-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
slice-threadinit.c
sources.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
spawn-test-win32-gui.c Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
spawn-test.c Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
testgdate.c Try to make the testgdate test hobble along a little longer 2013-06-17 12:40:47 -04:00
testgdateparser.c
testglib.c Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
thread-test.c thread-test: Fix leaks in tests 2013-11-10 22:44:12 +01:00
threadpool-test.c threadpool-test: Fix leaks in tests 2013-11-11 17:37:48 +01:00
timeloop-basic.c Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
timeloop.c Consistently save errno immediately after the operation setting it 2017-08-03 10:21:13 +01:00
type-test.c tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:35 +02:00
unicode-caseconv.c
unicode-collate.c
unicode-encoding.c tests: Don't test g_utf8_to_ucs4_fast too rigorously 2015-09-07 15:01:16 -04:00
unicode-normalize.c
utf8.txt