summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-06-07 00:26:06 +0000
committerVitaly Buka <vitalybuka@google.com>2018-06-07 00:26:06 +0000
commit661d81ef61d3b72956ed4cbee23ce599cbc079d2 (patch)
treebc98a21d59b76f329e6406d37ea2d17a7861d45a
parent5d01406cc460f0d41955250a888a7b4e23596145 (diff)
downloadbcm5719-llvm-661d81ef61d3b72956ed4cbee23ce599cbc079d2.tar.gz
bcm5719-llvm-661d81ef61d3b72956ed4cbee23ce599cbc079d2.zip
[sanitizer] Don't use internal_unlink on Windows
llvm-svn: 334152
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc
index 88362553076..3e9c5c59e43 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc
+++ b/compiler-rt/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];
OpenPOWER on IntegriCloud