Commit Graph

37 Commits

Author SHA1 Message Date
Philip Withnall
5d469dbe5a tests: Remove custom printerr logging from live-g-file
Use `g_test_message()` instead, so that the logs get treated properly
for TAP output.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-16 13:50:15 +00:00
Simon McVittie
32b0dd24e3 Add a SPDX LicenseRef for the license historically used for tests
Some of GLib's unit tests are under an apparently GLib-specific
permissive license, vaguely similar to the BSD/MIT family but with the
GPL's lack-of-warranty wording. This is not on SPDX's list of
well-known licenses, so we need to use a custom license name prefixed
with LicenseRef if we want to represent this in SPDX/REUSE syntax.

Most of the newer tests seem to be licensed under LGPL-2.1-or-later
instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-02 12:34:19 +00:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00:00
Simon McVittie
b3b4ad4f94 gio/tests/live-g-file: Use g_assert_no_errno()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-31 12:20:53 +00:00
Simon McVittie
b9d04b37b0 tests: Cope with having CAP_DAC_OVERRIDE, even if not euid 0
Some CI platforms invoke these tests with euid != 0 but with
capabilities. Detect whether we have Linux CAP_DAC_OVERRIDE or other
OSs' equivalents, and skip tests that rely on DAC permissions being
denied if we do have that privilege.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: https://gitlab.gnome.org/GNOME/glib/issues/2027
Fixes: https://gitlab.gnome.org/GNOME/glib/issues/2028
2020-02-13 17:33:45 +00:00
Philip Withnall
465b4dadf3 tests: Use g_assert_*() rather than g_assert() in live-g-file test
g_assert() is compiled out by `G_DISABLE_ASSERT` and doesn’t give such
useful messages on failure.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:19:34 +00:00
Philip Withnall
c25e8ec1f2 tests: Drop pointless assignments
Or turn them into proper error checks. This shuts up some `scan-build`
warnings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:19:34 +00:00
Philip Withnall
dd5132e041 tests: Tidy up GError assignment
No need to clear it to NULL before every time it’s used, since we assert
that it’s never set.

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:19:34 +00:00
Will Thompson
0c5f084200
fileinfo: make UNIX_IS_MOUNTPOINT be TRUE for /
The previously implementation considered a file to be a mountpoint if
its parent is on a different device. / is its own parent, so by this
definition it is not a mountpoint.

But / is (generally) listed in fstab, and fstab(5) defines the
directories it contains to be mountpoints. This attribute should follow
that definition (and reasonable expectation): the root directory is a
mountpoint.

So, add a special-case for the case where the file's parent has the same
st_dev and st_ino as the file, which is true only at the root.

Test this attribute at / (only on POSIX), /proc (but only on Linux), and
at many files and directories created by the test suite (which cannot be
mountpoints).
2018-06-07 06:38:23 +01:00
Simon McVittie
45dae4b506 tests: replace most g_print() with g_printerr()
I searched all files that mention g_test_run, and replaced most
g_print() calls. This avoids interfering with TAP. Exceptions:

* gio/tests/network-monitor: a manual mode that is run by
  "./network-monitor --watch" is unaffected
* glib/gtester.c: not a test
* glib/gtestutils.c: not a test
* glib/tests/logging.c: specifically exercising g_print()
* glib/tests/markup-parse.c: a manual mode that is run by
  "./markup-parse --cdata-as-text" is unaffected
* glib/tests/testing.c: specifically exercising capture of stdout
  in subprocesses
* glib/tests/utils.c: captures a subprocess's stdout
* glib/tests/testglib.c: exercises an assertion failure in g_print()

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-11 20:24:56 +01:00
Emilio Pozuelo Monfort
605c4ca24e live-g-file: test hidden files
We test for traditional Unix dot-leading files as well as
for files listed in the .hidden file.

https://bugzilla.gnome.org/show_bug.cgi?id=695147
2013-03-13 09:41:09 -04:00
Jasper St. Pierre
3c87ab97ff gfileenumerator: Add a g_file_enumerator_get_child method
This is a new convenience method designed to simplify some use
cases of GFileEnumerator, by making it easy to get the next file
from a file enumerator.

https://bugzilla.gnome.org/show_bug.cgi?id=690083
2012-12-13 21:38:18 -05:00
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Dan Winship
beb0f9c150 gio/tests: fix leaks
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:41:23 -04:00
Owen W. Taylor
d7e1d51fc9 Add tests for g_file_make_directory_with_parents()
Add tests to catch recent regressions with g_file_make_directory_with_parents()

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:08 -04:00
David Zeuthen
0729260141 Silence a bunch of -Wunused-but-set-variable warnings
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-08 15:44:25 -04:00
Matthias Clasen
c24a29e13b Adapt to recent MLS changes
g_file_query_info returns non-NULL more often now.
2010-07-09 07:24:08 -04:00
Matthias Clasen
dea042b855 Misc test additions 2010-07-05 03:09:36 -04:00
Emilio Pozuelo Monfort
202d7d37d6 Don't fail a couple of tests when running as root
root can access and write to a directory when it doesn't have
exec and write permissions respectively. So expect the tests that
check that to succeed rather than to fail when running as root.

https://bugzilla.gnome.org/show_bug.cgi?id=552912
2010-02-22 19:54:38 +01:00
Matthias Clasen
5694ab7642 Revert "Move gio tests from gio/tests/ to tests/gio/"
This reverts commit 2262d76b33.

