Commit Graph

20616 Commits

Author SHA1 Message Date
Philip Withnall
d5093350f3 gqueue: Remove a redundant branch
queue->tail->next cannot be non-NULL, as pushing onto the end of the
queue is handled by the call to g_queue_push_tail_link() above.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-02 13:53:09 +01:00
Philip Withnall
4f38620b13 tests: Add unit tests for g_queue_push_nth_link()
This should get its branch coverage up to 100%. For completeness’ sake.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-02 13:53:09 +01:00
Philip Withnall
f033948998 tests: Add a test for calling g_queue_clear_full() with a NULL free_func
This improves the branch coverage of gqueue.c a little.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-02 13:53:09 +01:00
Philip Withnall
2aa71ab63b tests: Rearrange assertions in the g_queue_clear_full() test
This makes it a bit clearer that we expect the queue to be empty as a
result of calling g_queue_clear_full(), rather than as a result of any
of the later cleanup.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-02 13:50:38 +01:00
Sebastian Dröge
aaf0a7c943 Merge branch '1713-ucd-12' into 'master'
glib: Update Unicode Character Database to version 12.0.0

Closes #1713

See merge request GNOME/glib!804
2019-05-02 12:49:16 +00:00
Philip Withnall
81ba6e54fe tests: Remove redundant non-NULL checks in g_strlcat() test
The buffer is a local array, not a pointer, so can never be NULL.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-02 13:28:55 +01:00
Philip Withnall
777a6030a6 tests: Add checks for buffer sizing in g_strlcat() tests
Just to ensure we’re passing a valid value for dest_size.

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

Helps: #1768
2019-05-02 13:28:27 +01:00
Philip Withnall
7541085589 tests: Increase buffer size for g_strlcat() tests
There was a buffer overflow on the last g_strlcat() call in the test.

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

Fixes: #1768
2019-05-02 13:27:53 +01:00
Sebastian Dröge
0095056008 Merge branch '1755-revert-gstrfunc' into 'master'
Revert "macros: Try to use the standard __func__ first in G_STRFUNC"

Closes #1755

See merge request GNOME/glib!799
2019-05-02 12:24:15 +00: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
22d4a44cd6 Merge branch 'emmanuel.fleury/glib-g_strcanon_documentation_fix' into 'master'
Modified version of !784 — Adding tests cases for a better coverage of glib/tests/strfuncs.c

See merge request GNOME/glib!809
2019-05-01 23:30:07 +00:00
Emmanuel Fleury
4afab02376 Adding tests cases for a better coverage of glib/tests/strfuncs.c 2019-05-02 00:13:25 +01:00
Philip Withnall
375fa65b24 Merge branch 'wip/chergert/insertbeforelink' into 'master'
Add pre-allocated link helpers for GList and GQueue

See merge request GNOME/glib!476
2019-05-01 22:47:15 +00:00
Christian Hergert
b3925ff5e4 glist: code style cleanup for g_list_insert_before()
This makes the g_list_insert_before() follow more closely the guidelines
for GLib, which is to avoid implicit pointer boolean value and to prefer
for over while to improve readability.
2019-05-01 13:01:14 -07:00
Christian Hergert
a4c3feb835 queue: add g_queue_insert_before_link() and g_queue_insert_after_link()
This adds two new helpers that allow for inserting pre-allocated GList
elements to the queue similar to existing helpers. This may be advantagous
in some situations such as statically allocated GList elements.
2019-05-01 13:01:14 -07:00
Christian Hergert
b0132bb64f list: add g_list_insert_before_link()
This adds a new insertion helper using a pre-allocated link which may be
advantagous in some situations such as statically linked GList elements.
2019-05-01 13:01:14 -07:00
Philip Withnall
d23a8bd6e4 ci: Add scan-build job in a new ‘analysis’ pipeline stage
Use Meson’s support for running scan-build (Clang’s static analyser)
against the build, so that we get static analysis of each pipeline. Add
it in a new pipeline stage, after code coverage, so that we don’t waste
resources on it unless the unit tests pass — a static analysis build
takes perhaps 10× as long as a normal GCC build.

https://mesonbuild.com/howtox.html#use-clang-static-analyzer

Currently, the static analysis results are uploaded as artifacts, but
the job will always succeed (regardless of whether there are any bugs
found in the analysis).

