-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fuzzer Framework #5940
Merged
Merged
Fuzzer Framework #5940
Changes from 52 commits
Commits
Show all changes
168 commits
Select commit
Hold shift + click to select a range
0fa075e
first commit fuzzer
nicola-cab ddd2c1a
fix script
nicola-cab 19027a1
restore parallel fuzzer
nicola-cab 85c999f
code refactory
nicola-cab 1fe1da0
code re-org
nicola-cab 70d7bf4
support input file from cmd line
nicola-cab 7cf6411
comment crashing commands in order to verify them
nicola-cab 73a28f0
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab d111728
code cleanup and logging
nicola-cab 0b16041
added fuzz logger
nicola-cab d8cc443
added new constructor for libfuzz
nicola-cab 30cb356
ctro for libfuzz
nicola-cab 51b9b3f
add support for libfuzzer
nicola-cab bbd3cfe
appease format checks
nicola-cab 89c3381
lib fuzzer support and defines
nicola-cab 15a61cf
added support for libfuzzer
nicola-cab 4c569da
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab a574d88
unify how to launch fuzzer
nicola-cab a5a3e31
fix forgotten file
nicola-cab 22379e1
adding open/close to commands
nicola-cab dfa6646
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab c978ad2
Fix logging
nicola-cab a65267e
catch some exceptions during fuzzing
nicola-cab 6763a8a
exception unification catching logic
nicola-cab a5e49db
Make realm-libfuzz compile on Linux
jedelbo 4ad5408
Merge branch 'je/fuzzer' into nc/fuzzer
nicola-cab dcf2267
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab 9e50175
restore encryption
nicola-cab 48f79c6
fix parent node verification function
nicola-cab 7c6a2b8
fix string cmp
nicola-cab d6156eb
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab 98a7e77
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab aec4c77
Attempt to fix compilation issues for non apple builds
nicola-cab 91e4c2d
attempt to fix compilation
nicola-cab 585e0ea
fix compilation issues
nicola-cab 6fbf9ca
attempt to fix compilation issue
nicola-cab 3a8af67
attempt to fix compilation
nicola-cab 8535fe3
clean up
nicola-cab 97f65b4
cleanup
nicola-cab 3ef6e22
cleanup
nicola-cab 1753b20
attempt to fix compilation
nicola-cab 1efb701
test
nicola-cab a29f4c3
revert specialityBuilds cmake changes
nicola-cab b1dea82
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab 8082cb2
Add Readme
nicola-cab 8b0f4ed
changelog entry
nicola-cab 3b26962
removed stale testing folder
nicola-cab b097258
better formatting
nicola-cab 66d6791
better formatting
nicola-cab bdf1517
restore support for afl++ and fix clang libfuzzer command line
nicola-cab 6de6c68
make linux builders happy
nicola-cab 56b41c3
really testing things
nicola-cab 2caa486
add cstring header
nicola-cab b468cbb
test building
nicola-cab f86bf68
fix libuv finding packages
nicola-cab e8078d8
fix libuv finding cmake
nicola-cab b0300c2
Update CMakeLists.txt
fealebenpae 1be6f6b
Update CMakeLists.txt
fealebenpae 3e3f757
Update CMakeLists.txt
fealebenpae d7034e3
pull master and fix conflicts
nicola-cab 908cc1b
fix changelog and readme
nicola-cab 26b1cfb
add evergreen running logic for fuzzer
nicola-cab 58d86fa
attempt to fix evergreen cnf
nicola-cab dfc76b1
fuzzer cnf
nicola-cab dfaa03d
attempt to fix evergreen cnf
nicola-cab 88c2405
run fuzzer for macos builder
nicola-cab f4855a6
test
nicola-cab cc75925
test
nicola-cab 4a7ccc4
test
nicola-cab 7848dbe
test enable macos-fuzzer
nicola-cab 92c6de2
add fuzzer to evergreen
nicola-cab 45c2d25
removed redundant cmake build mode
nicola-cab 9c65f6b
compile and fuzzer for macos fuzzing build
nicola-cab 417792b
test
nicola-cab 7836c8c
test
nicola-cab 76b3690
test on ubuntu
nicola-cab c944d82
test
nicola-cab e6a99e3
test fuzzer
nicola-cab e7d6c2b
pull master and fix conflicts
nicola-cab e04aa57
compile and test fuzzer
nicola-cab 4232bca
compile test
nicola-cab d900dd0
test fuzzer as task
nicola-cab 4558c36
test macos fuzzer
nicola-cab 0c1a355
build fuzzer
nicola-cab bb8727b
last test before to try things locally
nicola-cab 4d8ad3c
fix param
nicola-cab e47ccb0
changes to cnf file
nicola-cab c3cbf06
fix spaces
nicola-cab 1a155ab
pull master and fix conflicts
nicola-cab 5868931
fix after evergreen validate check
nicola-cab 216f42f
re-org a bit fuzzer builder
nicola-cab 695e33d
remove quotes
nicola-cab ed60633
test
nicola-cab 6f73ae2
remove fuzzer from task-group
nicola-cab fd9fd42
add fuzzer build
nicola-cab ee241ae
test compilation and if compile-rt works
nicola-cab 8ca4cdf
fix generator
nicola-cab 0053aa4
xcode generator
nicola-cab 93863ec
test if fixes linking issues
nicola-cab 9832d74
test
nicola-cab 810729c
test
nicola-cab 0dcc548
test building and linking
nicola-cab 71deb5b
fix cnf
nicola-cab e57c557
test xcode 14.1
nicola-cab 003a536
test
nicola-cab 96d6c03
pull master
nicola-cab 5e47421
test fuzzer
nicola-cab a6bd9ee
unify include logic
nicola-cab a773bde
add linking instruction for address sanitizer
nicola-cab 4c42fe6
add linker flags to correct builder
nicola-cab 65d28d5
link fuzzer
nicola-cab 8a52a89
test only fuzzer
nicola-cab 1a6a44b
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab dfd16ae
test running the fuzzer on ubuntu
nicola-cab 3561b15
no extra flags
nicola-cab 4f66ee2
add toolchain file for LLVM via homebrew
fealebenpae 4bc951a
test pre keyword
nicola-cab 40d7218
Merge branch 'nc/fuzzer' of github.com:realm/realm-core into nc/fuzzer
nicola-cab e090c4a
fix file format
nicola-cab 106ba7c
test pre condition
nicola-cab 0b37563
Revert "add toolchain file for LLVM via homebrew"
nicola-cab 6e943ce
try daily setup
nicola-cab 690ec81
try daily setup
nicola-cab 26e6232
restructure a little bit evergreen file
nicola-cab fe367ee
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab bc3cf97
added support for upload crash input strings
nicola-cab 0fdd865
added support for publishing to s3 fuzzer crash dumps
nicola-cab 4f2c57b
test crash
nicola-cab db8cbb0
fix typo
nicola-cab 2f6cdde
test
nicola-cab 200573a
fix running fuzzer exe
nicola-cab 1f03f05
several fixes
nicola-cab d87484f
better folder naming and fix path
nicola-cab 7461d5a
delete prev folder
nicola-cab 772d825
appease clang format checks
nicola-cab 33b1fbe
test exe path
nicola-cab 6c7ea4f
test launcher
nicola-cab 990acf1
fix path
nicola-cab cc37f08
fix path in order to generate crash report
nicola-cab 49b978d
test path
nicola-cab 937a36b
remove archive file after upload
nicola-cab 54b3943
test cpack find
nicola-cab 52f1369
remove cpack machinery and test
nicola-cab d0115c4
test
nicola-cab 34a75a4
revert cnf to prev working
nicola-cab 6d2fae3
debug
nicola-cab af0ed29
fix crash file detection
nicola-cab 165ba21
run the fuzzer daily
nicola-cab bdf8e91
remove fake exception + remove support for async tr
nicola-cab e6223aa
Update test/realm-fuzzer/afl_runner.cpp
nicola-cab 847c8c1
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab e67002e
code review
nicola-cab a7f9cad
better build folder names
nicola-cab 14bedb6
code review
nicola-cab a43147a
fix changelog
nicola-cab 5d071e1
pull master and fix conflicts
nicola-cab d702196
Merge branch 'master' of github.com:realm/realm-core into nc/fuzzer
nicola-cab 27d7d1e
update scripts
nicola-cab 2f05d63
merge master and fix conflicts
nicola-cab 1406fe1
update entry in the changelog
nicola-cab 714677b
Fix compile warnings
jedelbo d1d292a
fix conflicts with master
nicola-cab f37edc1
delete .gitignore
nicola-cab 0f86d13
code review
nicola-cab 89f1fa7
test compilation
nicola-cab 86adb58
test
nicola-cab ce14bb4
restore configuration
nicola-cab 117ea1c
fix configuration file
nicola-cab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
findings/* | ||
fuzzy-tests* | ||
generate-fuzzy-input* | ||
*.d | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
set(TEST_AFL_SOURCES | ||
afl_runner.cpp | ||
fuzz_engine.cpp | ||
fuzz_object.cpp | ||
fuzz_configurator.cpp | ||
) # TEST_AFL_SOURCES_OBJECT_STORE | ||
|
||
set(TEST_LIBFUZZER_SOURCES | ||
libfuzzer_runner.cpp | ||
fuzz_engine.cpp | ||
fuzz_object.cpp | ||
fuzz_configurator.cpp | ||
) # TEST_LIBFUZZER_SOURCES_OBJECT_STORE | ||
|
||
file(GLOB FUZZER_RUN_SCRIPTS | ||
"scripts/start_fuzz_afl.sh" | ||
"scripts/start_lib_fuzzer.sh") | ||
|
||
file(COPY ${FUZZER_RUN_SCRIPTS} | ||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
file(GLOB AFL_SEEDS "testcases/*") | ||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/testcases) | ||
file(COPY ${AFL_SEEDS} | ||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/testcases) | ||
|
||
add_executable(realm-afl++ ${TEST_AFL_SOURCES}) | ||
target_link_libraries(realm-afl++ TestUtil ObjectStore) | ||
|
||
if(REALM_LIBFUZZER) | ||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") | ||
add_executable(realm-libfuzz ${TEST_LIBFUZZER_SOURCES}) | ||
target_link_libraries(realm-libfuzz TestUtil ObjectStore) | ||
endif() | ||
endif() | ||
|
||
# on Apple platforms we use the built-in CFRunLoop | ||
# everywhere else it's libuv, except UWP where it doesn't build | ||
if(NOT APPLE AND NOT WINDOWS_STORE) | ||
if(REALM_FETCH_MISSING_DEPENDENCIES) | ||
find_package(LibUV) | ||
else() | ||
find_package(LibUV REQUIRED) | ||
endif() | ||
|
||
if(LibUV_FOUND) | ||
set(libuv_target LibUV::LibUV) | ||
elseif(REALM_FETCH_MISSING_DEPENDENCIES) | ||
message(STATUS "LibUV not found, building from source with FetchContent") | ||
include(FetchContent) | ||
set(libUV_Git_TAG "v1.35.0") | ||
|
||
if(MSVC) | ||
set(liUV_Git_TAG "v1.43.0") | ||
endif() | ||
|
||
FetchContent_Declare( | ||
libuv | ||
GIT_REPOSITORY https://github.com/libuv/libuv.git | ||
GIT_TAG ${libUV_Git_TAG} | ||
) | ||
|
||
# Don't use FetchContent_MakeAvailable since it wants to build libuv.so as well | ||
FetchContent_Populate(libuv) | ||
add_subdirectory(${libuv_SOURCE_DIR} ${libuv_BINARY_DIR} EXCLUDE_FROM_ALL) | ||
set(libuv_target uv_a) | ||
endif() | ||
|
||
target_link_libraries(realm-afl++ ${libuv_target}) | ||
target_compile_definitions(realm-afl++ PUBLIC REALM_HAVE_UV=1) | ||
get_property(libuv_include_dir TARGET ${libuv_target} PROPERTY INCLUDE_DIRECTORIES) | ||
target_include_directories(realm-afl++ PRIVATE ${libuv_include_dir}) | ||
|
||
if(REALM_LIBFUZZER) | ||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") | ||
target_link_libraries(realm-libfuzz ${libuv_target}) | ||
target_compile_definitions(realm-libfuzz PUBLIC REALM_HAVE_UV=1) | ||
get_property(libuv_include_dir TARGET ${libuv_target} PROPERTY INCLUDE_DIRECTORIES) | ||
target_include_directories(realm-libfuzz PRIVATE ${libuv_include_dir}) | ||
endif() | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# The Fuzz Framework project | ||
|
||
This project is an attempt to put together all the small fuzzers we have already scattered around the code. | ||
There are two goals: | ||
1. To be able to run all the fuzzers, collect crashes reports and fix possible bugs that the fuzzer might find. | ||
2. To be able to replace libfuzzer with google fuzz test (https://github.com/google/fuzztest) at some point. | ||
|
||
AFL++ support is not dropped yet, but since we want to integrate things inside evergreen and follow the same approach we implement for address/thread sanitazer we prefer to use libfuzzer and clang. | ||
## Prerequisites | ||
|
||
In case you want to use AFL++, then you should install the latest version of the American Fuzzy Lop ++ (AFL++). | ||
Please use this quick guide: https://aflplus.plus/building/ it requires llvm >= 9.0. | ||
|
||
For using libfuzzer, the only pre-requisite is having a recent version of clang. | ||
## Running | ||
Note REALM_MAX_BPNODE_SIZE is the max number of nodes contained in the b+tree. It determines the depth of the tree and its fanout. \ | ||
This number should be random generated. | ||
bmunkholm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
If you don't want to build manually, you can skip this section and jump to the `Scripts` section. \ | ||
Run the fuzzer via AFL++: | ||
|
||
``` | ||
cd <realm-core-src> | ||
mkdir build | ||
cd build | ||
cmake -D CMAKE_BUILD_TYPE=${build_mode} | ||
-D CMAKE_C_COMPILER=afl-cc | ||
-D CMAKE_CXX_COMPILER=afl-c++ | ||
-D REALM_MAX_BPNODE_SIZE="${REALM_MAX_BPNODE_SIZE}" | ||
-D REALM_ENABLE_ENCRYPTION=ON | ||
-G Ninja | ||
.. | ||
cmake --build . --target realm-afl++ | ||
afl-fuzz -t "$time_out" | ||
-m "$memory" | ||
-i "${ROOT_DIR}/test/fuzzy_object_store/testcases" | ||
-o "${FINDINGS_DIR}" | ||
realm-afl++ @@ | ||
``` | ||
|
||
Run the fuzzer via libFuzzer (only with Clang) | ||
``` | ||
cd <realm-core-src> | ||
mkdir build | ||
cd build | ||
cmake -D REALM_LIBFUZZER=ON | ||
-D CMAKE_BUILD_TYPE=${build_mode} | ||
-D CMAKE_C_COMPILER=clang | ||
-D CMAKE_CXX_COMPILER=clang++ | ||
-D REALM_MAX_BPNODE_SIZE="${REALM_MAX_BPNODE_SIZE}" | ||
-D REALM_ENABLE_ENCRYPTION=ON | ||
-G Ninja | ||
.. | ||
cmake --build . --target realm-libfuzz | ||
./realm_libfuzz <corpus> | ||
``` | ||
|
||
## Scripts | ||
|
||
`sh start_fuzz_afl.sh` | ||
Builds `realm-core` and `object-store` in `Debug` mode using the afl++ compiler `afl-cc` and starts 1 instance of `afl-fuzz`. | ||
It expects `AFLPlusPlus` to be installed in your system and in general added to your `PATH`. | ||
Optionally, the following arguments can be passed to the script: | ||
1) `<num_fuzzers>` the number of fuzzers to launch (by default 1). | ||
2) `<build_mode>` either `Release` or `Debug`. | ||
|
||
`sh start_lib_fuzzer.sh` | ||
Builds `realm-core` and `object-store` in `Debug` mode using the clang compiler and starts `realm-libfuzz`. | ||
Optionally, the following arguments can be passed to the script: | ||
1) `<build_mode>` either `Release` or `Debug`. | ||
2) `<corpus>` essentially initial set of inputs for improving fuzzer efficiency. | ||
|
||
## See Also | ||
|
||
[AFL++ github](https://github.com/AFLplusplus/AFLplusplus) \ | ||
[LibFuzzer](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) \ | ||
[Google Fuzz Test](https://github.com/google/fuzztest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/************************************************************************* | ||
* | ||
* Copyright 2022 Realm Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
**************************************************************************/ | ||
|
||
#include "fuzz_engine.hpp" | ||
#include <vector> | ||
#include <string> | ||
#include <iostream> | ||
|
||
#if REALM_USE_UV | ||
#include <uv.h> | ||
#endif | ||
|
||
int main(int argc, const char* argv[]) | ||
{ | ||
FuzzEngine fuzz_engine; | ||
bool enable_logging = false; | ||
std::string path = "real-afl.txt"; | ||
size_t input_index = 0; | ||
for (size_t i = 0; i < (size_t)argc; ++i) { | ||
if (strcmp(argv[i], "--log") == 0) { | ||
enable_logging = true; | ||
} | ||
else { | ||
input_index = i; | ||
} | ||
} | ||
return fuzz_engine.run_fuzzer(argv[input_index], "realm_afl", enable_logging, path); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/************************************************************************* | ||
* | ||
* Copyright 2022 Realm Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
**************************************************************************/ | ||
#include "fuzz_configurator.hpp" | ||
#include "fuzz_object.hpp" | ||
#include "../util/test_path.hpp" | ||
#include <iostream> | ||
|
||
FuzzConfigurator::FuzzConfigurator(FuzzObject& fuzzer, const std::string& input, bool use_input_file, | ||
const std::string& name) | ||
: m_used_input_file(use_input_file) | ||
, m_fuzzer(fuzzer) | ||
, m_fuzz_name(name) | ||
{ | ||
realm::disable_sync_to_disk(); | ||
init(input); | ||
setup_realm_config(); | ||
} | ||
|
||
void FuzzConfigurator::setup_realm_config() | ||
{ | ||
m_config.path = m_path; | ||
m_config.schema_version = 0; | ||
if (m_use_encryption) { | ||
const char* key = m_fuzzer.get_encryption_key(); | ||
const char* i = key; | ||
while (*i != '\0') { | ||
m_config.encryption_key.push_back(*i); | ||
i++; | ||
} | ||
} | ||
} | ||
|
||
const realm::Realm::Config& FuzzConfigurator::get_config() const | ||
{ | ||
return m_config; | ||
} | ||
|
||
FuzzObject& FuzzConfigurator::get_fuzzer() | ||
{ | ||
return m_fuzzer; | ||
} | ||
|
||
const std::string& FuzzConfigurator::get_realm_path() const | ||
{ | ||
return m_path; | ||
} | ||
|
||
FuzzLog& FuzzConfigurator::get_logger() | ||
{ | ||
return m_log; | ||
} | ||
|
||
State& FuzzConfigurator::get_state() | ||
{ | ||
return m_state; | ||
} | ||
|
||
void FuzzConfigurator::init(const std::string& input) | ||
{ | ||
std::string db_name = "fuzz-test"; | ||
realm::test_util::RealmPathInfo test_context{db_name}; | ||
SHARED_GROUP_TEST_PATH(path); | ||
m_path = path.c_str(); | ||
if (m_used_input_file) { | ||
std::ifstream in(input, std::ios::in | std::ios::binary); | ||
if (!in.is_open()) { | ||
std::cerr << "Could not open file for reading: " << input << "\n"; | ||
throw; | ||
} | ||
std::string contents((std::istreambuf_iterator<char>(in)), (std::istreambuf_iterator<char>())); | ||
set_state(contents); | ||
} | ||
else { | ||
set_state(input); | ||
} | ||
} | ||
|
||
void FuzzConfigurator::set_state(const std::string& input) | ||
{ | ||
m_state = State{input, 0}; | ||
m_use_encryption = m_fuzzer.get_next_token(m_state) % 2 == 0; | ||
} | ||
|
||
void FuzzConfigurator::print_cnf() | ||
{ | ||
m_log << "// Fuzzer: " << m_fuzz_name << "\n"; | ||
m_log << "// Test case generated in " REALM_VER_CHUNK " on " << m_fuzzer.get_current_time_stamp() << ".\n"; | ||
m_log << "// REALM_MAX_BPNODE_SIZE is " << REALM_MAX_BPNODE_SIZE << "\n"; | ||
m_log << "// ----------------------------------------------------------------------\n"; | ||
const auto& printable_key = | ||
!m_use_encryption ? "nullptr" : std::string("\"") + m_config.encryption_key.data() + "\""; | ||
m_log << "// const char* key = " << printable_key << ";\n"; | ||
m_log << "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/************************************************************************* | ||
* | ||
* Copyright 2022 Realm Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
**************************************************************************/ | ||
#ifndef FUZZ_CONFIG_HPP | ||
#define FUZZ_CONFIG_HPP | ||
|
||
#include "util.hpp" | ||
#include "fuzz_logger.hpp" | ||
#include <realm/object-store/shared_realm.hpp> | ||
#include <string> | ||
#include <vector> | ||
|
||
class FuzzObject; | ||
class FuzzConfigurator { | ||
public: | ||
FuzzConfigurator(FuzzObject& fuzzer, const std::string& input, bool use_input_file, const std::string& name); | ||
const realm::Realm::Config& get_config() const; | ||
FuzzObject& get_fuzzer(); | ||
const std::string& get_realm_path() const; | ||
FuzzLog& get_logger(); | ||
State& get_state(); | ||
void set_state(const std::string& input); | ||
void print_cnf(); | ||
|
||
private: | ||
void init(const std::string&); | ||
void setup_realm_config(); | ||
|
||
realm::Realm::Config m_config; | ||
std::string m_path; | ||
FuzzLog m_log; | ||
bool m_use_encryption{false}; | ||
bool m_used_input_file{false}; | ||
FuzzObject& m_fuzzer; | ||
State m_state; | ||
std::string m_fuzz_name; | ||
}; | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There does not appear to be anything running on evergreen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fealebenpae helped me to fix the compilation issues, going to add the logic to the evergreen configuration file in order to run it.