Move GIO tests back to where they belong.
2009-07-05 22:49:24 -04:00
Benjamin Otte
2262d76b33 Move gio tests from gio/tests/ to tests/gio/
This avoids getting tests built every time when working on libgio and
running make in the gio/ directory.
2009-07-01 19:03:19 +02:00
Benjamin Otte
afd63c3281 fix warnings from gcc compilation with my mad CFLAGS 2009-06-29 18:25:02 +02:00
Alexander Larsson
6a9df8256a Use G_GSSIZE_FORMAT where needed (#577884) 2009-05-20 14:17:27 +02:00
Dan Winship
92ac8d165e Misc warning fixes
glib/pcre/pcre_ucp_search_funcs.c, glib/pcre/pcre_valid_utf8.c: add
back missing config.h includes, and this time add them to the copies
in glib/update-pcre/ too so they don't get lost again on the next PCRE
update.

glib/garray.c, glib/gbase64.c: fix signed/unsigned pointer casts

gio/xdgmime/xdgmimeglob.c: remove unused variable

gio/tests/live-g-file.c: fix printf args on x86_64

tests/Makefile.am, tests/regex-test.c: remove redundant -DENABLE_REGEX
2009-05-01 10:37:45 -04:00
Matthias Clasen
b2f0d44acb Support compilers that don't understand ISO C varargs macros. Patch by
* tests/live-g-file.c: Support compilers that don't understand
        ISO C varargs macros. Patch by Eric Lamarque



svn path=/trunk/; revision=7734
2008-12-08 04:38:54 +00:00
Matthias Clasen
6310f898b8 Fix gcc warnings
svn path=/trunk/; revision=7585
2008-10-10 04:54:51 +00:00
Dan Winship
29ddd48ff2 Use g_assert_error() and g_assert_no_error()
* tests/data-input-stream.c:
	* tests/data-output-stream.c:
	* tests/live-g-file.c:
	* tests/memory-input-stream.c:
	* tests/memory-output-stream.c: Use g_assert_error() and
	g_assert_no_error()

svn path=/trunk/; revision=7556
2008-09-27 01:43:43 +00:00
Cody Russell
3d93bf6968 Moved all relevant typedefs into these files.
2008-07-01  Cody Russell  <bratsche@gnome.org>

        * gio/gioenums.h:
        * gio/giotypes.h:
	Moved all relevant typedefs into these	files.

        * gio/*.[ch]:
	Updated wrt added files.

        Split types into separate file	for easier maintainership. (#538564)


svn path=/trunk/; revision=7127
2008-07-01 06:32:35 +00:00
Yevgen Muntyan
e5347891fe Use less fancy unicode filenames, so the test doesn't fail on Mac OS X
2008-06-12  Yevgen Muntyan  <muntyan@tamu.edu>

	* tests/live-g-file.c (sample_struct):
        Use less fancy unicode filenames, so the test doesn't fail
        on Mac OS X (#531476).


svn path=/trunk/; revision=7035
2008-06-13 03:56:26 +00:00
Michael Natterer
03a5797a62 don't define G_DISABLE_SINGLE_INCLUDES, it's in the global CPPFLAGS now.
2008-05-28  Michael Natterer  <mitch@imendio.com>

	* Makefile.am: don't define G_DISABLE_SINGLE_INCLUDES, it's in
	the global CPPFLAGS now.

	* tests/data-input-stream.c
	* tests/data-output-stream.c
	* tests/g-file-info.c
	* tests/g-file.c
	* tests/live-g-file.c
	* tests/memory-input-stream.c: don't include <glib/gtestutils.h>


svn path=/trunk/; revision=6954
2008-05-28 16:17:45 +00:00
Matthias Clasen
e14f918de9 2.17.0
svn path=/trunk/; revision=6948
2008-05-27 21:22:45 +00:00
Matthias Clasen
689a9e4b1a Revert the patch for bug 527214 and related changes. GTimer
is supposed to work without threads.


svn path=/trunk/; revision=6943
2008-05-27 16:00:51 +00:00
Matthias Clasen
cdc2910103 Make tests work
svn path=/trunk/; revision=6935
2008-05-26 05:57:09 +00:00
Tomas Bzatek
15e21178c6 Include live-g-file in standard set of tests, making a temporary directory
2008-03-13  Tomas Bzatek  <tbzatek@redhat.com>

        * tests/live-g-file.c:
        Include live-g-file in standard set of tests, making a temporary
        directory in source structure.

        Clean target directory before the tests (write mode only)


svn path=/trunk/; revision=6699
2008-03-13 16:32:31 +00:00
Alexander Larsson
5241d96b21 Fix sparse warnings (#519489)
2008-03-06  Alexander Larsson  <alexl@redhat.com>

        * gdesktopappinfo.c:
        * gfilemonitor.c:
        * gthemedicon.c:
        * gunionvolumemonitor.c:
        * gunixmounts.c:
        * tests/g-file.c:
        * tests/live-g-file.c:
        * xdgmime/xdgmimecache.c:
	Fix sparse warnings (#519489)


svn path=/trunk/; revision=6632
2008-03-06 09:53:35 +00:00
Alexander Larsson
767e18bf82 C89 fixes (#515892)
2008-02-12  Alexander Larsson  <alexl@redhat.com>

        * tests/live-g-file.c:
	C89 fixes (#515892)



svn path=/trunk/; revision=6506
2008-02-12 10:06:01 +00:00
Tomas Bzatek
d87c1c0af4 New GIO testing module working over real data
2008-02-06  Tomas Bzatek  <tbzatek@redhat.com> 

        * tests/Makefile.am:
        * tests/live-g-file.c: 
        * tests/live-g-file.txt:
        New GIO testing module working over real data


svn path=/trunk/; revision=6465
2008-02-06 13:52:07 +00:00