| History log of /src/tests/lib/libpthread/Makefile | 
    | Revision |  | Date | Author | Comments | 
| 1.22 |  | 18-Oct-2025 | riastradh | tests/lib/libpthread: Fix tests in subdirectory. 
 Need to use TESTS_SUBDIRS for this, not SUBDIR.  Avoid the extra
 nesting level while here; can make the library be a subdirectory of
 the directory where the tests live.
 
 PR lib/59685: libcrypto should not depend on libpthread
 
 | 
| 1.21 |  | 06-Oct-2025 | leot | libpthread: append to SUBDIR instead of overwrite it 
 Noticed and from <riastradh>, thanks!
 
 PR lib/59685: libcrypto should not depend on libpthread
 
 | 
| 1.20 |  | 06-Oct-2025 | riastradh | libpthread: Test pthread stubs in threaded vs non-threaded programs. 
 PR lib/59685: libcrypto should not depend on libpthread
 
 | 
| 1.19 |  | 08-Apr-2025 | riastradh | tests/lib/libpthread/t_compat_cancel: Make linker warnings non-fatal. 
 We will get warnings like:
 
 /home/riastradh/netbsd/current/src/tests/lib/libpthread/t_compat_cancel.c:233: warning: warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference
 
 This is intended -- t_compat_cancel deliberately uses the compat
 symbols, not the modern symbols, in order to test the compat symbols.
 
 Fixes clang build because bsd.sys.mk enables -Wl,--fatal-warnings in
 LDFLAGS by default.
 
 PR lib/59240: POSIX.1-2024: cancellation point audit
 PR lib/59247: pthread_cancelstub.c is inadequately tested
 
 | 
| 1.18 |  | 05-Apr-2025 | riastradh | Add tests for compat functions as cancellation points. 
 While here, test kevent too.
 
 PR lib/59240: POSIX.1-2024: cancellation point audit
 PR lib/59247: pthread_cancelstub.c is inadequately tested
 
 | 
| 1.17 |  | 31-Mar-2025 | riastradh | pthread_cancel(3): Add some automatic tests. 
 PR lib/59240: POSIX.1-2024: cancellation point audit
 PR lib/59134: POSIX-1.2024: pthread_setcancelstate must be
 async-signal-safe
 
 | 
| 1.16 |  | 24-Nov-2023 | riastradh | branches:  1.16.2; pthread: Add tests for pthread user stack allocation.
 
 PR lib/57721
 
 XXX pullup-10
 XXX pullup-9
 XXX pullup-8
 
 | 
| 1.15 |  | 21-Jun-2020 | lukem | branches:  1.15.6; fix build of h_thread_local_dtor.cpp
 
 | 
| 1.14 |  | 24-Apr-2019 | kamil | branches:  1.14.2; Add a complete C11 threads(3) implementation
 
 C11 Thread support library is a portable threading C API between OSs,
 similar to std::threads in the C++ world.
 
 The library is implemented as a thin shim over POSIX interfaces.
 
 NetBSD implements the API as a part of the POSIX threading library
 (libpthread(3)).
 
 C11 threads(3) are in the process of making them an integral part
 of the POSIX standard. The interface has been implemented in major
 OSs and used with stopgap libraries for older versions of them.
 
 C11 threading library is already used (with a stopgap implementation)
 in the NetBSD distribution in MESA.
 
 Original implementation by myself from 2016.
 
 ATF tests are new and cover almost all interfaces.
 
 Proposed on tech-userlevel@.
 
 | 
| 1.13 |  | 11-Jul-2017 | joerg | branches:  1.13.6; Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
 functions are used for destructors of thread_local objects.
 
 If a pending destructor exists, prevent unloading of shared objects.
 Introduce __dl_cxa_refcount interface for this purpose. When the last
 reference is gone and the object has been dlclose'd before, the
 unloading is finalized.
 
 Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
 on providing __cxa_thread_atexit as direct wrapper without further
 patching.
 
 | 
