Skip to content

Commit

Permalink
fix tests on musllinux
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Feb 2, 2025
1 parent 12a2b7f commit 7fb0446
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 10 additions & 2 deletions tests/integration/testdependencies/dependency.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
#include <stdint.h>
#include <math.h>
#include <pthread.h>
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
#if defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 28)
#include <threads.h>
#endif
#endif

int dep_run()
{
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 34)
#if defined(__GLIBC_PREREQ)

#if __GLIBC_PREREQ(2, 34)
// pthread_mutexattr_init was moved to libc.so.6 in manylinux_2_34+
pthread_mutexattr_t attr;
int sts = pthread_mutexattr_init(&attr);
Expand All @@ -29,4 +33,8 @@ int dep_run()
#else
return 0;
#endif

#else
return 0;
#endif
}
20 changes: 14 additions & 6 deletions tests/integration/testdependencies/testdependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#include <stdint.h>
#include <math.h>
#include <pthread.h>
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
#if defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 28)
#include <threads.h>
#endif
#endif
#endif
#include <Python.h>

static __thread int tres = 0;
Expand All @@ -24,21 +26,27 @@ run(PyObject *self, PyObject *args)

#ifdef WITH_DEPENDENCY
res = dep_run();
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 34)
#elif defined(__GLIBC_PREREQ)

#if __GLIBC_PREREQ(2, 34)
// pthread_mutexattr_init was moved to libc.so.6 in manylinux_2_34+
pthread_mutexattr_t attr;
res = pthread_mutexattr_init(&attr);
if (res == 0) {
pthread_mutexattr_destroy(&attr);
}
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
#elif __GLIBC_PREREQ(2, 28)
res = thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
#elif __GLIBC_PREREQ(2, 24)
res = (int)nextupf(0.0F);
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)
#elif __GLIBC_PREREQ(2, 17)
res = (int)(intptr_t)secure_getenv("NON_EXISTING_ENV_VARIABLE");
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
#elif __GLIBC_PREREQ(2, 10)
res = malloc_info(0, stdout);
#else
res = 0;
#endif

#else
res = 0;
#endif
Expand Down

0 comments on commit 7fb0446

Please sign in to comment.