Commit Graph

105 Commits

Author SHA1 Message Date
Bastien Nocera
8e8ee82580 tests: Add GMemoryMonitor installed-tests
Those tests require Python, gobject-introspection and python-dbusmock
making them unsuitable to be run within the uninstalled test suite.

There are no restrictions of dependencies when it comes to installed
tests so use those to exercise GMemoryMonitor.
2019-12-11 11:44:42 +00:00
Bastien Nocera
e08b10e997 gio: Add stub test program for GMemoryMonitor
"memory-monitor --watch" will watch over any events coming from either
low-memory-monitor or the portal.
2019-12-11 11:44:42 +00:00
Philip Withnall
41cabfaa98 tests: Add tests for the gdbus-codegen executable
Add a Python-based test wrapper for the `gdbus-codegen` executable,
similar to the existing tests for `glib-mkenums` and friends.

Add a few basic tests to begin with, but this doesn’t approach anywhere
near full coverage.

The next step is to move the existing Meson-based `gdbus-codegen` tests
from `gio/tests/meson.build` into the Python test suite.

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

Helps: #1612
2019-12-02 14:27:11 +00:00
Ignacio Casal Quinteiro
5fe61e8c46 Enable test about objcopy if it supports the --add-symbol parameter
This fixes building in old systems like centos 6.

