rcutorture: Check histogram of ages Ensure that the histogram of ages for all threads are valid after a stress test. Change-Id: Iadc46f47fe8835ac0e2d8967b6a16a83335a9541 Signed-off-by: Olivier Dion <odion@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/regression: Remove urcu-signal regression tests In preparation for deprecation of the urcu-signal flavor, remove the urcu-signal regression tests. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: Ib452e758642d8777f9dc51535176487508692456
tests: Use uatomic for accessing global states Global states accesses were protected via memory barriers. Use the uatomic API with the CMM memory model so that TSAN does not warn about non-atomic concurrent accesses. Also, the thread id map mutex must be unlocked after setting the new created thread id in the map. Otherwise, the new thread could observe an unset id. Change-Id: I1ecdc387b3f510621cbc116ad3b95c676f5d659a Co-authored-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Olivier Dion <odion@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/regression/rcutorture: Use urcu-wait pthread_cond_wait(3) can have spurious wakeups on some OS. To detect such spurious wakeup, a global variable is shared between the waiter and the waker. We can use urcu-wait instead. Change-Id: I6a2d2f3c9104ea23df16a7c8ba3557bb5d58306c Signed-off-by: Olivier Dion <odion@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/rcutorture: Factor out thread registration Register the thread once at the begining of the update routine. Put the thread offline when doing anything that can block. Change-Id: I345e04ee2ef0b5ba2f065b8a3029dd0e6130037b Signed-off-by: Olivier Dion <odion@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/regression/rcutorture: Add wait state pthread_cond_wait(3) can have spurious wakeups. Fix this by polling a state associated with the the wait. Change-Id: Iba034cba5f72ad88388d1b90a6093f4ae9f9beb9 Signed-off-by: Olivier Dion <odion@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests: use SPDX identifiers The SPDX identifiers [1] are a legally binding shorthand, which can be used instead of the full boiler plate text. This is another step towards implementing the full REUSE spec [2] to help with copyright and licensing audits and compliance. This will reduce a lot a manual work required for the licensing audit required in Debian on each update. For files that lacked copyright and licensing information, I used the following guidelines. Use the author from the git history and the test scripts license as stated in LICENSE, 'GPL-2.0-only'. [1] https://spdx.org/ids-how [2] https://reuse.software/tutorial/ Change-Id: I23c23edeffe6f3448ad673034480de46c98b746b Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Build system: use SPDX identifiers The SPDX identifiers [1] are a legally binding shorthand, which can be used instead of the full boiler plate text. This is the first step towards implementing the full REUSE spec [2] to help with copyright and licensing audits and compliance. This will reduce a lot a manual work required for the licensing audit required in Debian on each update. For files that lacked copyright and licensing information, I used the following guidelines. If a clear author could be determined from the git history use it, otherwise use 'EfficiOS Inc.'. For build system files, use 'MIT', for documentation 'CC-BY-4.0' and for data files 'CC-1.0'. [1] https://spdx.org/ids-how [2] https://reuse.software/tutorial/ Change-Id: Ie507130c00b95606dc439616fda4fd9b1d35353d Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: use __noreturn__ for C11-compatibility The noreturn convenience macro provided by stdnoreturn.h might get included before urcu headers, use __noreturn__ for better compatibility with code using <stdnoreturn.h> header. Signed-off-by: Ondřej Surý <ondrej@sury.org> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Adjust shell scripts to allow Bash in other locations Linux-based OS for the most part provide Bash and being located in /bin, but on other OS's the shell would be in another location. Utilize env(1) and allow it to be located elsewhere. Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: I9d4d4a3feaf993754c64b740ea91e42b336ba2b4
Improved test framework This is based on the babeltrace / librseq test framework with the objective of standardising across projects. Regroup all the configure detected values relevant to the test suite in a single generated file. This file will be automatically sourced by the test suite in most scenarios but can also be sourced in the shell of a user. * All user overridable variables start with 'URCU_TESTS_'. * The priority for variables is : Environment -> env.sh -> utils.sh (defaults). * A user can source 'env.sh', override some of the values and manually run test scripts. * The test suite can run without an 'env.sh' file present. Change-Id: Id94f7085ed1ea0e30207856cf1594ca30585536c Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Build and run regression and unit tests as C++ programs Build and run all tests under tests/regression and tests/unit as C++ programs in addition to C. This helps get confidence that urcu, when used from a C++ program, behaves well. Change-Id: Iacaa42dddbcbf59eff8e327edfd0352cce0b74b7 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add `urcu_posix_assert()` as `assert()` replacement This macro acts like the regular `assert()` macro unless NDEBUG is defined in which case it consumes the expression and becomes a no-op. This consumption trick (see `_urcu_use_expression()` macro) prevents the compiler from warning about unused variables even when assert() are removed by the NDEBUG define. This macro is also used for the existing `urcu_assert_debug()` macro. The implementation of `_urcu_use_expression()` is inspired by the Babeltrace 2 approach. See `BT_USE_EXPR()` macro and documentation in Babeltrace commit [1]: commit 1778c2a4134647150b199b2b57130817144446b0 Author: Philippe Proulx <eeppeliteloop@gmail.com> Date: Tue Apr 21 11:15:42 2020 -0400 lib: assign a unique ID to each pre/postcond. and report it on failure All assertion macros are moved to the new urcu/assert.h file. Link: https://github.com/efficios/babeltrace/commit/1778c2a4134647150b199b2b57130817144446b0 [1] Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: If60ce2d3f45ea8f5ec1dbb92fb43f83fd9f8102b
fix: warnings on non-Linux platforms Add the relevent attributes in non-Linux wrapper code. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: I0c50dc57f71804aa544350178793bdf280a667df
cleanup: explicitly mark unused parameters (-Wunused-parameter) Add the 'unused' attribute to function parameters that are unused to allow turning on -Wunused-parameter and distinguish unused parameters that are actual errors. Change-Id: Ie585e37f9d38718543a31aee2e7ab3428cdfd0a5 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
cleanup: all functions have declarations (-Wmissing-prototypes) Make sure that all non-static functions have a declaration. Change-Id: Ie1596ad4ba876183862e51508c8bd7fc0451fc5e Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure: standardise include path Use the same include setup as our other projects, set the default includes globally in configure.ac in AM_CPPFLAGS. This is part of an effort to standardise our autotools setup across project to simplify maintenance. Change-Id: Ia40344e22920bafca9ed34ea2867acf38a1807e3 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests: Move tap-driver.sh out of the autotools aux directory We have made local modifications to this script, move it to the test suite directory so it doesn't get overwritten by an updated version from autotools. This is part of an effort to standardise our autotools setup across project to simplify maintenance. Change-Id: I4bc0bdbff05d03d8e4c0f9dcda51cf6a6cf7fec4 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>