Currently, a large number of reports are outputted by the analyser,
which need to be fixed before we can gate the pipeline on it.
Furthermore, in order to get scan-build to exit with a non-zero status
if any bugs are found, we need to depend on Meson ≥ 0.49.0, which
contains the fix https://github.com/mesonbuild/meson/issues/4334,
allowing us to add the following to .gitlab-ci.yml:
```
variables:
  # Exit with a non-zero status if any bugs are found
  SCANBUILD: "scan-build --status-bugs"
```

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-01 12:48:08 +01:00
Philip Withnall
48b037fc3a Merge branch 'ci-update' into 'master'
Update the Docker images used for CI

See merge request GNOME/glib!808
2019-05-01 10:12:02 +00:00
Emmanuele Bassi
0b609b53fa ci: Add a debian-stable job
So we can test ancient toolchains.
2019-04-30 18:26:15 +01:00
Emmanuele Bassi
992e7cee34 ci: Move to per-job images
We don't use a global Docker image any more.
2019-04-30 18:26:15 +01:00
Emmanuele Bassi
397e44fc8a ci: Update the Android NDK image to Fedora 28
Fedora 27 was EOL'ed on November 2018.

We move to Fedora 28 because the Android NDK requires Python 2 and
probably other things, and bumping to Fedora 29 is going to be more
painful.
2019-04-30 18:26:15 +01:00
Emmanuele Bassi
ee9afb33af ci: Remove Android and MingW bits from the fedora Dockerfile
These live in their own Dockerfiles, now.
2019-04-30 18:22:44 +01:00
Emmanuele Bassi
15d13d1e97 ci: Add a MinGW Docker image
The Fedora image we use contains MinGW bits that ought to go into
their own Docker container. This avoids having a massive Docker image
that gloms everything and is harder to update.

While we're splitting off, we can also update to Fedora 29, as we can
rely on Fedora packagers doing their job and ensuring that the MinGW
cross-compilation toolchain still works.
2019-04-30 18:21:15 +01:00
Emmanuele Bassi
92fbdb5730 ci: Add an Android NDK Docker image
The Fedora image we use contains Android bits that ought to go into
their own Docker container. This avoids having a massive Docker image
that gloms everything and is harder to update.

We reuse the same Docker image we used for Fedora, to avoid regressing.
2019-04-30 18:18:38 +01:00
Emmanuele Bassi
b4d920f60c ci: Beef up run-docker.sh
Add argument validation and split the build/run/push phases into
commands.
2019-04-30 15:37:31 +01:00
Emmanuele Bassi
d42a551e3e ci: Rename the Fedora Dockerfile
We're going to add more, so let's avoid collisions.
2019-04-30 15:37:31 +01:00
Emmanuele Bassi
2515015a67 ci: Add Debian stable Docker image
Does everything the Fedora image does, only with an older toolchain and
older dependencies.
2019-04-30 15:37:31 +01:00
Emmanuele Bassi
eb55d6413d Check GCC version before ignoring diagnostic message
The `alloc-size-larger-than` warning is available starting with GCC 7,
and using it in a pragma will generate a warning on older versions of
GCC.
2019-04-30 14:49:00 +01:00
Emmanuele Bassi
6cb6b418bf Add a version check for duplicated-branches warning
The GHashTable code ignores the duplicated-branches GCC warning, but we
need to do a compiler and version check, as either non-GCC compatible
compilers, or older versions of GCC will warn about the unknown pragma
or diagnostic.

If we don't do this while turning warnings into error, we're going to
fail the build unnecessarily.
2019-04-30 14:49:00 +01:00
Emmanuele Bassi
99d068fb90 ci: Add clang and scan-build
We want to run the Clang-based build analysis tool in our CI pipeline,
taking advantage of its native support in Meson.
2019-04-30 14:49:00 +01:00
Emmanuele Bassi
7875f34433 ci: Update the Docker image for Fedora
Use Fedora 29, soon to be old-stable.
2019-04-30 14:49:00 +01:00
Philip Withnall
94f63b8de1 Merge branch 'strcanon-docs' into 'master'
Merge of initial commits from !784

Closes #29

See merge request GNOME/glib!807
2019-04-30 10:52:42 +00: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
Emmanuel Fleury
b3eab1deaf Fixing glib/tests/strfuncs.c to conform to new test coding standards 2019-04-30 09:43:01 +02:00
Emmanuel Fleury
95a5f63775 Fix some documentation issue in glib/gstrfuncs.c
Apparently, the documentation of g_strcanon() was not really cristal
clear, so this new code sample try to make it clear the fact that we
are working on the given string and not a copy. Moreover, it provides
a way to keep the original string at once.

