change log_level to min_log_level

This commit is contained in:
agroce 2019-06-17 10:17:33 -07:00
parent 02b602aa9a
commit ad544c99d7
5 changed files with 16 additions and 16 deletions

View File

@ -293,13 +293,13 @@ ERROR: Failed: Runlength_EncodeDecode
## Log Levels
By default, DeepState is not very verbose about testing activity,
other than failing tests. The `--log_level` argument lowers the
other than failing tests. The `--min_log_level` argument lowers the
threshold for output, with 0 = `DEBUG`, 1 = `TRACE` (output from the
tests, including from `printf`), 2 = INFO (DeepState messages, the default), 3 = `WARNING`,
4 = `ERROR`, 5 = `EXTERNAL` (output from other programs such as
libFuzzer), and 6 = `CRITICAL` messages. Lowering the `log_level` can be very
libFuzzer), and 6 = `CRITICAL` messages. Lowering the `min_log_level` can be very
useful for understanding what a DeepState harness is actually doing;
often, setting `--log_level 1` in either fuzzing or symbolic
often, setting `--min_log_level 1` in either fuzzing or symbolic
execution will give sufficient information to debug your test harness.

View File

@ -144,8 +144,8 @@ class DeepState(object):
help="Verbosity level for symbolic execution tool (default: 1, lower means less output).")
parser.add_argument(
"--log_level", default=2, type=int,
help="DeepState log level (default: 2), 0-6 (debug, trace, info, warning, error, external, critical).")
"--min_log_level", default=2, type=int,
help="Minimum DeepState log level to print (default: 2), 0-6 (debug, trace, info, warning, error, external, critical).")
parser.add_argument(
"binary", type=str, help="Path to the test binary to run.")
@ -273,7 +273,7 @@ class DeepState(object):
LOG_LEVEL_ERROR: logging.ERROR,
LOG_LEVEL_FATAL: logging.CRITICAL
}
LOGGER.setLevel(logging_levels[args.log_level])
LOGGER.setLevel(logging_levels[args.min_log_level])
if args.output_test_dir is not None:
test_dir = os.path.join(args.output_test_dir,

View File

@ -74,7 +74,7 @@ DECLARE_bool(fuzz);
DECLARE_bool(fuzz_save_passing);
DECLARE_bool(fork);
DECLARE_int(log_level);
DECLARE_int(min_log_level);
DECLARE_int(seed);
DECLARE_int(timeout);
@ -794,8 +794,8 @@ static int DeepState_RunSingleSavedTestDir(void) {
int num_failed_tests = 0;
struct DeepState_TestInfo *test = NULL;
if (!HAS_FLAG_log_level) {
FLAGS_log_level = 2;
if (!HAS_FLAG_min_log_level) {
FLAGS_min_log_level = 2;
}
DeepState_Setup();
@ -876,8 +876,8 @@ static int DeepState_RunSavedTestCases(void) {
int num_failed_tests = 0;
struct DeepState_TestInfo *test = NULL;
if (!HAS_FLAG_log_level) {
FLAGS_log_level = 2;
if (!HAS_FLAG_min_log_level) {
FLAGS_min_log_level = 2;
}
DeepState_Setup();

View File

@ -47,7 +47,7 @@ DEFINE_bool(fuzz, false, "Perform brute force unguided fuzzing.");
DEFINE_bool(fuzz_save_passing, false, "Save passing tests during fuzzing.");
DEFINE_bool(fork, true, "Fork when running a test.");
DEFINE_int(log_level, 0, "Minimum level of logging to output.");
DEFINE_int(min_log_level, 0, "Minimum level of logging to output (default 2, 0=debug, 1=trace, 2=info, ...).");
DEFINE_int(seed, 0, "Seed for brute force fuzzing (uses time if not set).");
DEFINE_int(timeout, 120, "Timeout for brute force fuzzing.");
@ -739,8 +739,8 @@ bool DeepState_CatchAbandoned(void) {
int DeepState_Fuzz(void){
DeepState_LogFormat(DeepState_LogInfo, "Starting fuzzing");
if (!HAS_FLAG_log_level) {
FLAGS_log_level = 2;
if (!HAS_FLAG_min_log_level) {
FLAGS_min_log_level = 2;
}
if (HAS_FLAG_seed) {
@ -853,7 +853,7 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
const char* loud = getenv("LIBFUZZER_LOUD");
if (loud != NULL) {
FLAGS_log_level = 0;
FLAGS_min_log_level = 0;
DeepState_LibFuzzerLoud = 1;
}

View File

@ -77,7 +77,7 @@ char DeepState_LogBuf[DeepState_LogBufSize + 1] = {};
DEEPSTATE_NOINLINE
void DeepState_Log(enum DeepState_LogLevel level, const char *str) {
if ((DeepState_UsingLibFuzzer && !DeepState_LibFuzzerLoud && (level < DeepState_LogExternal)) ||
(level < FLAGS_log_level)) {
(level < FLAGS_min_log_level)) {
return;
}
memset(DeepState_LogBuf, 0, DeepState_LogBufSize);