diff options
author | Vitaly Buka <vitalybuka@google.com> | 2018-06-07 00:26:06 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2018-06-07 00:26:06 +0000 |
commit | d47c8115e95d6492a422916cf1f495a521249d01 (patch) | |
tree | 76af3f02fcd6489384517de45628b546211e20ee /lib/sanitizer_common | |
parent | a9cc8ed2df816611876cd51f6e273b427fb6c38c (diff) | |
download | compiler-rt-d47c8115e95d6492a422916cf1f495a521249d01.tar.gz |
[sanitizer] Don't use internal_unlink on Windows
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common')
-rw-r--r-- | lib/sanitizer_common/tests/sanitizer_libc_test.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/lib/sanitizer_common/tests/sanitizer_libc_test.cc index 883625530..3e9c5c59e 100644 --- a/lib/sanitizer_common/tests/sanitizer_libc_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_libc_test.cc @@ -88,6 +88,16 @@ static void temp_file_name(char *buf, size_t bufsize, const char *prefix) { #endif } +static void Unlink(const char *path) { +#if SANITIZER_WINDOWS + // No sanitizer needs to delete a file on Windows yet. If we ever do, we can + // add a portable wrapper and test it from here. + ::DeleteFileA(&path[0]); +#else + internal_unlink(path); +#endif +} + TEST(SanitizerCommon, FileOps) { const char *str1 = "qwerty"; uptr len1 = internal_strlen(str1); @@ -143,13 +153,7 @@ TEST(SanitizerCommon, FileOps) { EXPECT_EQ(0, internal_memcmp(buf, str2, len2)); CloseFile(fd); -#if SANITIZER_WINDOWS - // No sanitizer needs to delete a file on Windows yet. If we ever do, we can - // add a portable wrapper and test it from here. - ::DeleteFileA(&tmpfile[0]); -#else - internal_unlink(tmpfile); -#endif + Unlink(tmpfile); } class SanitizerCommonFileTest : public ::testing::TestWithParam<uptr> { @@ -167,7 +171,7 @@ class SanitizerCommonFileTest : public ::testing::TestWithParam<uptr> { f.write(data_.data(), data_.size()); } - void TearDown() override { internal_unlink(file_name_); } + void TearDown() override { Unlink(file_name_); } protected: char file_name_[256]; |