tests: Specify the test section as __RODATA on darwin

Addresses build failures on darwin such as:

tests/os-wrappers-test.c:413:1: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma
TEST(os_wrappers_epoll_create_cloexec_fallback)
^
../tests/test-runner.h:44:35: note: expanded from macro 'TEST'
                 __attribute__ ((used, section ("test_section"))) = {   \
                                                ^

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston Sequoia 2023-01-27 23:25:36 -08:00
parent a8a1d3d1cf
commit 276a28afd1
2 changed files with 13 additions and 2 deletions

View file

@ -31,6 +31,12 @@
#include <unistd.h>
#ifdef __APPLE__
#define TEST_SECTION "__RODATA,test_section"
#else
#define TEST_SECTION "test_section"
#endif
struct test {
const char *name;
void (*run)(void);
@ -41,7 +47,7 @@ struct test {
static void name(void); \
\
const struct test test##name \
__attribute__ ((used, section ("test_section"))) = { \
__attribute__ ((used, section (TEST_SECTION))) = { \
#name, name, 0 \
}; \
\
@ -51,7 +57,7 @@ struct test {
static void name(void); \
\
const struct test test##name \
__attribute__ ((used, section ("test_section"))) = { \
__attribute__ ((used, section (TEST_SECTION))) = { \
#name, name, 1 \
}; \
\