Commit Graph

402 Commits

Author SHA1 Message Date
Ferenc Wágner
f3a667818d New upstream version 2.0.9 2025-10-04 20:23:54 +02:00
Chrissie Caulfield
1fae15eadc
Solaris port (#504)
and a few misc bug fixes
2025-07-31 16:17:21 +01:00
Chrissie Caulfield
a3201f55fa
tests: Fix shebang on ipc_sock_test (#493) 2023-11-15 10:46:21 +00:00
Ferenc Wágner
b2e026cc71 New upstream version 2.0.8 2023-07-21 21:23:34 +02:00
Chrissie Caulfield
1bbaa929b7
log: fix potential overflow with long log messages (#490)
qb_vsnprintf_serialize was called with 'max_size' as the
limiting number for the length of the formatted log
message. But the buffer also needs to contain the
log header (given by 'actual_size'), so we now pass
't->max_line_length' as the maximum length of the
formatted log message to limit space to the actual 
bytes left

Also added error checks to the blackbox calls at
the end of the test, as these now provide a proper
test that the BB is functioning. Before they were
masking failures.
2023-07-20 07:19:01 +01:00
Ferenc Wágner
8502569c38 New upstream version 2.0.7 2023-06-23 22:26:58 +02:00
Chrissie Caulfield
92ddd7c929
test - fix test dependancies (#489)
Fix a ridiculous thinko in the test deps for -j
2023-06-10 05:21:55 +02:00
Chrissie Caulfield
a3aedbc419
tests: allow -j to work (#485)
build: fix several issues with building tests

- MAINTAINERCLEANFILES should not rely on conditionals
  that could or could not clean files.

- EXTRA_DIST should not rely on conditonals that could
  or could not add files to the final tarball.
  sources should always ship.

- CLEANFILES should not rely on conditionals as
  ./configure can be done in between builds leaving
  stray files around.

- (cosmetic) move distclean-local: target with clean-local.

- drop old ipc_sock.test, start.test and resources.test
  shell files.

- fix make distcheck -j:
  - stop shipping or not shipping libstat_wrapper.so.
    libtool will only generate the .so when installing
    a shared library (--enable-install-tests).
  - make libstat_wrapper a module in a similar fashion
    of _failure_injection.
  - build ipc_sock.test in a similar fashion as ipc.test
    and link as module _libstat_wrapper.la.
    this solves multiple issues of having the binary
    in the final test builddir, no need to detect if
    libstat_wrapper.so is installed or not and workaround
    libtool different linking methods for inst vs noinst
    libraries.

- fix ipc.test linking with GLIB that should not be
  dependent on HAVE_FAILURE_INJECTION.

Run tests in parallel with dependancies
Make sure the two IPC tests use different socket names
Shortedn some names so they fit with the new ipc-names
remove ipc-test-name-sock
Fix resources.test now that ipc_sock is being run properly

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2023-05-26 20:21:43 +02:00
Chrissie Caulfield
335dbb6e34
test: Remove gnu/lib-names.h from libstat_wrapper.c (#482)
It doesn't appear to be needed!
2023-03-23 14:49:35 +00:00
Chrissie Caulfield
e038f59c52
tests: Close race condition in check_loop (#480)
Start the "check_time_left" timer before the "stop_job" timer so
that we can be sure that it exists when "check_time_left" is run.
2023-01-06 13:30:51 +00:00
Chrissie Caulfield
fde729e137
timer: Move state check to before time check (#479)
A timer in QB_POLL_ENTRY_JOBLIST doesn't necessarily
have a t->timerlist_handle so that deref can segv. Also
the comment assumes the timers are threaded - which as we have
decided is definitely not true. So it's safe to move the check
earlier.

In the tests, I've adjusted the timeouts so that they definitely
happen at different times. On some architectures they can fire
concurrently and in the wrong order.
2023-01-05 14:45:22 +00:00
Chrissie Caulfield
8325d84047
tests: Fix tests on FreeBSD-devel (#469)
FreeBSD-devel can allocate more space than requested which causes
the check to fail. So check for >= allocated rather than ==
2022-07-07 08:30:38 +01:00
Chrissie Caulfield
0eb0991ad6
tests: cleanup the last of the empty directories (#467)
This should, FINALLY, allow the libqb tests to run
and properly cleanup up after themselves.
2022-06-16 07:17:59 +01:00
Chrissie Caulfield
44a4cb2989
tests: Make ipc test more portable (#466)
fix a couple of errors reported by covscan

1. /usr/lib64/libqb/tests/resources.test:8:34: warning[SC2039]: In POSIX sh, UID is undefined.
1. /usr/lib64/libqb/tests/resources.test:8:30: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
1. /usr/lib64/libqb/tests/ipc_sock.test:10:34: warning[SC2039]: In POSIX sh, UID is undefined.
1. /usr/lib64/libqb/tests/ipc_sock.test:10:30: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
2022-06-08 09:51:49 +01:00
Ferenc Wágner
10d461833f New upstream version 2.0.6 2022-05-25 22:29:35 +02:00
Chrissie Caulfield
758044bed5
test: Include ipc_sock.test in the libqb-tests rpm (#463)
...but don't run it unless we are root
2022-03-23 09:54:07 +00:00
Chrissie Caulfield
78df90b180
tests: Run IPC with use-filesystem-sockets active (#455)
* tests: Run IPC with use-filesystem-sockets active

Provide an LD_PRELOAD library that simulates the presence
of /etc/libqb/use-filesystem-sockets so that we can test
that functionality without actually having the file on
the system and affecting everything else running on the
box.

* use $() rather than ``

* Cope with spaces in directory names

* Docs: quote DOXYGEN2MAN in Makefile.am rather than configure.ac
2022-03-21 09:10:35 +00:00
Chrissie Caulfield
2d3cd761cf
test: Clean /dev/shm a bit better (#459)
* test: Clean /dev/shm a bit better

This isn't perfect, but it does tidy more of /dev/shm than
previously. Because some of the tests leave empty directories
we have no way of telling (in resources.test) whether they
belong to this test run, another test run, or a running
application.
2022-03-18 10:04:23 +00:00
Chrissie Caulfield
2d03793eb0
unix: Don't fail on FreeBSD running ZFS (#461)
* unix: Don't fail on FreeBSD running ZFS

ZFS doesn't support posix_fallocate() so libqb IPC or RB would
always fail with EINVAL.

As there seems to be no prospect of a more useful return code,
trap it in a QB_BSD #ifdef. That way if we do have actual errors
in the posix_fallocate() call the Linux tests should still find them.

Also, stick a small sleep in the test_ipc_disconnect_after_created
test to allow the server to shutdown before killing it with SIGTERM
and causing a test failure. all the other uses of it seem to have this
sleep!
2022-03-17 07:47:39 +00:00
Chrissie Caulfield
73472e0b13
Tidy some scripts (#454)
* Tidy some scripts

Errors reported by Centos covscan

I changed %N to %s as BSD's date command doesn't support %N.
Seconds + PID should be enough ....

* Shrink the name of the dlock tests as they cause random failures

When the PID numbers get big, the socket name overflows the allowed
limit

* Increase timeout of thread check.

It's been seen to time out too early and fail the tests
2022-01-19 12:50:45 +00:00
Chrissie Caulfield
de5ab3029c
ipcc: Add an async connect API (#450) 2022-01-05 10:53:09 +00:00
Ferenc Wágner
b91c3e4791 New upstream version 2.0.4 2021-11-21 13:42:35 +01:00
Jan Friesse
48fff5eb58
Implement heap based timer list (#439)
* tlist: Add heap based implementation of timer list

Previous timer was sorted list implementation of priority queue
and very slow when number of timers increased. This is mostly
not a problem because usually only few timers are used.
But for application where bigger number of timers are needed
it may become problem.

Solution is to use binary heap based priority queue which is much
faster.

API is unchanged, just timerlist_destroy is added which should be called
to free heap array. This function also destroys mutex (omitted when
mutex was added).

* tests: Fix check loop mt test

test_th was accesed both by main thread and loop_timer thread resulting in
failure. Fix is to access test_tht in loop_timer thread.

Speed test is adding only 10000 items so it is reasonable
fast even with sorted linked list implementation.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2021-03-18 07:27:25 +00:00
orbea
9e1e3a2f4b
build: Fix undefined pthread reference. (#440) 2021-03-17 09:32:51 +00:00
Ferenc Wágner
86a316c09e New upstream version 2.0.3 2021-03-04 05:50:06 +01:00
Aleksei Burlakov
aae7a0aa5d
syslog: Add a message-id parameter for messages (#433)
The message-id parameter will enable systemd catalogs.
To enable message-id's the libqb should be configured with the
 --enable-systemd-journal option.

Co-authored-by: root <Aleksei Burlakov>
2021-03-01 15:58:50 +00:00
Chrissie Caulfield
c7e1afefae
tests: Fix up resources.test (#435)
resources.test has not checked the right filenames for a while.
Fix this, and also make sure we don't count (but remove) the dlock
test files.
2021-02-08 11:01:13 +00:00
Chrissie Caulfield
d6e2bd1d6b
timers: Add some locking (#436)
Fix several locking issues reported by helgrind
2021-02-08 10:57:42 +00:00
Ferenc Wágner
61203efbb2 New upstream version 2.0.2 2020-12-25 11:55:09 +01:00
Chrissie Caulfield
06ac2d43a9
cov: Quieten some covscan warnings (#427) 2020-12-03 09:39:28 +00:00
Chrissie Caulfield
680db526f6
ipc: add qb_ipcc_auth_get() API call (#418)
* ipc: addd qb_ipcc_auth_get() API call

We can't use SO_PEERCRED on the client fd when using socket IPC
becayse it's a DGRAM socket (pacemaker tries this). So provide
an API to get the server credentials that libqb has already
squirreled away for its own purposes.

Also, fix some unused-variable compiler warnings in unix.c
when building on systems without posix_fallocate().
2020-09-28 09:53:21 +01:00
Ferenc Wágner
e06b1b88ad New upstream version 2.0.1 2020-09-22 17:01:30 +02:00
Ferenc Wágner
4d8bbd807d New upstream version 1.0.6 2020-07-30 15:38:32 +02:00
Chrissie Caulfield
d01a9e0adf
tests: Remove deprecated check macros (#412)
fail_if() and fail_unless() macros are deprecated in more
recent versions of check and are buggy in 0.15, so replace
them with ck_assert() instead.
2020-07-29 14:06:22 +01:00
Chrissie Caulfield
08a165dc2c
test: Add unit test for ipcs_connection_auth_set() (#397)
Only if we are root
2020-06-03 08:26:51 +01:00
Chris Murphy
08806c5301
master: Issue 390: Clarify documentation of qb_loop_timer_expire_time_get and provide new function to return previously documented behavior (#391)
Includes unit test addition by chrissie-c
2020-04-29 13:20:52 +01:00
Chrissie Caulfield
e675b8a3c6
Fix error in CI tests - make distcheck
Backport of some 'make distcheck' fixes
2020-04-27 13:24:03 +01:00
Chrissie Caulfield
1daca57c10
trie: Don't assume that chars are unsigned < 126 (#386)
* trie: Don't assume that chars are unsigned < 126

Trie fails on systems with unsigned chars when using characters over
126.
2020-03-09 08:14:39 +00:00
Christine Caulfield
3da80822b2 lib: Fix some minor warnings from newer compilers
and doxygen
2019-12-11 11:14:47 +00:00
Chrissie Caulfield
33b79ebc47 tests: Shorted deadlock test names (#372)
On newer Fedora systems that can have 32 bit PIDs, these long test
names can get truncated in the libqb internal buffers and thus break the
tests, so I've shortened the names.
2019-12-06 14:38:02 +01:00
Christine Caulfield
8e50d0a4f1 tests: Speed up IPC tests, especially on FreeBSD
After much discussion on IRC it was decided that 70000 iterations
of the stress patch didn't achieve anything significant over a
reasonable but smaller number. So it has been reduced to 5000 on
all platforms.

This patch also fixes a bug where test_ipc_disconnect_after_created
committed a use-after-free which could cause a crash on FreeBSD-devel.
2019-06-27 13:19:08 +01:00
Jan Pokorný
d5adc0cbc8
tests: ipc: fix the no-GLib conditionalizing
In particular, qb_ipcs_rate_limit() needs to be outside the
"#ifdef HAVE_GLIB" conditional, since it gets used regardless.
This should have been like this as of 28e7259.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-12 16:54:22 +02:00
Jan Pokorný
2aefe53188
tests: ipc: check deadlock-like situation due to mixing priorities
Compared to the outer world, libqb brings rather unintuitive approach
to priorities within a native event loop (qbloop.h) -- it doesn't do
an exhaustive high-to-low priorities in a batched (clean-the-level)
manner, but rather linearly adds a possibility to pick the handling
task from the higher priority level as opposed to lower priority ones.

This has the advantage of limiting the chances of starvation and
deadlock opportunities in the incorrectly constructed SW, on the other
hand, it means that libqb is not fulfilling the architected intentions
regarding what deserves a priority truthfully, so these priorities are
worth just a hint rather than urgency-based separation.

And consequently, a discovery of these deadlocks etc. is deferred to
the (as Murphy's laws have it) least convenient moment, e.g., when
said native event loop is exchanged for other (this time priority
trully abiding, like GLib) implementation, while retaining the same
basic notion and high-level handling of priorities on libqb
side, in IPC server (service handling) context.

Hence, demonstration of such a degenerate blocking is not trivial,
and we must defer such other event loop implementation.  After this
hassle, we are rewarded with a practical proof said "high-level
handling [...] in IPC server (service handling) context" contains
a bug (which we are going to subsequently fix) -- this is contrasted
with libqb's native loop implementation that works just fine even
prior that fix.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-12 16:30:50 +02:00
Jan Pokorný
8c838db566
tests: ipc: refactor/split test_ipc_dispatch part into client_dispatch
This way, this core part can be easily reused where needed.
Note that "ready_signaller" similarity with run_ipc_server is not
accidental, following commit will justify it.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-12 16:28:00 +02:00
Jan Pokorný
248010aa71
tests: ipc: allow for easier tests debugging by discerning PIDs/roles
Roles specifications are currently not applied and are rather
a preparation for the actual meaningful use to come.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-12 16:27:57 +02:00
Jan Pokorný
1dc71575da
tests: ipc: speed the suite up with avoiding expendable sleep(3)s
Using i7-6820HQ CPU yields these results:

Before: ~2:54
After: ~2:26
Speedup: ~16%

The main optimization lies in how run_function_in_new_process helper is
constructed, since now, there's an actual synchronization between the
parent and its child (that needs to be prioritized here, which is
furthermore help with making the parent immediately give up it's
processor possession) after the fork, so that a subsequent sleep is
completely omitted -- at worst (unlikely), additional sleep round(s)
will need to be undertaken as already arranged for (and now, just
400 ms is waited rather than excessive 1 second).

Another slight optimization is likewise in omission of sleep where
the control gets returned to once the waited for process has been
suceesfully examined post-mortem, without worries it's previous
life is still resounding.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-12 16:27:47 +02:00
Jan Pokorný
039bd76882
tests: ipc: avoid problems when UNIX_PATH_MAX (108) limits is hit
There's some slight reserve for when bigger PID ranges are in use.
The method to yield the limit on prefix string was derived from
practical experience (rather than based on exact calculations).

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-12 16:27:38 +02:00
Jan Pokorný
28e725938a
tests: ipc: check deadlock-like situation due to mixing priorities
Compared to the outer world, libqb brings rather unintuitive approach
to priorities within a native event loop (qbloop.h) -- it doesn't do
an exhaustive high-to-low priorities in a batched (clean-the-level)
manner, but rather linearly adds a possibility to pick the handling
task from the higher priority level as opposed to lower priority ones.

This has the advantage of limiting the chances of starvation and
deadlock opportunities in the incorrectly constructed SW, on the other
hand, it means that libqb is not fulfilling the architected intentions
regarding what deserves a priority truthfully, so these priorities are
worth just a hint rather than urgency-based separation.

And consequently, a discovery of these deadlocks etc. is deferred to
the (as Murphy's laws have it) least convenient moment, e.g., when
said native event loop is exchanged for other (this time priority
trully abiding, like GLib) implementation, while retaining the same
basic notion and high-level handling of priorities on libqb
side, in IPC server (service handling) context.

Hence, demonstration of such a degenerate blocking is not trivial,
and we must defer such other event loop implementation.  After this
hassle, we are rewarded with a practical proof said "high-level
handling [...] in IPC server (service handling) context" contains
a bug (which we are going to subsequently fix) -- this is contrasted
with libqb's native loop implementation that works just fine even
prior that fix.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-04 13:07:27 +02:00
Jan Pokorný
2ced1b4341
tests: ipc: refactor/split test_ipc_dispatch part into client_dispatch
This way, this core part can be easily reused where needed.
Note that "ready_signaller" similarity with run_ipc_server is not
accidental, following commit will justify it.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-04 13:06:54 +02:00
Jan Pokorný
c54e2712a6
tests: ipc: allow for easier tests debugging by discerning PIDs/roles
Roles specifications are currently not applied and are rather
a preparation for the actual meaningful use to come.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-04 13:06:52 +02:00