[PATCH] D27729: [libFuzzer] Diff 20 - Update tests to use more general functions instead of posix specific.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 14:18:04 PST 2016


mpividori updated this revision to Diff 81654.
mpividori added a comment.

@kcc Ok. Let me know if you agree with this final diff.


Repository:
  rL LLVM

https://reviews.llvm.org/D27729

Files:
  lib/Fuzzer/test/OutOfMemoryTest.cpp
  lib/Fuzzer/test/StrstrTest.cpp


Index: lib/Fuzzer/test/StrstrTest.cpp
===================================================================
--- lib/Fuzzer/test/StrstrTest.cpp
+++ lib/Fuzzer/test/StrstrTest.cpp
@@ -8,6 +8,11 @@
 #include <cstdio>
 #include <cstdlib>
 
+#ifdef _WIN32
+#define strcasestr strstr
+#define memmem(a, b, c, d) true
+#endif
+
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size < 4) return 0;
   std::string s(reinterpret_cast<const char*>(Data), Size);
Index: lib/Fuzzer/test/OutOfMemoryTest.cpp
===================================================================
--- lib/Fuzzer/test/OutOfMemoryTest.cpp
+++ lib/Fuzzer/test/OutOfMemoryTest.cpp
@@ -9,6 +9,7 @@
 #include <cstring>
 #include <iostream>
 #include <unistd.h>
+#include <thread>
 
 static volatile char *SinkPtr;
 
@@ -21,7 +22,7 @@
           char *p = new char[kSize];
           memset(p, 0, kSize);
           SinkPtr = p;
-          sleep(1);
+          std::this_thread::sleep_for(std::chrono::seconds(1));
         }
       }
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27729.81654.patch
Type: text/x-patch
Size: 1031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161215/026ae7b4/attachment.bin>


More information about the llvm-commits mailing list