Commit Graph

1273 Commits

Author SHA1 Message Date
Stef Walter
92a01e2280 gdbus-connection-loss: Fix leak in test
https://gitlab.gnome.org/GNOME/glib/issues/786
2018-07-05 13:13:59 +01:00
Philip Withnall
4dc927fc2f Merge branch 'ci-memcheck-preparation' into 'master'
Preparation for adding valgrind/memcheck to CI

See merge request GNOME/glib!143
2018-06-29 13:31:43 +00:00
Philip Withnall
f7bd41fdaa tests: Fix leak when checking for du binary
g_find_program_in_path() returns a pointer, not a boolean.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-29 12:13:32 +01:00
Philip Withnall
93b519b104 tests: Various minor leak fixes in the GIO tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-29 12:13:32 +01:00
Philip Withnall
68526565f4 tests: Fix use-after-free in the appinfo tests
When changing the locale using setlocale(), duplicate the old locale
value before updating it, so that we can safely restore the old locale
after running the test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-29 12:13:32 +01:00
Ondrej Holy
51132b1d49 Merge branch 'cifs-is-not-a-system-fs' into 'master'
gunixmounts: Stop considering cifs/nfs as system file systems

See merge request GNOME/glib!125
2018-06-29 07:07:24 +00:00
Philip Withnall
4993f2b7e5 Merge branch 'wip/muktupavels/per-desktop-overrides' into 'master'
GSettings: per-desktop overrides

Closes #1013

See merge request GNOME/glib!105
2018-06-25 10:32:44 +00:00
Alberts Muktupāvels
b618ec40a7 Add a test for per-desktop overrides 2018-06-22 22:02:31 +03:00
Philip Withnall
ca98ce4280 Merge branch 'master' into 'master'
Use posix_spawn for optimized process launching

See merge request GNOME/glib!95
2018-06-21 17:10:43 +00:00
Daniel Drake
156d009696 gdesktopappinfo: add g_desktop_app_info_launch_uris_as_manager_with_fds variant
Add an app-launching function which allows standard file descriptors
to be passed to the child process.

This will be used by gnome-shell to pass systemd journal descriptors
as stdout/stderr. gnome-shell's child_setup function can then be
eliminated, which will enable use of the posix_spawn optimized
gspawn codepath for desktop app launching.
2018-06-21 11:44:59 -05:00
Daniel Drake
742efe6232 gdesktopappinfo: enable fast posix_spawn gspawn codepath
In order to use the new posix_spawn gspawn codepath, for more robust
app launching when available memory is low, we need to meet some
conditions.

child_setup needs to be NULL for this optimization to work, so drop
the internal child_setup that is used here. Replace it with a lightweight
wrapper binary (gio-launch-desktop) that sets GIO_LAUNCHED_DESKTOP_FILE_PID
before executing the app.

Adjust PATH for gio tests so that it can execute the new binary from the
build directory.
2018-06-21 11:44:28 -05:00
segfault
76b4d0ab3f Add support for TCRYPT volumes to GMountOperation
Add G_ASK_PASSWORD_TCRYPT flag to GAskPasswordFlags and add the
following properties to GMountOperation:

- hidden_volume [1]
- system_volume [2]
- pim [3]

[1] https://www.veracrypt.fr/en/Hidden%20Volume.html
[2] https://www.veracrypt.fr/en/System%20Encryption.html
[3] https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html
2018-06-21 15:32:04 +02:00
Philip Withnall
a3a6c516c4 gunixmounts: Stop considering cifs/nfs as system file systems
They’re network file systems, but not system file systems (in the sense
that procfs is a system file system). This fixes them disappearing from
the sidebar in the UI.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1424
2018-06-20 12:16:34 +01:00
Philip Withnall
1c673535fe tests: Add basic tests for GMountOperation
There were previously no tests for it. These take gmountoperation.c up
to 85.5% coverage of lines.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1423
2018-06-19 15:46:59 +01:00
Philip Withnall
40a84b3d1c Merge branch 'wip/lantw/freebsd-kqueue-complex' into 'master'
FreeBSD kqueue file monitor fixes: the complex parts

See merge request GNOME/glib!77
2018-06-19 11:19:43 +00:00
Ting-Wei Lan
454a9f8de9 tests: Make testfilemonitor test work with kqueue
check_expected_events is heavily modified in this commit to tolerate
event loss and allow renaming to be reported as creation and deletion.

This fixes test failure on FreeBSD.
2018-06-17 11:26:32 +08:00
Will Thompson
ba7b035f5b
g_dbus_is_supported_address(): set error if returning FALSE
Previously, calling:

    g_dbus_is_supported_address ("some-imaginary-transport:", NULL)

correctly returned FALSE; but calling:

    g_dbus_is_supported_address ("some-imaginary-transport:", &error)

crashed with:

    GLib-GIO:ERROR:../gio/gdbusaddress.c:434:g_dbus_is_supported_address:
    assertion failed: (ret || (!ret && (error == NULL || *error != NULL)))

