Commit Graph

5 Commits

Author SHA1 Message Date
Simon McVittie
606dbdbc20 testlib: Add an assertion that a fd has really been closed
We can't easily assert this without triggering warnings from tools like
valgrind by doing an invalid operation on a closed fd, so we only check
this when under `-m undefined`.

Originally contributed to GLib 2.76 in GNOME/glib@b3934133
"gstdio: Add g_clear_fd() and g_autofd". The implementation in GLib used
g_fsync() as a portable thing that we can do with a fd, but that
function is newer than our minimum GLib version, and libglnx isn't
portable to non-Unix anyway, so use fnctl() instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-04-07 15:59:31 +01:00
Simon McVittie
81c6adb0f7 Declare copyright and licensing using REUSE
To fill in some gaps, I've had to make some assumptions:

* trivial changes (such as checking for an additional function or
  header file in libglnx.m4) are assumed to not be copyrightable
* Will Thompson and Matthew Leeds are assumed to be contributing on
  behalf of Endless Mobile Inc.
* files with no explicit licensing information are assumed to be
  under the license found in COPYING

Reference: https://reuse.software/
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-02-19 22:57:48 +00:00
Simon McVittie
bc9c31f785 _GLNX_TEST_SCOPED_TEMP_DIR: Mark variable as G_GNUC_UNUSED
Otherwise, clang diagnoses it as unused. It is - deliberately - only
allocated and cleaned up, with no other use.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-11 18:37:38 +00:00
Simon McVittie
04c11c7390 Run the fdio test in its own temporary directory
The temporary directory will be deleted on success, but will remain
intact on failure.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-05-02 19:14:50 +01:00
Colin Walters
c2bcca04ba tests: Add macro for auto-error checking
Having our tests forced into a `goto out` style is seriously annoying
since we can't write tests like we write production code.  Add
a macro that checks for the error being NULL.

This doesn't fully solve the problem since the test functions are
still forced into `void` returns; at some point I may extend
GLib to have `g_test_add_err_func()`.
2017-09-13 10:57:30 -04:00