[llvm] r242850 - [Fuzzer] Clearly separate regular and DFSan tests. NFC.
Alexey Samsonov
vonosmas at gmail.com
Tue Jul 21 15:51:49 PDT 2015
Author: samsonov
Date: Tue Jul 21 17:51:49 2015
New Revision: 242850
URL: http://llvm.org/viewvc/llvm-project?rev=242850&view=rev
Log:
[Fuzzer] Clearly separate regular and DFSan tests. NFC.
Added:
llvm/trunk/lib/Fuzzer/test/MemcmpTest.cpp
- copied, changed from r242821, llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp
llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp
- copied, changed from r242821, llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp
llvm/trunk/lib/Fuzzer/test/fuzzer-dfsan.test
Removed:
llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp
llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp
Modified:
llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
llvm/trunk/lib/Fuzzer/test/fuzzer.test
Modified: llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/CMakeLists.txt?rev=242850&r1=242849&r2=242850&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/test/CMakeLists.txt Tue Jul 21 17:51:49 2015
@@ -5,8 +5,8 @@
set(CMAKE_CXX_FLAGS_RELEASE "${LIBFUZZER_FLAGS_BASE} -O0 -fsanitize-coverage=edge,indirect-calls")
set(DFSanTests
- DFSanMemcmpTest
- DFSanSimpleCmpTest
+ MemcmpTest
+ SimpleCmpTest
)
set(Tests
@@ -16,9 +16,9 @@ set(Tests
FullCoverageSetTest
InfiniteTest
NullDerefTest
+ SimpleCmpTest
SimpleTest
TimeoutTest
- ${DFSanTests}
)
set(CustomMainTests
Removed: llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp?rev=242849&view=auto
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp (removed)
@@ -1,12 +0,0 @@
-// Simple test for a fuzzer. The fuzzer must find a particular string.
-#include <cstring>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
-
-extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size >= 8 && memcmp(Data, "01234567", 8) == 0) {
- fprintf(stderr, "BINGO\n");
- exit(1);
- }
-}
Removed: llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp?rev=242849&view=auto
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp (removed)
@@ -1,30 +0,0 @@
-// Simple test for a fuzzer. The fuzzer must find several narrow ranges.
-#include <cstdint>
-#include <cstdlib>
-#include <cstring>
-#include <cstdio>
-
-extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size < 14) return;
- uint64_t x = 0;
- int64_t y = 0;
- int z = 0;
- unsigned short a = 0;
- memcpy(&x, Data, 8);
- memcpy(&y, Data + Size - 8, 8);
- memcpy(&z, Data + Size / 2, sizeof(z));
- memcpy(&a, Data + Size / 2 + 4, sizeof(a));
-
- if (x > 1234567890 &&
- x < 1234567895 &&
- y >= 987654321 &&
- y <= 987654325 &&
- z < -10000 &&
- z >= -10005 &&
- z != -10003 &&
- a == 4242) {
- fprintf(stderr, "BINGO; Found the target: size %zd (%zd, %zd, %d, %d), exiting.\n",
- Size, x, y, z, a);
- exit(1);
- }
-}
Copied: llvm/trunk/lib/Fuzzer/test/MemcmpTest.cpp (from r242821, llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/MemcmpTest.cpp?p2=llvm/trunk/lib/Fuzzer/test/MemcmpTest.cpp&p1=llvm/trunk/lib/Fuzzer/test/DFSanMemcmpTest.cpp&r1=242821&r2=242850&rev=242850&view=diff
==============================================================================
(empty)
Copied: llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp (from r242821, llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp?p2=llvm/trunk/lib/Fuzzer/test/SimpleCmpTest.cpp&p1=llvm/trunk/lib/Fuzzer/test/DFSanSimpleCmpTest.cpp&r1=242821&r2=242850&rev=242850&view=diff
==============================================================================
(empty)
Added: llvm/trunk/lib/Fuzzer/test/fuzzer-dfsan.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-dfsan.test?rev=242850&view=auto
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-dfsan.test (added)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-dfsan.test Tue Jul 21 17:51:49 2015
@@ -0,0 +1,6 @@
+CHECK: BINGO
+
+RUN: not ./LLVMFuzzer-SimpleCmpTest-DFSan -use_traces=1 -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s
+
+RUN: not ./LLVMFuzzer-MemcmpTest-DFSan -use_traces=1 -seed=1 -runs=100 -timeout=5 2>&1 | FileCheck %s
+
Modified: llvm/trunk/lib/Fuzzer/test/fuzzer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer.test?rev=242850&r1=242849&r2=242850&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer.test Tue Jul 21 17:51:49 2015
@@ -19,10 +19,7 @@ RUN: not ./LLVMFuzzer-FourIndependentBra
RUN: not ./LLVMFuzzer-CounterTest -use_counters=1 -max_len=6 -seed=1 -timeout=15 2>&1 | FileCheck %s
-RUN: not ./LLVMFuzzer-DFSanSimpleCmpTest-DFSan -use_traces=1 -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s
-RUN: not ./LLVMFuzzer-DFSanSimpleCmpTest -use_traces=1 -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s
-
-RUN: not ./LLVMFuzzer-DFSanMemcmpTest-DFSan -use_traces=1 -seed=1 -runs=100 -timeout=5 2>&1 | FileCheck %s
+RUN: not ./LLVMFuzzer-SimpleCmpTest -use_traces=1 -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s
RUN: not ./LLVMFuzzer-CxxTokensTest -seed=1 -timeout=15 -tokens=%S/../cxx_fuzzer_tokens.txt 2>&1 | FileCheck %s
More information about the llvm-commits
mailing list