This was because, if the address component did not start with a known
transport, no error was set. Fix this, reusing an error string used by
the corresponding else branch in g_dbus_address_connect(), and adjust
the test to pass both NULL and non-NULL GError **s to this function in
every test case. This case:

    g_assert (!g_dbus_is_supported_address ("some-imaginary-transport:foo=bar;unix:path=/this/is/valid", NULL));

would have caught this bug with a non-NULL GError **.
2018-06-13 11:01:56 +01:00
Philip Withnall
18a34845b5 Merge branch 'classify-test-suites' into 'master'
Classify the tests

See merge request GNOME/glib!91
2018-06-11 11:02:09 +00:00
Philip Withnall
262b153c41 Merge branch 'wip/lantw/freebsd-meson-builds' into 'master'
Fix meson build files for FreeBSD

See merge request GNOME/glib!73
2018-06-11 10:53:10 +00:00
Philip Withnall
379e8fd22d Merge branch 'wip/lantw/freebsd-gettext-tests' into 'master'
tests: Set both environment variable and locale when running tests

See merge request GNOME/glib!69
2018-06-11 10:51:35 +00:00
Emmanuele Bassi
16d1a3d28c Classify the tests
Meson has the ability to classify tests according to "suites", a list of
tags. This is especially useful when we want to run specific sets of
tests — e.g. only GLib's tests — instead of the whole test suite. It
also allows us to classify special tests, like "slow" ones, so that we
can only run them when needed.
2018-06-10 15:33:06 +01:00
Philip Withnall
e22bffb522 Merge branch 'wip/oholy/trashing-locations2' into 'master'
Resubmit of reverted trash related changes and tests

See merge request GNOME/glib!83
2018-06-09 00:28:09 +00:00
Philip Withnall
e3280675f5 Merge branch 'wip/lantw/freebsd-kqueue-simple' into 'master'
FreeBSD kqueue file monitor fixes: the simple parts

See merge request GNOME/glib!76
2018-06-08 21:36:27 +00:00
Ting-Wei Lan
6f2b3503a5 tests: Set both environment variable and locale when running tests
Non-glibc gettext implementation seems to decide the language from
LC_MESSAGES environment variable instead of LC_MESSAGES locale, so
we should set both environment variable and locale when running tests
which need translation from specific languages.
2018-06-09 02:40:01 +08:00
Ting-Wei Lan
313a0fffe5 tests: Use de_DE.UTF-8 instead of de_DE in gsettings test
FreeBSD doesn't have a de_DE locale without encoding suffix.
2018-06-09 02:40:01 +08:00
Ondrej Holy
83ca61a421 glocalfile: Add test case for g_file_trash
g_local_file_trash has been changed to return G_IO_ERROR_NOT_SUPPORTED
for locations on system-internal mounts. Let's verify that.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 13:27:13 +02:00
Philip Withnall
da3daf2803 Revert "Merge branch 'wip/oholy/trashing-locations' into 'master'"
This reverts merge request !49
2018-06-07 16:42:57 +00:00
Philip Withnall
be43436435 Merge branch '1400-g_file_attribute_unix_is_mountpoint-is-false-for-root' into 'master'
Resolve "G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT is False for /"

Closes #1400

See merge request GNOME/glib!51
2018-06-07 09:22:07 +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
Ting-Wei Lan
f288898485 tests: Use g_idle_add to call g_main_loop_quit
Sometimes file monitor events may be slow to emit. Using g_idle_add
makes it less possible for events to be scheduled later than the main
loop quit, preventing test failure caused by missing events.

This fixes test failure on FreeBSD.
2018-06-07 00:38:07 +08:00
Ting-Wei Lan
70e4ca0340 tests: Don't run file creation and deletion test on kqueue
Kqueue isn't good at detecting rapid file creation and deletion. It
tends to miss events because events returned by the kernel don't include
filename information. Since the size of struct kevent is fixed, it is
probably not possible to extend the API to include file names without
breaking ABI. Therefore, we disables the test here to avoid test failure
that is impossible to fix in a reliable way.
2018-06-07 00:38:07 +08:00
Ting-Wei Lan
bfbeb6f0f5 tests: Don't fail when not using du from GNU coreutils
The test 'file' uses non-standard '--bytes' option when running du,
which may cause error on non-GNU systems. To keep the test working,
we skips the du check as if we don't find a du command when du fails.
2018-06-07 00:37:28 +08:00
Ting-Wei Lan
12a7f27256 meson: Don't use -export-dynamic
-export-dynamic is a libtool flag. It is also supported by GCC as an
undocumented flag, but it is not supported by Clang. Since we don't use
libtool in meson, we should use -Wl,--export-dynamic instead.
2018-06-07 00:34:36 +08:00
Ondrej Holy
f7e80f8d0c glocalfile: Add test case for g_file_trash
g_local_file_trash has been changed to return G_IO_ERROR_NOT_SUPPORTED
for locations on system-internal mounts. Let's verify that.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-06 12:18:30 +02:00
Xavier Claessens
f929d14826 Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set
This test assumes the subprocess does not print anything else on stdout
other than the dbus address, otherwise g_test_trap_assert_stdout()
fails to match. But if the env running tests has G_MESSAGES_DEBUG=all
then it will also print "PATH=%s".
2018-06-01 10:23:12 -04:00
Nirbheek Chauhan
458b6288bf gengiotypefuncs.py: Read and parse files in binary mode
Fixes this build error on macOS when inside an ssh terminal:

