diff --git a/drivers/bus/acpi/acpica/include/platform/acwin.h b/drivers/bus/acpi/acpica/include/platform/acwin.h index b2f1e7bbea3..8c2be4c64a6 100644 --- a/drivers/bus/acpi/acpica/include/platform/acwin.h +++ b/drivers/bus/acpi/acpica/include/platform/acwin.h @@ -88,6 +88,7 @@ typedef unsigned int u32; typedef COMPILER_DEPENDENT_UINT64 u64; #endif +#ifndef __REACTOS__ /* * Map low I/O functions for MS. This allows us to disable MS language * extensions for maximum portability. @@ -101,6 +102,7 @@ typedef COMPILER_DEPENDENT_UINT64 u64; #define mkdir _mkdir #define fileno _fileno #define isatty _isatty +#endif // __REACTOS__ #if _MSC_VER <= 1200 /* Versions below VC++ 6 */ #define vsnprintf _vsnprintf diff --git a/modules/rostests/CMakeLists.txt b/modules/rostests/CMakeLists.txt index 79a52785129..960a1f9e96e 100644 --- a/modules/rostests/CMakeLists.txt +++ b/modules/rostests/CMakeLists.txt @@ -1,6 +1,10 @@ start_module_group(rostests) +if(NOT MSVC) + add_link_options("-Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/test-section.lds") +endif() + add_definitions(-DHAVE_APITEST) if(MSVC_IDE) diff --git a/modules/rostests/test-section.lds b/modules/rostests/test-section.lds new file mode 100644 index 00000000000..0f2132e03a6 --- /dev/null +++ b/modules/rostests/test-section.lds @@ -0,0 +1,11 @@ +/* Make sure the .test section is kept and sorted */ +SECTIONS +{ + .test BLOCK(__section_alignment__) : + { + ___test_start__ = . ; + KEEP (*(SORT(.test$*))) + ___test_end__ = . ; + } +} +INSERT BEFORE .reloc; /* .reloc is always at the end */ diff --git a/sdk/include/wine/test.h b/sdk/include/wine/test.h index cf00a9832a6..773eac5059f 100644 --- a/sdk/include/wine/test.h +++ b/sdk/include/wine/test.h @@ -586,7 +586,12 @@ struct test void (*func)(void); }; +#ifdef __REACTOS__ +extern const struct test winetest_testlist_start[]; +const struct test* winetest_testlist = &winetest_testlist_start[1]; +#else extern const struct test winetest_testlist[]; +#endif /* debug level */ int winetest_debug = 1; @@ -1018,8 +1023,41 @@ extern void winetest_end_nocount(void); #define GetNTVersion() ((GetMajorNTVersion() << 8) | GetMinorNTVersion()) #define __REACTOS__WinVer_lt(Ver) ((GetNTVersion() < (Ver))) +#ifndef STANDALONE +struct test +{ + const char *name; + void (*func)(void); +}; +#endif + +/* Section allocation helper for automatic test registration */ +#if defined(_MSC_VER) + #pragma section(".test$A",long,read) + #define _TESTALLOC(x) __declspec(allocate(x)) + #define _PRAGMA_SECTION(x, y, z) __pragma(section(x, y, z)) + #define _TESTKEEP(x) const void* keep_##x = &x; +#elif defined(__GNUC__) + #define _TESTALLOC(x) __attribute__((used, section(x))) + #define _PRAGMA_SECTION(x, y, z) + #define _TESTKEEP(x) +#else + #error Your compiler is not supported. +#endif + +#undef START_TEST +#define START_TEST(name) \ + EXTERN_C void func_##name(void); \ + _PRAGMA_SECTION(_CRT_STRINGIZE(.test$B##name), long, read); \ + _TESTALLOC(_CRT_STRINGIZE(.test$B##name)) const struct test winetest_testentry_##name = { #name, func_##name }; \ + _TESTKEEP(winetest_testentry_##name) \ + EXTERN_C void func_##name(void) + #ifdef STANDALONE +_TESTALLOC(".test$A") const struct test winetest_testlist_start[] = { { "", 0 } }; +#define winetest_testlist winetest_testlist_dummy + LONG winetest_get_successes(void) { return winetest_successes;