[PATCH] Add threaded variants of single-threaded malloc tests
Florian Weimer
fweimer@redhat.com
Wed Nov 5 07:22:37 GMT 2025
* Arjun Shankar:
> Single-threaded malloc tests exercise only the SINGLE_THREAD_P paths in
> the malloc implementation. This commit runs variants of these tests in
> a multi-threaded environment in order to exercise the alternate code
> paths in the same test scenarios, thus potentially improving coverage.
>
> $(test)-threaded-main and $(test)-threaded-worker variants are
> introduced for most single-threaded malloc tests (with a small number of
> exceptions). The -main variants run the base test in a main thread
> while the test environment has an alternate thread running, whereas the
> -worker variants run the test in an alternate thread while the main
> thread waits on it.
>
> Test support/ infrastructure is extended to be able to allow threaded
> execution of these tests without needing to modify the tests themselves,
> using a compile-time -D flag to enable threaded execution instead.
>
> Tests that for any reason currently fail are excluded. They should be
> investigated and followed-up on.
One of the new tests fails to link on Hurd:
i686-glibc-gnu-gcc -o
…/build/glibcs/i686-gnu/glibc/malloc/tst-mallopt-threaded-main-mcheck
-pie -Wl,-z,pack-relative-relocs -Wl,-O1 -nostdlib -nostartfiles
-Wl,-z,relro …/build/glibcs/i686-gnu/glibc/csu/Scrt1.o
…/build/glibcs/i686-gnu/glibc/csu/crti.o `i686-glibc-gnu-gcc
--print-file-name=crtbeginS.o`
…/build/glibcs/i686-gnu/glibc/malloc/tst-mallopt-threaded-main.o
…/build/glibcs/i686-gnu/glibc/support/libsupport_nonshared.a
…/build/glibcs/i686-gnu/glibc/malloc/libmcheck.a
-Wl,-dynamic-linker=/lib/ld.so.1
-Wl,-rpath-link=…/build/glibcs/i686-gnu/glibc:…/build/glibcs/i686-gnu/glibc/math:…/build/glibcs/i686-gnu/glibc/elf:…/build/glibcs/i686-gnu/glibc/dlfcn:…/build/glibcs/i686-gnu/glibc/nss:…/build/glibcs/i686-gnu/glibc/nis:…/build/glibcs/i686-gnu/glibc/rt:…/build/glibcs/i686-gnu/glibc/resolv:…/build/glibcs/i686-gnu/glibc/mathvec:…/build/glibcs/i686-gnu/glibc/support:…/build/glibcs/i686-gnu/glibc/misc:…/build/glibcs/i686-gnu/glibc/debug:…/build/glibcs/i686-gnu/glibc/htl:…/build/glibcs/i686-gnu/glibc/mach:…/build/glibcs/i686-gnu/glibc/hurd:…/install/compilers/i686-gnu/lib/gcc/i686-glibc-gnu/15.2.1/../../../../i686-glibc-gnu/lib/
-lgcc -Wl,--as-needed -lgcc_s -Wl,--no-as-needed
…/build/glibcs/i686-gnu/glibc/libc.so.0.3
…/build/glibcs/i686-gnu/glibc/libc_nonshared.a -Wl,--as-needed
…/build/glibcs/i686-gnu/glibc/elf/ld.so -Wl,--no-as-needed -lgcc
-Wl,--as-needed -lgcc_s -Wl,--no-as-needed `i686-glibc-gnu-gcc
--print-file-name=crtendS.o` …/build/glibcs/i686-gnu/glibc/csu/crtn.o
…/install/compilers/i686-gnu/lib/gcc/i686-glibc-gnu/15.2.1/../../../../i686-glibc-gnu/bin/ld: …/build/glibcs/i686-gnu/glibc/support/libsupport_nonshared.a(xpthread_create.oS): in function `xpthread_create':
…/src/glibc/support/xpthread_create.c:26:(.text+0x21): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
Presumably $(shared-thread-library) is missing somewhere.
Thanks,
Florian
More information about the Libc-alpha
mailing list