Traceback (most recent call last):
  File "[...]/gio/tests/gengiotypefuncs.py", line 23, in <module>
    for line in f:
  File "[...]/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2625: ordinal not in range(128)

https://bugzilla.gnome.org/show_bug.cgi?id=796328
2018-05-22 14:34:17 +05:30
Xavier Claessens
7b8d8835f5 Meson: libintl is a public dependency of glib-2.0
On non-glibc platforms gettext is provided by extra libintl dependency.
We wrongly thought libintl is an internal dependency and applications
needs to explicitly link on it, but turns out that breaks many
applications and with autotools the .pc generated actually has -lintl in
public "Libs:".

https://bugzilla.gnome.org/show_bug.cgi?id=796085
2018-05-15 13:00:44 -04:00
Christoph Reiter
fe9457dedd gliststore: Improve the test coverage
https://bugzilla.gnome.org/show_bug.cgi?id=795307
2018-04-30 13:02:41 +02:00
Christoph Reiter
758d7073a9 g_list_store_splice: Add items in the order of the input array and at the given position
It inserted the new items one position after the given one and inserted all new items
at the same position resulting in the items being in the reverse order of the
input array.

It was decided to make these behavioural changes because this function has according to
https://codesearch.debian.net/search?q=g_list_store_splice only one real user (nautilus)
and it didn't do what one would expect from reading the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=795307
2018-04-30 13:02:41 +02:00
Philip Withnall
9b4c50f63d all: Remove trailing newlines from g_message()/g_warning()/g_error()s
All those logging functions already add a newline to any message they
print, so there’s no need to add a trailing newline in the message
passed to them.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-27 16:46:19 +01:00
Philip Withnall
8056b753e5 tests: Fix a free function in the GIO tests
The monitor_path comes from g_file_get_path(), so should be freed with
g_free() rather than free(). This makes no difference because they are
the same function in practice, but using free() is a bit confusing.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 15:36:11 +01:00
Philip Withnall
9365e212f8 More const-correctness fixes
This continues one of the const-correctness fixes from the previous
commit (it needed some more transitive fixes), and reverts another of
them, since it was over-zealous.

This fixes CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/27125.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 15:35:58 +01:00
Philip Withnall
22cd18500d Fix various const-correctness issues
Spotted when temporarily compiling with -Wwrite-strings. This only goes
a small way towards making the code base -Wwrite-strings–clean. It
introduces no functional changes, and fixes no bugs.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 15:19:17 +01:00
Florian Müllner
f9f497a702 tests: Add .desktop file for non-existent binary ...
... to test that it is filtered out correctly by
g_desktop_app_info_load_from_keyfile() (but not
g_desktop_app_info_search()).

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-26 16:03:39 +02:00
Xavier Claessens
d123717947 Meson: Add missing link on libintl in tests
This fix undefined symbol link error when building for non-glibc
platform. Applications must link on libintl, it is not a public
dependency of libglib.

On glibc platforms libintl is a not found dependency and is just ignored
by meson, so it doesn't hurt to always have it.

https://bugzilla.gnome.org/show_bug.cgi?id=795406
2018-04-25 13:56:14 -04:00
Florian Müllner
6343555605 tests: Fix desktop-app-info test
g_desktop_app_info_load_from_keyfile() refuses to load .desktop files
where the executable doesn't exist. Therefore whether or not the .desktop
file added in commit 148995544 is actually considered during tests depends
on /usr/bin/flatpak being installed. This isn't a safe assumption to make,
so use /bin/sh to test filtering of "prefix" commands.

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-24 18:36:05 +02:00
Florian Müllner
1e2579da2c gdesktopappinfo: Filter out some binary names in search
The executable name can be a useful bit of information to match on in
searches where it differs from the name (for example because the latter
is localised), but will produce surprising results where the real appli-
cation is executed by a shared binary (for example interpretors like
gjs or python, or sandboxes like flatpak).

Address this by adding a blacklist of binary names that are ignored
in search.

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-24 13:11:00 +02:00
Florian Müllner
1489955444 tests: Use gnome-clocks from flatpak
It's the future (and provides us with a new test case) ...

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-24 13:11:00 +02:00
Xavier Claessens
5ccd9449fb Tests: gsubprocess: Do not use stdin/stdout variables
https://bugzilla.gnome.org/show_bug.cgi?id=795406
2018-04-20 15:33:31 -04:00
Philip Withnall
d57f3e0a9b tests: Fix a minor memory leak in the GFileMonitor tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:13:02 +01:00