Skip to content

Commit 8b09ca7

Browse files
committed
[Sanitizer] Try to fix sanitizer_libc_test on FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243797 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4e3a996 commit 8b09ca7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/sanitizer_common/tests/sanitizer_libc_test.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
#include "sanitizer_common/sanitizer_platform.h"
1515
#include "gtest/gtest.h"
1616

17-
#if SANITIZER_LINUX || SANITIZER_MAC
18-
# define SANITIZER_TEST_HAS_STAT_H 1
17+
#if SANITIZER_POSIX
1918
# include <sys/stat.h>
2019
# include "sanitizer_common/sanitizer_posix.h"
21-
#else
22-
# define SANITIZER_TEST_HAS_STAT_H 0
2320
#endif
2421

2522
// A regression test for internal_memmove() implementation.
@@ -70,7 +67,7 @@ static void temp_file_name(char *buf, size_t bufsize, const char *prefix) {
7067
}
7168

7269
// FIXME: File manipulations are not yet supported on Windows
73-
#if !defined(_WIN32)
70+
#if SANITIZER_POSIX
7471
TEST(SanitizerCommon, FileOps) {
7572
const char *str1 = "qwerty";
7673
uptr len1 = internal_strlen(str1);
@@ -90,7 +87,6 @@ TEST(SanitizerCommon, FileOps) {
9087
uptr fsize = internal_filesize(fd);
9188
EXPECT_EQ(len1 + len2, fsize);
9289

93-
#if SANITIZER_TEST_HAS_STAT_H
9490
struct stat st1, st2, st3;
9591
EXPECT_EQ(0u, internal_stat(tmpfile, &st1));
9692
EXPECT_EQ(0u, internal_lstat(tmpfile, &st2));
@@ -105,7 +101,6 @@ TEST(SanitizerCommon, FileOps) {
105101
EXPECT_EQ(0xAB, sam.z);
106102
EXPECT_NE(0xAB, sam.st.st_size);
107103
EXPECT_NE(0, sam.st.st_size);
108-
#endif
109104

110105
char buf[64] = {};
111106
EXPECT_EQ(len1, internal_read(fd, buf, len1));
@@ -128,7 +123,7 @@ TEST(SanitizerCommon, InternalStrFunctions) {
128123
}
129124

130125
// FIXME: File manipulations are not yet supported on Windows
131-
#if !defined(_WIN32) && !SANITIZER_MAC
126+
#if SANITIZER_POSIX && !SANITIZER_MAC
132127
TEST(SanitizerCommon, InternalMmapWithOffset) {
133128
char tmpfile[128];
134129
temp_file_name(tmpfile, sizeof(tmpfile),

0 commit comments

Comments
 (0)