* 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.
* 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!
Previously, when clock_gettime() was available, the time functions would use
that (regardless of success or failure), otherwise they would use
gettimeofday() if available.
Now, the functions first try clock_gettime() if available, but if that is
unavailable or fails, they then try gettimeofday() if available, but if that is
not available or fails, they try time().
configure.ac already defined HAVE_GETTIMEOFDAY, but the uses of gettimeofday()
weren't guarded by it. It obviously doesn't matter on any currently supported
platforms, but it will be needed for planned changes.
The time-related functions have two implementations, one if clock_gettime() is
available and the other if not.
Previously, there was one big ifdef-else with the clock_gettime()
implementation of each function followed by the other implementation of each
function.
With this commit, each function is defined once, with an ifdef-else inside it
with the two implementations of that function. For ease of review, no other
code changes are made, but the intent will become obvious with later changes.
* 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
qb_log calls malloc() and probably many other non-signal-safe
functions, so don't call it in the signal handler.
Thanks to Honza for spotting this
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
* 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>
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>
This is an attempt to make sure that /dev/shm is cleaned up when a
server exits unexpectedly. Normally it's the server's responsibility
to tidy up sockets, but if it crashes or is killed with SIGKILL then
the client (us) makes a reasonable attempt to tidy up the server sockets
we have connected. The extra delay here just gives the server chance to
disappear fully. As a client we can get here pretty quickly but shutting
down a large server may take a little longer even when SIGKILLed.
The 1/100th of a second is an arbitrary delay (of course) but seems to
catch most servers in 2 tries or less.
if a line starts with a '.' (eg the '...' in qbarray.h) then
nroff thinks it's looking for a macro called '..'.
The easiest solution is to add a dummy format at the start of the line
(just adding \ seems not to work).