Add corpus of tests
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
CompileFlags:
|
CompileFlags:
|
||||||
Add: [-DENABLE_TESTS, -UNDEBUG, -DENABLE_FUZZ]
|
Add: [-DENABLE_MAIN, -UNDEBUG, -DENABLE_FUZZ]
|
||||||
|
|||||||
+13
-7
@@ -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")
|
||||||
|
|||||||
+1
-1
@@ -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};
|
||||||
|
|||||||
@@ -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.
@@ -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.
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.
@@ -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.
@@ -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.
@@ -0,0 +1 @@
|
|||||||
|
�
|
||||||
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
Reference in New Issue
Block a user