diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-02-09 12:35:45 +1100 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2021-02-09 12:35:45 +1100 |
commit | 8db30a63db1a9d84bdcad0c83369623f708e0397 (patch) | |
tree | 23bc1ebfa4d5f7388b47d10c619c147273f48963 /src/third_party/wiredtiger/test/fuzz/fuzz_run.sh | |
parent | 0c7f643a2dfe4000ac9630ed5dace0cb40ec9740 (diff) | |
download | mongo-r4.4.4.tar.gz |
Import wiredtiger: 33f1a6eedf856ada5dc598831863378769ce2670 from branch mongodb-4.4r4.4.4-rc1r4.4.4
ref: 332dddfe0e..33f1a6eedf
for: 4.4.4
WT-4649 Updating build system to allow for different C++ compilers
WT-5545 Add fixed-length column store support to RTS for handling updates present in the update list
WT-6354 Increase wt utility coverage with printlog, downgrade, upgrade tests
WT-6800 Insert one key per transaction to make test_txn24 pass on macOS
WT-6840 Add support for fuzzing with LLVM LibFuzzer
WT-6840 Add support for fuzzing with LLVM LibFuzzer
WT-6904 Write "transactions" subpage for Architecture Guide
WT-6947 Auto generate test coverage documentation from test tags
WT-7004 Architecture guide page for checkpoints
WT-7039 Creating test configuration framework using the WiredTiger configuration API
WT-7102 Migrate full and incremental backup test functionalities into wtbackup class
WT-7104 Redact user data from printlog output
WT-7116 Improve the compatibility test to test the configuration options for backward compatibility
WT-7137 Update assert to consider deleted HS values when checking for duplicate inserts
WT-7138 Do not perform fast truncate on pages with prepared updates
WT-7159 Always write on-disk update as a full update to history store
Diffstat (limited to 'src/third_party/wiredtiger/test/fuzz/fuzz_run.sh')
-rw-r--r-- | src/third_party/wiredtiger/test/fuzz/fuzz_run.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/test/fuzz/fuzz_run.sh b/src/third_party/wiredtiger/test/fuzz/fuzz_run.sh new file mode 100644 index 00000000000..b0958ba1679 --- /dev/null +++ b/src/third_party/wiredtiger/test/fuzz/fuzz_run.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# fuzz_run.sh - run a fuzz test. +# +# This script will emit all data in the current working directory including: fuzzing logs, home +# directories and profiling data (if we've compiled with Clang coverage). +# +# Running fuzzers compiled with ASan (-fsanitize=address) is recommended. If you want to also run +# calculate coverage, you should also add "-fprofile-instr-generate" and "-fcoverage-mapping" to +# your CFLAGS and LINKFLAGS when configuring. +# +# Usage +# fuzz_run.sh <fuzz-test-binary> [fuzz-test-args] +# +# If the fuzzer you're running has an existing corpus directory, you may want to run with the corpus +# supplied: +# e.g. fuzz_run.sh ../../build_posix/test/fuzz/fuzz_config corpus/ +# +# Output +# crash-<input-hash> -- +# If an error occurs, a file will be produced containing the input that crashed the target. +# fuzz-N.log -- +# The LibFuzzer log for worker N. This is just an ID that LibFuzzer assigns to each worker +# ranging from 0 => the number of workers - 1. +# WT_TEST_<pid> -- +# The home directory for a given worker process. +# WT_TEST_<pid>.profraw -- +# If a fuzzer is running with Clang coverage, files containing profiling data for a given +# worker will be produced. These will be used by fuzz_coverage. + +if test "$#" -lt "1"; then + echo "$0: must specify fuzz test to run" + exit 1 +fi + +# Take the binary name and shift. +# We don't want to forward this as an argument. +fuzz_test_bin="$1" +shift + +# Remove anything from previous runs. +rm -rf WT_TEST_* &> /dev/null +rm *.profraw fuzz-*.log &> /dev/null + +# If we've compiled to emit coverage information, each worker process should write their own +# performance data. +export LLVM_PROFILE_FILE="WT_TEST_%p.profraw" + +# The rationale for each flag is below: +# - jobs=8 +# Choosing 8 workers is a reasonable starting point. Depending on their machine, they can bump +# this number up but most machines will be able to handle this and it finishes jobs much faster +# than without this flag (equivalent to jobs=1). +# - runs=100000000 +# Do 100 million runs to make sure that we're stressing the system and hitting lots of +# branches. Ideally, we'd just let the fuzzer run until the process is killed by the user but +# unfortunately, coverage data won't get written out in that case. +# - close_fd_mask=3 +# Suppress stdout and stderr. This isn't ideal but any fuzzing target that prints an error +# will quickly fill up your disk. Better to just replay the input without this flag if you +# uncover a bug. +$fuzz_test_bin -jobs=8 -runs=100000000 -close_fd_mask=3 "$@" |