[PATCH v3 1/2] support: Add support for running tests in a multi-threaded environment
Florian Weimer
fweimer@redhat.com
Mon Nov 24 15:01:14 GMT 2025
* Arjun Shankar:
> It can be useful to be able to write a single-threaded test but run it
> as part of a multi-threaded program simply to exercise glibc
> synchronization code paths, e.g. the malloc implementation.
>
> This commit adds support to enable this kind of testing. Tests that
> define TEST_IN_THREAD, either as TEST_THREAD_MAIN or TEST_THREAD_WORKER,
> and then use support infrastructure (by including test-driver.c) will be
> accordingly run in either the main thread, or in a second "worker"
> thread while the other thread waits.
>
> This can be used in new tests, or to easily make and run copies of
> existing tests without modifying the tests themselves.
> ---
> support/Makefile | 1 +
> support/support_test_in_thread_wrapper.c | 96 ++++++++++++++++++++++++
> support/support_test_main.c | 25 ++++--
> support/test-driver.c | 8 ++
> support/test-driver.h | 12 +++
> 5 files changed, 136 insertions(+), 6 deletions(-)
> create mode 100644 support/support_test_in_thread_wrapper.c
>
This looks okay to me.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list