diff options
-rw-r--r-- | compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp | 5 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp | 11 |
2 files changed, 7 insertions, 9 deletions
diff --git a/compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp b/compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp index 3e03c4bddfd..cf38798f328 100644 --- a/compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp @@ -1,5 +1,4 @@ #include <thread> -#include <iostream> const size_t kAllocSize = 16; const size_t kInitialNumAllocs = 1 << 10; @@ -8,8 +7,6 @@ const size_t kNumIterations = 1 << 7; const size_t kNumThreads = 16; void Thread() { - // int sp; - // std::cerr << "Thread starting, sp = " << &sp << std::endl; char *InitialAllocations[kInitialNumAllocs]; char *PeriodicaAllocations[kPeriodicNumAllocs]; for (auto &p : InitialAllocations) p = new char[kAllocSize]; @@ -26,8 +23,6 @@ void Thread() { } int main() { -// Thread(); -// return 0; std::thread *Threads[kNumThreads]; for (auto &T : Threads) T = new std::thread(&Thread); for (auto T : Threads) { diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp index 1f213cd22c7..897036c2c9d 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp @@ -8,7 +8,8 @@ // Tests for sanitizer_libc.h. //===----------------------------------------------------------------------===// #include <algorithm> -#include <fstream> +#include <vector> +#include <stdio.h> #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_file.h" @@ -173,9 +174,11 @@ class SanitizerCommonFileTest : public ::testing::TestWithParam<uptr> { temp_file_name(file_name_, sizeof(file_name_), "sanitizer_common.ReadFile.tmp."); - std::ofstream f(file_name_, std::ios::out | std::ios::binary); - if (!data_.empty()) - f.write(data_.data(), data_.size()); + if (FILE *f = fopen(file_name_, "wb")) { + if (!data_.empty()) + fwrite(data_.data(), data_.size(), 1, f); + fclose(f); + } } void TearDown() override { Unlink(file_name_); } |