Fix #29
2019-04-30 09:43:01 +02:00
Emmanuele Bassi
6d3dcd1a60 Merge branch 'tap-p-order' into 'master'
testing: Run tests specified with -p in the order specified

Closes #1763

See merge request GNOME/glib!805
2019-04-29 17:09:20 +00:00
Simon McVittie
a537e538be testing: Run tests specified with -p in the order specified
Closes: #1763
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 17:28:55 +01:00
Philip Withnall
0e999f37d0 Merge branch 'tap-skip' into 'master'
gtestutils: Make --tap compatible with -p and --GTestSkipCount

See merge request GNOME/glib!556
2019-04-29 15:45:59 +00:00
Simon McVittie
48cc3abede testing: Comment that test order with -p is reversed
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 16:12:02 +01:00
Simon McVittie
dfec3c6789 Test what happens when GTestSkipCount is 0 or more than number of tests
Using --GTestSkipCount 0 is the same as omitting it. A skip count
greater than the number of tests is the same as equalling the number
of tests: they are all skipped.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 16:08:55 +01:00
Simon McVittie
bcee67e29c gtestutils: Test the combination of --tap and -p
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 15:54:10 +01:00
Simon McVittie
b24cdffd5c gtestutils: Allow combining --tap with -p
The -p option is documented, and can be used to select and repeat
test-cases. This is particularly useful when debugging a single
failure among a large number of test-cases, or when debugging a
test-case that you suspect influences another test-case by leaking
global state.

Until now, -p was only supported with GLib's default (GLib-specific)
textual output format, and not with the standardized TAP format that
we are now encouraging. If we are considering making TAP the new default
(see glib#1619) it should get feature-equivalence with the current
default.

Because -p allows test-cases to be re-ordered and repeated, and an entry
in the test_paths list can match any number of test-cases (including
zero), we don't know ahead of time how many test-cases we are going to
run. TAP allows the "plan" to be deferred to the end, exactly to support
situations like this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 15:54:10 +01:00
Simon McVittie
efa56aa957 gtestutils: Test the combination of --tap and --GTestSkipCount
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 15:54:10 +01:00
Simon McVittie
14082191e8 gtestutils: Make --tap compatible with --GTestSkipCount
The undocumented --GTestSkipCount option is internal to the deprecated
gtester tool and rather obscure, but it's straightforward to support
by making G_TEST_LOG_SKIP_CASE produce TAP output similar to what already
happened when we emitted G_TEST_LOG_STOP_CASE with result
G_TEST_RUN_SKIPPED. I might as well do that while I'm looking at the
interaction between the --tap, -p and -s options.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 15:54:10 +01:00
Simon McVittie
88bac46287 gtestutils: Add regression test for combining -s with --tap
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-29 15:54:10 +01:00
Philip Withnall
87014c8e97 glib: Update Unicode Character Database to version 12.0.0
Using commands:
   glib/gen-unicode-tables.pl -both 12.0.0 path/to/UCD
   tests/gen-casefold-txt.py 12.0.0 path/to/UCD/CaseFolding.txt \
     > tests/casefold.txt
   tests/gen-casemap-txt.py 12.0.0 path/to/UCD/UnicodeData.txt \
      path/to/UCD/SpecialCasing.txt > tests/casemap.txt
plus some manual additions of the new G_UNICODE_SCRIPT_* symbols to
gunicode.h, guniprop.c and glib/tests/unicode.c.

Using UCD release https://www.unicode.org/Public/zipped/12.0.0/UCD.zip.

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

Fixes: #1713
2019-04-29 14:16:12 +01:00
Philip Withnall
e9389efe5b gsocket: Clarify in docs that flags arguments can be platform specific
As suggested by Philip Chimento.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-04-29 13:21:08 +01:00
Philip Withnall
1c77c93e81 Merge branch 'gconstrutor-h-stdlib-h-msvc' into 'master'
glib/gconstructor.h: Include stdlib.h for MSVC builds

See merge request GNOME/glib!791
2019-04-29 12:10:52 +00:00
Philip Withnall
8482318208 Merge branch 'master' into 'master'
gnetworkmonitornm: Fix network available detection

See merge request GNOME/glib!781
2019-04-29 12:05:54 +00:00
Fabrice Bellet
719133e882 gnetworkmonitornm: Fix network available detection
The network-available property can be asserted by querying the NMState
describing the current overval network state, instead of the
NMConnectivityState. The advantage of the NMState is that is reflects
immediately the network state modification, while the connectivity
state is tested at a fixed frequency.
2019-04-29 12:05:54 +00:00