Commit Graph

130 Commits

Author SHA1 Message Date
Philip Withnall
dc243a5113 tests: Allow objcopy --help to fail, because it fails on FreeBSD
This is a partial revert of b248f3481c. Eventually, this commit can be
dropped once `objcopy --help` doesn’t exit with a non-zero status on
FreeBSD.

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2360#note_1318608

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-24 12:01:39 +00:00
Eli Schwartz
b248f3481c
meson: specify when commands need to succeed in run_command
meson in git master now warns about a missing `check:` kwarg, and may
eventually change the default from false to true.

Take the opportunity to require `objcopy --help` to succeed -- it is
unlikely to fail, but if it does something insane happened.
2021-11-24 00:31:18 -05:00
Bastien Nocera
18eb29897d gio: Add GPowerProfileMonitor tests
Tests both the portal and direct D-Bus variants.
2021-08-13 01:32:31 +02:00
Patrick Griffis
889bdb994f Add GPowerProfileMonitor 2021-07-28 15:56:02 +02:00
Philip Withnall
e522768ef4 tests: Allow GResource external data tests to use llvm-objcopy
Relax the requirement for the test to only be compiled/run under gcc,
since a version of LLVM was released which supports `--add-symbol`.

`objcopy` should be overrideable to be `llvm-objcopy` by using a machine
file as per https://mesonbuild.com/Machine-files.html#binaries.

Suggested and tested by Grigory Vasilyev.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2423
2021-06-14 14:49:59 +01:00
Philip Withnall
e02b905b4b Revert "tests: Deactivate tls-bindings test suite for windows"
This reverts commit 7f2fef5c26.

There have been some changes to the gitlab-ci-win32-runner pre-clone
script which should be more successful at killing the remaining
processes after this test. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2008#note_1127126
2021-06-03 13:01:29 +01:00
Frederic Martinsons
7f2fef5c26 tests: Deactivate tls-bindings test suite for windows
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

Helps: #2297
2021-03-23 11:11:45 +00:00
Iain Lane
373e46c2b2
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time
Calling `dlopen()` with `libutil.so` makes the installed tests depend on
having glibc's development files installed. To avoid this, we can work
out the runtime library name at build time and `dlopen` that instead.

This approach is [taken from libfprint][1], thanks to Marco Trevisan.

[1]: f401f399a8
2021-03-10 18:04:17 +00:00
Sebastian Dröge
e6f506a92c Merge branch 'fix/unix-stream-pollable-detection' into 'master'
gunix: Fix {Input,Output}Stream pollable detection

Closes #1180

See merge request GNOME/glib!1846
2021-02-02 10:46:52 +00:00
Ole André Vadla Ravnås
d7ee70c013 gunix: Fix {Input,Output}Stream pollable detection
For devices such as PTYs, where not being able to cancel a pending read
operation is problematic for many applications.

Fixes: #1180
2021-02-02 11:11:53 +01:00
Simon McVittie
5685546ab1 gio: Don't run gsocketclient-slow test under sanitizers
AddressSanitizer, UndefinedBehaviourSanitizer and probably others
involve adding instrumentation into the code under test, which doesn't
go well with LD_PRELOAD modules that absolutely need to be
self-contained.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-01 10:44:35 +00:00
Frederic Martinsons
d890b1ce5f Extend dbus watching name tests:
- use watcher auto start flag.
  - use watch_name_on_connection_with_closures.
  - use an existing service name for auto start.

Closes #2011

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-25 15:00:12 +01:00
Ruslan Marchenko
44524b9daa Add g_(d)tls_connection_get_channel_binding_data calls and enums
* Add g_tls_connection_get_channel_binding_data API call
 * Add g_dtls_connection_get_channel_binding_data API call
 * Add get_binding_data method to GTlsConnection class
 * Add get_binding_data method to GDtlsConnection interface
 * Add GTlsChannelBindingType enum with tls-unique and
   tls-server-end-point types
 * Add GTlsChannelBindingError enum and G_TLS_CHANNEL_BINDING_ERROR
   quark
 * Add new API calls to documentation reference gio-sections-common
2020-06-25 12:40:34 +00:00
Ross Burton
1fcd32a159 gio: use TAPTestRunner in the memory monitor tests
There are two memory monitor tests that use Python's unittest module directly,
but GLib tests should be outputting TAP.  Use the embedded TAPTestRunner to
ensure that TAP is output for these tests too.
2020-04-09 14:55:39 +01:00
Nirbheek Chauhan
b462e2c80c meson: Use the b_vscrt option for selecting the CRT
This option has been available since 0.48, and we should use it
instead of only guessing based on buildtype.
2020-04-03 16:39:22 +05:30
Jan Alexander Steffens (heftig)
7bdcfcf73a
tests: Move memory_monitor_tests under installed_tests_enabled
So they're not installed when the latter is disabled.
2020-02-28 14:10:25 +01:00
Philip Withnall
0f0af5ae3a tests: Mark gdbus-threading as non-flaky any more
See previous commits and #1515.

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

Fixes: #1515
2020-02-24 09:03:02 +00:00
Philip Withnall
2b533ca99a gdesktopappinfo: Use sh rather than gio-launch-desktop
There were some problems about where to install `gio-launch-desktop` to
support multiarch systems without circular dependencies. Simon McVittie
suggested that, actually, given the current set of platforms supported
by `GDesktopAppInfo` (they’re all POSIX), we could just use `sh`.

That simplifies things nicely. `gio-launch-desktop` can always be
resurrected (and the multiarch debate continued and resolved) if needed
in future.

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

Fixes: #1633
2020-02-14 18:09:18 +00:00
Philip Withnall
a0e74a8c47 Merge branch '1993-codegen-version-args' into 'master'
Rename gdbus-codegen --glib-min-version argument to --glib-min-required and add --glib-max-allowed

Closes #1993

See merge request GNOME/glib!1342
2020-01-31 13:49:20 +00:00
Xavier Claessens
6e8a7c2cd4 doc: Add back gdbus-object-manager-example
This requires Meson 0.52.0 for the return value of gnome.gtkdoc().
2020-01-29 15:40:17 +01:00
Philip Withnall
4d1c3e15f9 gdbus-codegen: Rename --glib-min-version to --glib-min-required
This makes it consistent with the `GLIB_MIN_REQUIRED` defines which are
used for API stability/versioning in C code.

It doesn’t otherwise change the behaviour of the `--glib-min-version`
argument.

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

Helps: #1993
2020-01-27 10:11:46 +00:00
Руслан Ижбулатов
9f070db4c5 GWin32AppInfo: Support rundll32-using applications
1) When parsing the executable name out of the command line,
see if the executable is rundll32.exe. If that is the case,
use the DLL name from its first argument as the "executable"
(this is used only for matching, and Windows Registry matches
these programs by their DLLs, so this is correct; for running
the application GLib would still use the command line, with
rundll32).

2) If an app runs with rundll32, ensure that rundll32 arguments
can be safely quoted. Otherwise GLib will break them with its
protective quotation.
2020-01-15 18:04:14 +00:00
Matthew Leeds
2a605f6e15 gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).

If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).

So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.

The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46

It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.

Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.

Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.

The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.

Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2020-01-15 09:37:41 -08:00
James Henstridge
926ff8c6a7 gio/tests: add a test for document portal use when launching flatpaks
We can't use session_bus_down() in the test since gdocumentportal.c
holds a reference to the session bus connection, preventing it from
being finalised.
2019-12-17 20:59:22 +08:00
James Henstridge
27db702ceb gio/tests: add a fake implementation of the document portal 2019-12-17 20:56:49 +08:00
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