I update the tests to use SearchMemory(), StrStr(), StrCaseStr(), and SleepSeconds(), instead of posix specific functions.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Fuzzer/FuzzerUtilWindows.cpp | ||
---|---|---|
181–182 | Windows has strstr, it just doesn't have strcasestr. I would implement this one using just strstr. |
lib/Fuzzer/FuzzerUtilWindows.cpp | ||
---|---|---|
181–182 | @zturner , You are right. I confused because I found the function StrStr() from Shlwapi.lib . I didn't realized that strstr() is part of the std library. |
lib/Fuzzer/test/OutOfMemoryTest.cpp | ||
---|---|---|
5 | Free from dependencies from libFuzzer?? Even if this tests are linked with the LLVMFuzzer.lib library? You want me to remove the include and declare the function signature? I don't understand... |
lib/Fuzzer/test/OutOfMemoryTest.cpp | ||
---|---|---|
5 | In CustomCrossOverTest.cpp, CustomMutatorTest.cpp, and other tests, you also include: |
lib/Fuzzer/test/OutOfMemoryTest.cpp | ||
---|---|---|
5 | I don't want these tests to depend on libFuzzer in any way.
These are the exceptions because they use cutom mutator/crossover -- something that other fuzzing engines don't support. |
What about copying these functions into a common header file that has no dependencies and can be symlinked from the test dir into the source tree? That way the test (which now consists of a cpp file and a h file) is self contained, but there is still only one master copy of the h file so we don't have to worry about code duplication. Then FuzzerUtilWindows.h could just incldue that header file.
(Of course the alternative is just rewrite the function here, which is not the end of the world, although kind of unfortunate)
(summary of offline discussion).
For OutOfMemoryTest.cpp just use c++11 sleep
For StrstrTest.cpp: this test tests the ability of *a* fuzzing engine to look through strstr and friends.
If some platform does not have e.g. strcasestr, there is no point in implementing it for this test.
a simple
#ifdef SOMETHING # define strcasestr strstr #endif
will be good enough
LGTM with a nit
lib/Fuzzer/test/StrstrTest.cpp | ||
---|---|---|
12 | add a comment: |
Windows has strstr, it just doesn't have strcasestr. I would implement this one using just strstr.