diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-05-08 11:19:46 +0100 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2017-05-08 11:19:46 +0100 |
commit | b7ffc07d9893949b218d4057d896e7ba943c1b8b (patch) | |
tree | 1037508b503ed46c8ce9315acad6b52e54b378c0 | |
parent | 5c1e85669a90e8ffc4a2c3bf2b2fec71eb35014d (diff) | |
download | glib-b7ffc07d9893949b218d4057d896e7ba943c1b8b.tar.gz |
tests: Improve error handling for fileutils test
The test_stdio_wrappers() test will spuriously fail if the mkdir-test
directory already exists and is non-empty, which can happen if a
previous test run has failed and left a coredump file in the directory.
Tighten up the error checking around the pre-test rmdir() call to catch
this failure.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=782237
-rw-r--r-- | glib/tests/fileutils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 10ef13663..4c987a3ad 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -848,7 +848,8 @@ test_stdio_wrappers (void) GError *error = NULL; g_remove ("mkdir-test/test-create"); - g_rmdir ("mkdir-test"); + ret = g_rmdir ("mkdir-test"); + g_assert (ret == 0 || errno == ENOENT); ret = g_stat ("mkdir-test", &buf); g_assert_cmpint (ret, ==, -1); |