| 1.12 |  | 30-Oct-2016 | kamil | branches:  1.12.6; Add new test t_timedmutex
 
 This test is a clone on t_mutex with additional two tests for timed-mutex
 specific block.
 
 All simple-mutex (not with the timed property according to the C11 wording)
 specific tests are covered by pthread_mutex_timedlock(3) with parameter
 ts_lengthy of sufficiently large tv_sec value (right now UINT16_MAX). If,
 a test will hang, it won't wait UINT16_MAX seconds, but will be terminated
 within the default timeout for ATF tests (right now 300 [sec] in my
 NetBSD/amd64 setup).
 
 This test was inspired by a classic selflock test failure of
 pthread_mutex_timedlock(3) of the following form:
 
 #include <assert.h>
 #include <errno.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <time.h>
 
 int main(int argc, char **argv)
 {
 pthread_mutex_t mtx;
 struct timespec ts;
 
 ts.tv_sec = 0;
 ts.tv_nsec = 1000;
 printf("ts{.tv_sec = %d, .tv_nsec=%ld}\n", ts.tv_sec, ts.tv_nsec);
 fflush(stdout);
 
 printf("mtx_init\n");
 assert(pthread_mutex_init(&mtx, NULL) == 0);
 
 printf("mtx_lock\n");
 assert(pthread_mutex_lock(&mtx) == 0);
 
 printf("mtx_timedlock\n");
 assert(pthread_mutex_timedlock(&mtx, &ts) == ETIMEDOUT);
 
 printf("mtx_unlock\n");
 assert(pthread_mutex_unlock(&mtx) == 0);
 
 printf("mtx_destroy\n");
 assert(pthread_mutex_destroy(&mtx) == 0);
 
 return 0;
 }
 
 Current NetBSD implementation wrongly hangs on this test.
 
 The issue was detected during development of the C11 portable threads.
 
 My local tests in chroot presents that the are further issues:
 
 t_timedmutex (21/25): 10 test cases
 mutex1: [0.001142s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:75: *param != 20
 mutex2: [0.261499s] Passed.
 mutex3: [0.261496s] Passed.
 mutex4: [0.001204s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:265: pthread_mutex_timedlock(&mutex, &ts_lengthy): Connection timed out
 mutex5: [0.001235s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:337: pthread_mutex_timedlock(&mutex5, &ts_lengthy): Connection timed out
 mutex6: [21.218497s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:512: start != 1
 mutexattr1: [0.001328s] Passed.
 mutexattr2: [0.001175s] Passed.
 timedmutex1: [301.119397s] Failed: Test case timed out after 300 seconds
 timedmutex2: [301.123081s] Failed: Test case timed out after 300 seconds
 [623.990659s]
 
 I'm also receiveing the same failure in the mutex6 test in t_mutex, so
 there might be a false positives due to local chroot(8) issues.
 
 Commit approved by <christos>.
 
 | 
| 1.11 |  | 12-Apr-2013 | christos | branches:  1.11.10; loosen the test only for qemu.
 
 | 
| 1.10 |  | 28-Mar-2013 | christos | Add pthread_cond_timedwait(3) test from PR/47703 
 | 
| 1.9 |  | 21-Mar-2013 | christos | new dlopen tests for libpthread from manu@ 
 | 
| 1.8 |  | 12-Sep-2012 | manu | branches:  1.8.2; setcontext() used to be incompatible with -lpthread since it affected
 the TLS pointer, therefore wrecking the pthread environement.
 
 Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha)
 that controlled whether setcontext() would change the TLS pointer.
 This change let libpthread override setcontext() with its own version
 that unsets _UC_TLSBASE, enabling safe usage of setcontext() with
 -lpthread.
 
 We also have the following required changes here:
 - rename alpha's _UC_UNIQUE into _UC_TLSBASE
 - add _UC_TLSBASE definition in header file for all ports
 (powerpc, sh3, sparc and sparc64 lack the implementation for now)
 - introduce a libc stub that can be overriden for setcontext()
 - modify MD libcs swapcontext() implementations so that they use the
 setcontext() libc stub instead of doing a plain system call.
 
 While we are there:
 - document various MD _UC_* flags in header file
 - add libc and libpthread tests for swapcontext() behavior
 (hopefully helpful to spot MD problems introduced with this change)
 
 Future work:
 - Deciding whether kernel support or _UC_TLSBASE should be added for
 powerpc, sh3, sparc and sparc64 is left to portmasters
 sparc64
 
 Approved by core@
 
 | 
| 1.7 |  | 06-Apr-2011 | jruoho | branches:  1.7.4; As per PR lib/44818, remove 'lib/libpthread/t_status'. It takes two minutes
 to rewrite this properly if someone misses this.
 
 | 
| 1.6 |  | 24-Mar-2011 | jruoho | A dummy conformance-test for pthread_detach(3). I will extend this later. 
 | 
| 1.5 |  | 24-Mar-2011 | jruoho | A dummy conformance-test of pthread_equal(3). 
 | 
| 1.4 |  | 08-Dec-2010 | joerg | Link t_fpu against libm if the compiler doesn't want to inline sin/cos. 
 | 
| 1.3 |  | 30-Nov-2010 | joerg | Test alignment of constructor / destructor calls as well as the stack of new threads. Currently implement for i386 and AMD64.
 
 | 
| 1.2 |  | 28-Jul-2010 | jruoho | Add a simple test for pthread_join(3). 
 | 
| 1.1 |  | 16-Jul-2010 | jmmv | Convert the libpthread tests to atf. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
 
 I think that this, together with the previous conversion of librt, obsoletes
 the tests in the semaphore/ directory.  Will investigate later.
 
 | 
| 1.7.4.2 |  | 22-May-2014 | yamt | sync with head. 
 for a reference, the tree before this commit was tagged
 as yamt-pagecache-tag8.
 
 this commit was splitted into small chunks to avoid
 a limitation of cvs.  ("Protocol error: too many arguments")
 
 | 
| 1.7.4.1 |  | 30-Oct-2012 | yamt | sync with head 
 | 
| 1.8.2.1 |  | 23-Jun-2013 | tls | resync from head 
 | 
| 1.11.10.1 |  | 04-Nov-2016 | pgoyette | Sync with HEAD 
 | 
| 1.12.6.2 |  | 09-Dec-2023 | martin | Pull up following revision(s) (requested by riastradh in ticket #1924): 
 tests/lib/libpthread/Makefile: revision 1.16
 lib/libpthread/pthread.c: revision 1.184
 distrib/sets/lists/debug/mi: revision 1.424
 distrib/sets/lists/tests/mi: revision 1.1297
 tests/lib/libpthread/t_stack.c: revision 1.1
 tests/lib/libpthread/t_stack.c: revision 1.2
 tests/lib/libpthread/t_stack.c: revision 1.3
 tests/lib/libpthread/t_stack.c: revision 1.4
 tests/lib/libpthread/t_stack.c: revision 1.5
 tests/lib/libpthread/t_stack.c: revision 1.6
 
 pthread: Add tests for pthread user stack allocation.
 PR lib/57721
 
 libpthread/t_stack: Make this more robust to the guard size bug.
 Make sure to allocate enough space for the thread's stack for a guard
 even though there shouldn't be one, so that when we run the thread,
 it doesn't start with the stack pointer pointing into someone else's
 allocation (like malloc) causing stack frames to trash another data
 structure -- or causing the user of that data structure to trash the
 stack frames.
 PR lib/57721
 
 libpthread/t_stack: Omit needless cast in previous.
 Arose from an earlier draft of the change.
 PR lib/57721
 
 libpthread/t_stack: Appease gcc12 maybe-uninitialized warning.
 The jmp_buf is not, in fact, uninitialized at the point of use, but
 it doesn't hurt to narrow the scope a bit to between when the jmp_buf
 is initialized by setjmp, and when the signal handler might be called
 after sigaction.
 Noted by prlw1.
 PR lib/57721
 
 libpthread/t_stack: Fix format string for size_t.
 Tested this on i386 since that had been crashing before, but i386
 doesn't see %zu for unsigned int as a problem.
 PR lib/57721
 
 pthread: Don't adjust user-allocated stack addresses by guardsize.
 PR lib/57721
 
 | 
| 1.12.6.1 |  | 29-Aug-2017 | bouyer | Pull up following revision(s) (requested by joerg in ticket #127): tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.1
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h: revision 1.14
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h: revision 1.17
 lib/libc/stdlib/atexit.h: file removal
 lib/libc/stdlib/exit.c: revision 1.16
 external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h: revision 1.8
 lib/libc/stdlib/exit.c: revision 1.17
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h: revision 1.14
 distrib/sets/lists/debug/shl.mi: revision 1.178
 external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h: revision 1.21
 distrib/sets/lists/debug/shl.mi: revision 1.179
 distrib/sets/lists/debug/mi: revision 1.219
 lib/libpthread/pthread.c: revision 1.150
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h: revision 1.14
 libexec/ld.elf_so/symbols.map: revision 1.2
 include/dlfcn.h: revision 1.25
 external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h: revision 1.21
 external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h: revision 1.23
 external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h: revision 1.18
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h: revision 1.14
 external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/ia64/c++config.h: revision 1.5
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h: revision 1.14
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h: revision 1.17
 distrib/sets/lists/tests/mi: revision 1.755
 external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h: revision 1.20
 external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h: revision 1.21
 external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h: revision 1.21
 external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h: revision 1.20
 lib/libc/dlfcn/dlfcn_elf.c: revision 1.14
 tests/libexec/ld.elf_so/t_thread_local_dtor.sh: revision 1.1
 tests/lib/libpthread/t_thread_local_dtor.sh: revision 1.1
 lib/libc/stdlib/Makefile.inc: revision 1.93
 lib/libc/include/atexit.h: revision 1.1
 lib/libc/include/atexit.h: revision 1.2
 external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h: revision 1.14
 distrib/sets/lists/debug/shl.mi: revision 1.180
 external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h: revision 1.14
 external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h: revision 1.14
 lib/libc/stdlib/cxa_thread_atexit.c: revision 1.1
 tests/libexec/ld.elf_so/helper_dso3/h_helper_dso3.cpp: revision 1.1
 tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.1
 external/gpl3/gcc/lib/libstdc++-v3/arch/riscv64/c++config.h: revision 1.5
 libexec/ld.elf_so/rtld.c: revision 1.185
 external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h: revision 1.19
 external/gpl3/gcc/lib/libstdc++-v3/arch/riscv32/c++config.h: revision 1.5
 external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h: revision 1.15
 external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h: revision 1.21
 external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h: revision 1.12
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h: revision 1.14
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h: revision 1.15
 external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h: revision 1.19
 tests/libexec/ld.elf_so/Makefile: revision 1.9
 external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h: revision 1.20
 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h: revision 1.14
 tests/lib/libpthread/h_thread_local_dtor.cpp: revision 1.1
 distrib/sets/lists/tests/shl.mi: revision 1.11
 tests/lib/libpthread/Makefile: revision 1.13
 libexec/ld.elf_so/rtld.h: revision 1.129
 external/gpl3/gcc/lib/libstdc++-v3/arch/or1k/c++config.h: revision 1.6
 Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
 functions are used for destructors of thread_local objects.
 If a pending destructor exists, prevent unloading of shared objects.
 Introduce __dl_cxa_refcount interface for this purpose. When the last
 reference is gone and the object has been dlclose'd before, the
 unloading is finalized.
 Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
 on providing __cxa_thread_atexit as direct wrapper without further
 patching.
 Fix filename of new debug file
 Add misising DEBUGLIB file
 Avoid common declaration.
 Drop TLS variant checks, emutls is enough for VAX and Sun2.
 
 | 
| 1.13.6.1 |  | 10-Jun-2019 | christos | Sync with HEAD 
 | 
| 1.14.2.1 |  | 09-Dec-2023 | martin | Pull up following revision(s) (requested by riastradh in ticket #1775): 
 tests/lib/libpthread/Makefile: revision 1.16
 lib/libpthread/pthread.c: revision 1.184
 distrib/sets/lists/debug/mi: revision 1.424
 distrib/sets/lists/tests/mi: revision 1.1297
 tests/lib/libpthread/t_stack.c: revision 1.1
 tests/lib/libpthread/t_stack.c: revision 1.2
 tests/lib/libpthread/t_stack.c: revision 1.3
 tests/lib/libpthread/t_stack.c: revision 1.4
 tests/lib/libpthread/t_stack.c: revision 1.5
 tests/lib/libpthread/t_stack.c: revision 1.6
 
 pthread: Add tests for pthread user stack allocation.
 PR lib/57721
 
 libpthread/t_stack: Make this more robust to the guard size bug.
 Make sure to allocate enough space for the thread's stack for a guard
 even though there shouldn't be one, so that when we run the thread,
 it doesn't start with the stack pointer pointing into someone else's
 allocation (like malloc) causing stack frames to trash another data
 structure -- or causing the user of that data structure to trash the
 stack frames.
 PR lib/57721
 
 libpthread/t_stack: Omit needless cast in previous.
 Arose from an earlier draft of the change.
 PR lib/57721
 
 libpthread/t_stack: Appease gcc12 maybe-uninitialized warning.
 The jmp_buf is not, in fact, uninitialized at the point of use, but
 it doesn't hurt to narrow the scope a bit to between when the jmp_buf
 is initialized by setjmp, and when the signal handler might be called
 after sigaction.
 Noted by prlw1.
 PR lib/57721
 
 libpthread/t_stack: Fix format string for size_t.
 Tested this on i386 since that had been crashing before, but i386
 doesn't see %zu for unsigned int as a problem.
 PR lib/57721
 
 pthread: Don't adjust user-allocated stack addresses by guardsize.
 PR lib/57721
 
 | 
| 1.15.6.1 |  | 28-Nov-2023 | martin | Pull up following revision(s) (requested by riastradh in ticket #478): 
 tests/lib/libpthread/Makefile: revision 1.16
 lib/libpthread/pthread.c: revision 1.184
 distrib/sets/lists/debug/mi: revision 1.424
 distrib/sets/lists/tests/mi: revision 1.1297
 tests/lib/libpthread/t_stack.c: revision 1.1
 tests/lib/libpthread/t_stack.c: revision 1.2
 tests/lib/libpthread/t_stack.c: revision 1.3
 tests/lib/libpthread/t_stack.c: revision 1.4
 tests/lib/libpthread/t_stack.c: revision 1.5
 tests/lib/libpthread/t_stack.c: revision 1.6
 
 pthread: Add tests for pthread user stack allocation.
 PR lib/57721
 
 libpthread/t_stack: Make this more robust to the guard size bug.
 Make sure to allocate enough space for the thread's stack for a guard
 even though there shouldn't be one, so that when we run the thread,
 it doesn't start with the stack pointer pointing into someone else's
 allocation (like malloc) causing stack frames to trash another data
 structure -- or causing the user of that data structure to trash the
 stack frames.
 PR lib/57721
 
 libpthread/t_stack: Omit needless cast in previous.
 Arose from an earlier draft of the change.
 PR lib/57721
 
 libpthread/t_stack: Appease gcc12 maybe-uninitialized warning.
 The jmp_buf is not, in fact, uninitialized at the point of use, but
 it doesn't hurt to narrow the scope a bit to between when the jmp_buf
 is initialized by setjmp, and when the signal handler might be called
 after sigaction.
 Noted by prlw1.
 PR lib/57721
 
 libpthread/t_stack: Fix format string for size_t.
 Tested this on i386 since that had been crashing before, but i386
 doesn't see %zu for unsigned int as a problem.
 PR lib/57721
 
 pthread: Don't adjust user-allocated stack addresses by guardsize.
 PR lib/57721
 
 | 
| 1.16.2.1 |  | 02-Aug-2025 | perseant | Sync with HEAD 
 |