diff options
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r-- | test/sanitizer_common/TestCases/Posix/getrandom.c (renamed from test/sanitizer_common/TestCases/Linux/getrandom.cpp) | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/getrandom.cpp b/test/sanitizer_common/TestCases/Posix/getrandom.c index 08337f537..fdc08bc4e 100644 --- a/test/sanitizer_common/TestCases/Linux/getrandom.cpp +++ b/test/sanitizer_common/TestCases/Posix/getrandom.c @@ -1,5 +1,5 @@ -// RUN: %clangxx -O2 %s -o %t && %run %t -// UNSUPPORTED: android +// RUN: %clang -O2 %s -o %t && %run %t +// UNSUPPORTED: android netbsd darwin solaris // #include <sys/types.h> @@ -8,14 +8,18 @@ #define __GLIBC_PREREQ(a, b) 0 #endif -#if __GLIBC_PREREQ(2, 25) +#if (defined(__linux__) && __GLIBC_PREREQ(2, 25)) || defined(__FreeBSD__) +#define HAS_GETRANDOM +#endif + +#if defined(HAS_GETRANDOM) #include <sys/random.h> #endif int main() { char buf[16]; ssize_t n = 1; -#if __GLIBC_PREREQ(2, 25) +#if defined(HAS_GETRANDOM) n = getrandom(buf, sizeof(buf), 0); #endif return (int)(n <= 0); |