(With tweaks by Philip Withnall.)

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1895
2019-11-21 11:16:24 +00:00
Simon McVittie
81936ca580 Make ld executable configurable
Tools like this should be configurable in a cross or native file. In
particular, if we are cross-compiling (with an executable wrapper like
qemu-arm), the build system ld is not necessarily able to manipulate
host system objects.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-11-04 15:08:33 +00:00
Philip Withnall
d44e00fb98 Merge branch 'issue1831' into 'master'
Avoid race condition authenticating GDBusServer with libdbus client (#1831)

Closes #1831

See merge request GNOME/glib!1176
2019-10-28 20:44:30 +00:00
Simon McVittie
9f962ebeac Add a test for GDBusServer authentication
In particular, if libbdus is available, we test interoperability with
a libdbus client: see GNOME/glib#1831. Because that issue describes a
race condition, we do each test repeatedly to try to hit the failing
case.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-28 19:56:47 +00:00
Philip Withnall
2d2e96dc51 tests: Use objcopy from the cross-compilation file, if configured
Otherwise we’ll end up using the host’s `objcopy`, which will output
object files in the wrong format.

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

Fixes: #1916
2019-10-28 12:08:48 +00:00
Ting-Wei Lan
fe3c16608a meson: Move libdl_dep to the top level
Instead of letting each directory to find its way to link with libdl,
it is easier to put the check in the top level, so its result can be
used by all directories.

It is a follow-up of https://gitlab.gnome.org/GNOME/glib/merge_requests/810.
2019-08-29 23:25:40 +08:00
Emmanuele Bassi
00d7568e4f build: Remove unsupported install directives
We're using the `install` argument for configure_file() all over the
place.

The support for an `install` argument for configure_file() was added in
Meson 0.50, but we haven't bumped the minimum version of Meson we
require, yet; which means we're getting compatibility warnings when
using recent versions of Meson, and undefined behaviour when using older
versions.

The configure_file() object defaults to `install: false`, unless an
install directory is used. This means that all instances of an `install`
argument with an explicit `true` or `false` value can be removed,
whereas all instances of `install` with a value determined from a
configuration option must be turned into an explicit conditional.
2019-07-24 12:45:02 +01:00
Chun-wei Fan
e8d471f3e1 meson: Mostly assume clang-cl is MSVC
We need to enable building the dirent and gnulib sources for clang-cl,
as we are still using the Microsoft-style headers and lib's and CRT.
We need to also do this for the following, for similar reasoning:

-Symbol export (via __declspec(dllexport))
-Dependency discovery without pkg-config files
-long long and ssize_t detection

We do, however, enable the autoptr tests for clang-cl builds.  Note that
at this point real MSVC builds are still better supported than clang-cl
builds, and it will likely remain so for at least the near future,
alhtough real MSVC builds of the GTK stack are consumable and are usable
by clang-cl.
2019-07-11 15:38:21 +08:00
Philip Withnall
505f45ef95 tests: Remove redundant --tap options
Now that TAP output is used by default, passing `--tap` is unnecessary.

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

Helps: #1619
2019-05-14 12:42:51 +01:00
Philip Withnall
c6342b975d tests: Don’t check for libdl on FreeBSD or NetBSD either
As with commit c14ac90ed2, it isn’t needed
and doesn’t exist.

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

Fixes: #1739
2019-05-02 13:00:48 +01:00
Philip Withnall
31c4a3afc5 Merge branch 'flaky-monitor' into 'master'
Remove monitor test

See merge request GNOME/glib!785
2019-04-30 10:04:03 +00:00
Antoine Jacoutot
c14ac90ed2 gio: tests, don't check for libdl on OpenBSD
libdl does not exist on OpenBSD and is not required as the
functionnality is provided in libc.
2019-04-27 18:45:45 +02:00
Emmanuele Bassi
5299e8754c Remove monitor test
The `monitor` test was originally written to test GFileMonitor with
directories. Over time, `testfilemonitor` acquired units for testing
directories as well, which made the `monitor` test reduntant.
2019-04-22 10:36:56 +01:00
Emmanuele Bassi
cd04cf7778 Merge branch '1614-freebsd-threading-flaky' into 'master'
tests: Unmark several gdbus-* tests as flaky

Closes #1614

See merge request GNOME/glib!777
2019-04-15 09:11:13 +00:00
Philip Withnall
b11f323ee5 tests: Only run --external-data test on GNU ld/objcopy
Other GCC-like implementations of ld/objcopy (like LLVM) don’t yet
support the right command line arguments, so can’t compile the test.

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

https://gitlab.gnome.org/GNOME/glib/issues/1709
2019-04-12 18:00:12 +01:00
Philip Withnall
ea8e6502d4 build: Refactor resources test build instructions
This introduces no functional changes, but combines two duplicated lists
and makes the meson.build file a little easier to follow.

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

Helps: #1711
2019-04-12 18:00:12 +01:00
Philip Withnall
a06d7cc7b8 build: Fix some whitespace problems in gio/tests/meson.build
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-12 18:00:12 +01:00
Philip Withnall
bc81b2c4cb tests: Unmark several gdbus-* tests as flaky
After repeated local testing, I can’t reproduce failures with them:

   meson test --repeat 5000 gdbus-auth
   meson test --repeat 5000 gdbus-bz627724
   meson test --repeat 5000 gdbus-connection

The FreeBSD failures from pthread calls mentioned in #1614 should
probably manifest as use-after-free for GMutex or pthread_mutex_t on
Linux. Failing that, I haven’t seen any relevant FreeBSD failures on CI
for at least a month, so if it’s not fixed, the chances of debugging are
very low.

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

https://gitlab.gnome.org/GNOME/glib/issues/1614
2019-04-12 17:08:22 +01:00
Руслан Ижбулатов
a53ff7460e Check for RTLD_NEXT
Check for RTLD_NEXT being present, and disable the gsocketclient-slow
test if it's absent, since the shlib dependency of that test requires
RTLD_NEXT to function.

This allows the testsuite to be built on Cygwin, which behaves
exactly like UNIX, but doesn't have RTLD_NEXT.
2019-03-27 16:10:17 +00:00
Philip Withnall
cf34d59bed Merge branch 'gdbus-win32-no-shortname' into 'master'
gdbusaddress, win32: don't rely on short names

Closes #1566

See merge request GNOME/glib!631
2019-03-15 10:21:08 +00:00
Vasily Galkin
b245344cec gdbus, tests, win32: test session dbus autolaunch
The test performs implicit autolaunching of a bus
and checks if it is connectible.

In build the test is moved from "only non-windows with have_dbus_daemon"
to "anywhere".

This is intentional: actually it doesn't execute any external
binaries on unix (so doesn't require dbus_daemon)
and now has win32 implementation.

The test has some problems that are not problems of test itself,
but are reasoned by current win32 implementation:

 - since the implementation uses global win32 kernel objects
with fixed names not depending on g_get_user_runtime_dir or other context
if preexisting bus running by some other libgio-using application
the test would silently pass.

 - since the implementation uses problematic time-based synchronization,
that has a race condition between opening and reading mmaped address,
the test may randomly fail (I'd not seen this in practice).

 - since the implementation autolaunched process works for 3 seconds
after last client disconnects, the executed subprocess runs for 3 seconds
after test exit, maybe locking the libgio-2.0-0.dll file for that time.
2019-03-12 21:54:47 +03:00
Vasily Galkin
b1f7c22a24 gdbus, tests: rename gdbus-unix-addresses test to gdbus-address-get-session
In preparation of adding non-unix testcase to the test.
2019-03-12 21:53:43 +03:00
Philip Withnall
d89f18bb22 build: Add -UG_DISABLE_ASSERT when building tests
In order to allow GLib itself to be built with G_DISABLE_ASSERT defined,
we need to explicitly undefine it when building the tests, otherwise
g_test_init() turns into an abort.

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

Fixes: #1708
2019-03-08 19:46:20 +00:00
Philip Withnall
0d63ee0908 Merge branch 'wip/tingping/socket-client-slow-fix' into 'master'
gsocketclient: Fix critical on cancellation

Closes #1693 and #1653

See merge request GNOME/glib!688
2019-02-27 14:35:53 +00:00
Patrick Griffis
f0fcb68da5 tests: Unmark gsocketclient-slow as flaky
Closes #1653
2019-02-27 09:20:28 -05:00
Philip Withnall
07414e17ef tests: Unmark socket-service test as flaky
This essentially reverts commit
cffed58737.

The preceding two commits have fixed the test so it’s no longer flaky.
The following command gives 5000 passes in a row for me:

meson test -C /opt/gnome/build/glib/ socket-service --repeat 5000

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

Fixes: #1679
2019-02-21 18:15:49 +00:00
Felix Potthast
45655b8265 glib-compile-resources: Fixes #1675 2019-02-20 10:38:29 +00:00
Christoph Reiter
11309b7940 Revert "tests: Mark gdbus-peer test as flaky". See #1686
This reverts commit 983a40bf34.
2019-02-14 14:20:32 +01:00
Philip Withnall
983a40bf34 tests: Mark gdbus-peer test as flaky
It is occasionally deadlocking. See #1686.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-13 12:04:26 +00:00
Iain Lane
1ecaae6454
installed-tests: Install the slow-connect-preload.so library and use it
The gsocketclient-slow test needs this, otherwise connect() succeeds
immeidately and the test fails, because it is checking that cancellation
works. We weren't installing it for installed tests.
2019-02-13 09:45:08 +00:00
Iain Lane
07a1a8031d
installed tests: Allow tests to set environment variables
It's necessary sometimes for installed tests to be able to run with a
custom environment. For example, the gsocketclient-slow test requires an
LD_PRELOADed library to provide a slow connect() (this is to be added in
a followup commit).

Introduce a variable `@env@` into the installed test template, which we
can override as necessary when generating `.test` files, to run tests
prefixed with `/usr/bin/env <LIST OF VARIABLES>`.

As the only test that requires this currently lives in `gio/tests/`, we
are only hooking this up for that directory right now. If other tests in
future require this treatment, then the support can be extended at that
point.
2019-02-13 09:43:49 +00:00
Iain Lane
cc12f3f253
gio tests: Install test1.overlay file when building installed tests
This is used as a GResource overlay, so it must be available to the
test.
2019-02-11 10:21:13 +00:00
Patrick Griffis
5827cef22d tests: Unmark network-address test as flaky 2019-02-07 11:56:22 -05:00
Philip Withnall
cffed58737 tests: Tag socket-service test as ‘flaky’
It needs investigating and fixing properly, but let’s not let it disrupt
the CI in the meantime.

Follow-up in https://gitlab.gnome.org/GNOME/glib/issues/1679.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-02-06 12:50:38 +00:00
Philip Withnall
5612c90fdf tests: Tag gsocketclient-slow test as ‘flaky’
It needs investigating and fixing properly, but let’s not let it disrupt
the CI in the meantime.

Follow-up in https://gitlab.gnome.org/GNOME/glib/issues/1653.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-18 15:27:45 +00:00
Philip Withnall
956a54d6d6 tests: Tag several rogue GIO tests as ‘flaky’
These have been flaky for a while now, and nobody has found the time to
fix them properly. They’ve been disrupting development for altogether
far too long.

They need investigating in the following issues, fixing properly, and
the ‘flaky’ tag removing from each one:
 • https://gitlab.gnome.org/GNOME/glib/issues/1644https://gitlab.gnome.org/GNOME/glib/issues/1634https://gitlab.gnome.org/GNOME/glib/issues/1614https://gitlab.gnome.org/GNOME/glib/issues/1515

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-09 10:48:42 +00:00
Ninja-Koala
d04b9c371d glib-compile-resources: Add external data option
Add option to not encode resource data into the C source file
in order to embed the data using `ld -b binary`. This improves compilation
times, but can only be done on Linux or other platforms with a
supporting linker.

(Rebased by Philip Withnall, fixing minor rebase conflicts.)

Fixes #1489
2018-12-19 16:43:21 +00:00
Philip Withnall
1ea4ba8d6e tests: Use static appinfo .desktop file when not launching
The appinfo-test.desktop file is set up with an Exec= path which points
to the compiled and installed appinfo-test utility. When running the
tests uninstalled, however, this might not be present, which causes
loading appinfo-test.desktop to fail.

Split appinfo-test.desktop in two: keep the existing
appinfo-test.desktop for tests which need to launch appinfo-test, and
add a new appinfo-test-static.desktop for tests which don’t launch
anything (and, for example, just inspect GAppInfo properties).
appinfo-test-static.desktop uses an Exec= line which should always be
present (`true`) so it should never fail to load.

Allow the tests using appinfo-test-static.desktop to be run uninstalled
or installed. Allow the tests using appinfo-test.desktop to be skipped
if loading appinfo-test.desktop fails, which is an indicator that the
test is running uninstalled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
46f47641c5 tests: Avoid chdir() call at the start of appinfo tests
By encoding the path to the appinfo-test binary in the .desktop files,
we can avoid a chdir() call in the tests, which was a bit ugly.

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

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
b4479d97d5 Revert "Meson: appinfo tests are racy if run in parallel"
This partially reverts commit 27b5fb5892.

The infrastructure for disabling a test is kept, but the appinfo and
desktop-app-info tests no longer need to be run serially.

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

https://gitlab.gnome.org/GNOME/glib/issues/1601
2018-12-17 17:16:03 +00:00
Patrick Griffis
8b9e88937b tests: Add gsocketclient test for slow connections 2018-12-11 16:12:48 -05:00
Patrick Griffis
35e41862c2 gnetworkaddress: Implement parallel ipv4 and ipv6 dns lookups
As RFC 8305 recommends we can start multiple DNS queries in parallel
to more quickly make an initial response, especially when one is
particularly slow/broken.
2018-12-11 16:09:29 -05:00
Philip Withnall
af39a37312 Merge branch 'fix-gdbus-codegen--interface-info' into 'master'
fix gdbus-codegen --interface-info-{header,body}

See merge request GNOME/glib!514
2018-12-11 12:25:31 +00:00
Will Thompson
335a01ebe4
gdbus-codegen: test --interface-info-{header,body}
This test is rudimentary but better than nothing.
2018-12-11 09:49:22 +00:00
Chun-wei Fan
cd30faae1f gresources: Add a test with resources > 64kb
This is to ensure that the generated code is still compilable by the
running compiler, and see whether we can read the things in there
properly.

See issue #1580.
2018-12-05 18:27:16 +08:00
Xavier Claessens
9534447eb0 Merge branch 'fix-gio-test-build' into 'master'
Meson: Fix build error in gdbus-example-objectmanager

See merge request GNOME/glib!461
2018-11-14 15:37:05 +00:00
Cosimo Cecchi
47be0f7a23 gdbusproxy: make g-name-owner property useful with unique names
Currently, GDBusProxy:g-name-owner only notifies changes to the unique
name owner of the remote object in case the proxy was constructed for a
well-known name.
That sounds like an artificial restriction, and it's convenient to
connect to notify::g-name-owner if a proxy instance has already been
created for an unique name, instead of additionally using
g_bus_watch_name() to track the owner.

To fix this, always connect to NameOwnerChanged after the proxy is
initialized, instead of only doing so when the proxy was constructed for
a well-known name.

https://bugzilla.gnome.org/show_bug.cgi?id=791316
https://gitlab.gnome.org/GNOME/glib/issues/1310
2018-11-10 03:53:32 +00:00