Commit Graph

123 Commits

Author SHA1 Message Date
Philip Withnall
00bfb3ab44 tree: Fix various typos and outdated terminology
This was mostly machine generated with the following command:
```
codespell \
    --builtin clear,rare,usage \
    --skip './po/*' --skip './.git/*' --skip './NEWS*' \
    --write-changes .
```
using the latest git version of `codespell` as per [these
instructions](https://github.com/codespell-project/codespell#user-content-updating).

Then I manually checked each change using `git add -p`, made a few
manual fixups and dropped a load of incorrect changes.

There are still some outdated or loaded terms used in GLib, mostly to do
with git branch terminology. They will need to be changed later as part
of a wider migration of git terminology.

If I’ve missed anything, please file an issue!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-12 15:01:08 +01:00
Simon McVittie
44c004c84e Normalize C source files to end with exactly one newline
Some editors automatically remove trailing blank lines, or
automatically add a trailing newline to avoid having a trailing
non-blank line that is not terminated by a newline. To avoid unrelated
whitespace changes when users of such editors contribute to GLib,
let's pre-emptively normalize all files.

Unlike more intrusive whitespace normalization like removing trailing
whitespace from each line, this seems unlikely to cause significant
issues with cherry-picking changes to stable branches.

Implemented by:

    find . -name '*.[ch]' -print0 | \
    xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-10 09:48:02 +01:00
Sebastian Dröge
153ac4c82a Run the accumulator function for RUN_CLEANUP object handlers too
Closes issue #512
2019-08-25 19:31:48 +02: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
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
Philip Withnall
b3efef5b6f build: Drop autotools support
So long, and thanks for everything. We’re a Meson-only shop now.

glib-2-58 will remain the last stable GLib release series which is
buildable using autotools.

We continue to install autoconf macros for autotools-using projects
which depend on GLib; they are stable API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-15 15:11:43 +00:00
Simon McVittie
13e206aaeb meson: Centralize test timeout values
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-01 19:13:21 +00:00
Xavier Claessens
24d7a73b93 Meson: Bump dependency to 0.48.0 2018-09-27 16:01:41 -04:00
Simon McVittie
129512b67c Autotools: Always run glib-genmarshal, even if cross-compiling
glib-genmarshal is now written in Python rather than C, so we can
always run it directly, even if we're cross-compiling for an
architecture whose binaries we can't run. This matches the behaviour
of the Meson build system.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1546
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908334
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-26 16:57:57 +01:00
Simon McVittie
cbc7fbbf7d meson: Run build-time tests with --tap where supported
This makes it easier to debug test failures, by ensuring that g_debug()
and g_test_message() are printed as TAP diagnostics.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1528
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-24 23:37:12 +01:00
Xavier Claessens
178b943be7 Meson: Install timeloop-closure test 2018-09-24 11:21:27 -04:00
Xavier Claessens
8391219e4c Meson: Run in TAP mode installed tests that support it 2018-09-23 13:44:15 -04:00
Xavier Claessens
4b5bc3f459 Meson: build and install remaining tests 2018-09-21 08:45:54 -04:00
Philip Withnall
2a69cdb1cd build: Stop distributing generated files in autotools tarballs
It is a bug if we distribute files which are generated at build time —
they should be built on the machine which is compiling GLib, not be
shipped in the tarball.

This brings the autotools-generated tarball in line with the
ninja-generated one, with the exception of man pages and gtk-doc HTML
output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-30 19:58:24 +01:00
Emmanuele Bassi
7e5db31d36 Deprecate g_type_class_add_private()
It's been 4 years and 8 development cycles since we introduced
G_ADD_PRIVATE and offset-based private data access. It is now
time to finally deprecate the old mechanism.

Closes: #699
2018-06-14 11:33:53 +01: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
Xavier Claessens
27ec1469ab Remove developer script not needed in git repository 2018-06-04 22:27:22 -04:00
Xavier Claessens
b04cf01934 Remove old tests not being built since 2012
Those tests are failing and are not built since commit d6a075b
2018-06-04 22:18:02 -04:00
Philip Withnall
cc4de801c9 gobject: Reimplement g_param_values_cmp() for GParamSpecVariant
The existing implementation was completely incorrect (despite the fix in
commit 566e64a66) — it always compared GVariants by pointer, rather than
by value.

Reimplement it to compare them by value where possible, depending on
their type. The core of this implementation is g_variant_compare(). See
the documentation and tests for further details of the new sort order.

This adds documentation and tests.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795735
2018-05-04 18:17:59 +01:00
Emmanuele Bassi
94d4e8b2fb Initialize variables before using them
Avoid a compiler warning when using the average, minimum, and maximum
elapsed variables without initializing them.

https://bugzilla.gnome.org/show_bug.cgi?id=794732
2018-03-28 11:49:59 +01:00
Christian Hergert
f44472e715 gobject: fix typecasts via g_object_ref
Now that g_object_ref() propagates the parameter type to the
return value, we need to cast to ensure the result is warning
free.

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-04 11:42:58 +00:00
Philip Withnall
f2c093f657 build: Drop --enable-rebuilds configure option
It is outdated and no longer effectively used. It was originally in
place to prevent rebuilding generated files (from a tarball) if the
right build tools (awk, Perl, indent) were not available. However, we no
longer use indent, we have hard-required awk for a while, and the only
places the @REBUILD@ substitution was still used were for
glib-genmarshal, which has recently been rewritten in Python (so no
longer depends on whether Perl is available).

Drop the whole lot.

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

https://bugzilla.gnome.org/show_bug.cgi?id=694723
2017-11-17 15:11:47 +00:00
Emanuele Aina
e73831d808 tests: Re-wire the testgobject test program to the build system
After the build system rework in commit f9eb9e testgobject fell through
the cracks and was not built since then.

Re-enable it, even if it is currently failing due to commit 31fde56.

(Tweaked by Philip Withnall to add meson.build support.)

https://bugzilla.gnome.org/show_bug.cgi?id=701156
2017-11-17 12:27:10 +00:00
Emanuele Aina
edcabe1a4e tests: Don't assume that private data follows the instance data
Commit 31fde56 changed the way the private data is laid out in memory by
putting it *before* the instance data to keep the offsets fixed
regardless of the number of many subclasses.

This means that the invariant testgobject was verifying is no longer
true and the failing tests can be safely dropped.

https://bugzilla.gnome.org/show_bug.cgi?id=701156
2017-11-17 12:26:23 +00:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Emmanuele Bassi
a45bf85ce5 tests: Do not use gnome.genmarshal()
We are providing glib-genmarshal; using the gnome module in Meson does
not call the just built glib-genmarshal tool.
2017-07-17 13:59:20 +01:00
Emmanuele Bassi
3c03cc8f68 meson: Simplify the use of built tools
The Meson build has fallen a bit behind the Autotools one, when it comes
to the internally built tools like glib-mkenums and glib-genmarshals.

We don't need to generate gmarshal.strings any more, and since the
glib-genmarshal tool is now written in Python it can also be used when
cross-compiling, and without indirection, just like we use glib-mkenums.

We can also coalesce various rules into a simple array iteration, with
minimal changes to glib-mkenums, thus making the build a bit more
resilient and without unnecessary duplication.
2017-07-17 11:05:07 +01:00
Tim-Philipp Müller
2e9fd74b25 meson: add tests/gobject and tests/refcount 2017-07-13 19:03:39 -04:00
Sébastien Wilmet
f6c44ec3e4 tests/: LGPLv2+ -> LGPLv2.1+
gen-casefold-txt.pl and gen-casemap-txt.pl are licensed under GPLv2+, so
they are not touched by this commit.

A lot of *.c files in tests/ don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:35 +02:00
Philip Withnall
a05b64a0cb build: Use AM_TESTS_ENVIRONMENT rather than TESTS_ENVIRONMENT
TESTS_ENVIRONMENT is reserved for the user to be able to set when
running the tests. AM_TESTS_ENVIRONMENT is for the tests’ Makefile to
set itself.

https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html

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

https://bugzilla.gnome.org/show_bug.cgi?id=782996
2017-05-23 13:29:40 +01:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Emmanuele Bassi
5ce70917df Drop binary checks when cross-compiling
We don't need to run binaries we just built in order to successfully
build GLib and friends any more.

Since commit b74e2a7, we don't need to run glib-genmarshal when building
GIO; since commit f9eb9eed, all our tests (including the ones that do
need to run binaries we just built) are only built when running "make
check", instead of unconditionally at every build.

This means that we don't need to check for existing, native binaries
when cross-compiling, and fail the configuration step if they are not
found — which also means that you don't need to natively build GLib for
your toolchain, in order to cross-compile GLib.

We can also use the cross-compilation conditional, and skip those tests
that require a binary we just built in order to build.

https://bugzilla.gnome.org/show_bug.cgi?id=753745
2015-09-01 10:40:24 -04:00
Alexander Larsson
2266f6b743 tests/gobject/performance: Clean up and add refcount performance test 2014-07-30 12:10:30 +02:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Michael Haubenwallner
b1af471a3f build: Give internal libraries higher precedence
Linking local libraries too late may cause preinstalled libraries to
get found earlier, due to external library paths in .la files.

https://bugzilla.gnome.org/show_bug.cgi?id=712314
2013-11-19 08:11:35 -05:00
Stef Walter
aa7ec15091 Revert "defaultiface: Fix leak in test"
This reverts commit fd7b2faa64.

This required another patch to be commited first. Will put this
back in bugzilla.
2013-11-11 17:06:38 +01:00
Stef Walter
fd7b2faa64 defaultiface: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:27:22 +01:00
Stef Walter
bac4179476 timeloop-closure: Fix leaks in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:27:15 +01:00
Stef Walter
d8722441d1 signals: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:27:01 +01:00
Stef Walter
1b9662046f paramspec-test: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:26:53 +01:00
Stef Walter
320f0b32de override: Fix leaks in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:26:37 +01:00
Stef Walter
e6de9c6940 gvalue-test: Fix leaks in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:26:28 +01:00
Stef Walter
83301d8c1f accumulator: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:26:20 +01:00
Dan Winship
c9ac45a023 .gitignore: add "signals" 2013-09-28 10:39:01 -04:00
Ray Strode
29ef821766 tests: add signal disconnection test
This commit adds a test to ensure that during a signal emission, if
a signal handler gets disconnected, it won't be run, even if it would
have run before the disconnection.
2013-09-20 16:06:02 -04:00
Ryan Lortie
601a00fa2a Change a pair of TESTS = to TEST += 2013-06-01 09:55:13 -04:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Ryan Lortie
210b1f8b42 Remove a bunch of lingering g_thread_init()
After this patch, there is but one remaining use of g_thread_init(),
which is in tests/slice-threadinit.c, a testcase dedicated to testing
the functionality of gslice across a g_thread_init() boundary.

This testcase is pretty meaningless these days... probably we should
delete it.
2013-05-31 23:03:19 -04:00
Ryan Lortie
d7b3e558cf Move a pair of gobject tests to tests/gobject/
testgobject.c and timeloop-closure.c are the only two tests in the
toplevel tests/ directory that depend on gobject, so move them to
tests/gobject/ along with the other gobject tests.

Both of these were in noinst_PROGRAMS and not TESTS, so keep them that
way when we move them.
2013-05-31 23:03:19 -04:00
Colin Walters
0b167b0ae9 build: Fix usage of %.test again
We actually need the first dependency because it includes the
final executable name.  Rather, fix the original bug by using
the variable $(EXEEXT).
2013-05-24 22:16:44 +01:00