Add corpus of tests

This commit is contained in:
2024-01-24 10:47:55 -08:00
parent 3cb99ad441
commit 77ce12e070
182 changed files with 39 additions and 9 deletions

View File

@@ -1,2 +1,2 @@
CompileFlags: CompileFlags:
Add: [-DENABLE_TESTS, -UNDEBUG, -DENABLE_FUZZ] Add: [-DENABLE_MAIN, -UNDEBUG, -DENABLE_FUZZ]

View File

@@ -49,13 +49,19 @@ include(CTest)
# unit test # unit test
add_executable(conflict_set_test ConflictSet.cpp) add_executable(conflict_set_main ConflictSet.cpp)
target_include_directories(conflict_set_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(conflict_set_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(conflict_set_test PRIVATE ENABLE_TESTS) target_compile_definitions(conflict_set_main PRIVATE ENABLE_MAIN)
target_compile_options(conflict_set_test PRIVATE ${TEST_FLAGS})
target_compile_options(conflict_set_test PRIVATE -fsanitize=address,undefined) file(GLOB CORPUS_TESTS ${CMAKE_SOURCE_DIR}/corpus/*)
target_link_options(conflict_set_test PRIVATE -fsanitize=address,undefined)
add_test(NAME conflict_set_test COMMAND conflict_set_test) add_executable(conflict_set_test_driver ConflictSet.cpp TestDriver.cpp)
target_compile_definitions(conflict_set_test_driver PRIVATE ENABLE_FUZZ)
target_include_directories(conflict_set_test_driver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
foreach(TEST ${CORPUS_TESTS})
get_filename_component(hash ${TEST} NAME)
add_test(NAME conflict_set_corpus_${hash} COMMAND conflict_set_test_driver ${TEST})
endforeach()
# fuzz test # fuzz test
set(FUZZ_FLAGS "-fsanitize=fuzzer-no-link,address,undefined") set(FUZZ_FLAGS "-fsanitize=fuzzer-no-link,address,undefined")

View File

@@ -1384,7 +1384,7 @@ namespace std {
void __throw_length_error(const char *) { __builtin_unreachable(); } void __throw_length_error(const char *) { __builtin_unreachable(); }
} // namespace std } // namespace std
#ifdef ENABLE_TESTS #ifdef ENABLE_MAIN
int main(void) { int main(void) {
int64_t writeVersion = 0; int64_t writeVersion = 0;
ConflictSet::Impl cs{writeVersion}; ConflictSet::Impl cs{writeVersion};

16
TestDriver.cpp Normal file
View File

@@ -0,0 +1,16 @@
#include <cstddef>
#include <cstdint>
#include <fstream>
#include <sstream>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
int main(int argc, char **argv) {
for (int i = 1; i < argc; ++i) {
std::ifstream t(argv[i], std::ios::binary);
std::stringstream buffer;
buffer << t.rdbuf();
auto str = buffer.view();
LLVMFuzzerTestOneInput((const uint8_t *)str.data(), str.size());
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
<EFBFBD><EFBFBD>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
*
****<2A><>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
<01>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More