summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-16 18:41:39 -0300
committerEuAndreh <eu@euandre.org>2025-01-16 18:41:39 -0300
commitc341b2bdb0259ea00c08a33a0e1d71d678039725 (patch)
treeacae3853f8a2bacf2de53783ca1d59faa19c602d /tests
parentMakefile: keep symlinks in "install" target (diff)
downloadpindaiba-c341b2bdb0259ea00c08a33a0e1d71d678039725.tar.gz
pindaiba-c341b2bdb0259ea00c08a33a0e1d71d678039725.tar.xz
src/trace.c: Replace thread_local with pthreads
Diffstat (limited to 'tests')
-rw-r--r--tests/trace.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/trace.c b/tests/trace.c
index aa10c81..5b59a46 100644
--- a/tests/trace.c
+++ b/tests/trace.c
@@ -19,7 +19,7 @@ test_ftracef(void) {
FILE *file = NULL;
char *str = NULL;
- const enum TraceLevel orig = LEVEL;
+ const enum TraceLevel orig = (enum TraceLevel)pthread_getspecific(LEVEL_KEY);
trace_set_level(TraceLevel_INFO);
{
@@ -191,7 +191,15 @@ int
main(void) {
int rc = EXIT_FAILURE;
- LEVEL = TraceLevel_DEBUG;
+ if (pthread_once(&ONCE, init)) {
+ perror("pthread_once()");
+ goto out;
+ }
+
+ if (trace_set_level(TraceLevel_DEBUG)) {
+ perror("trace_set_level()");
+ goto out;
+ }
if (test_ftracef()) {
perror("test_ftracef()");