change log_level to min_log_level
This commit is contained in:
parent
02b602aa9a
commit
ad544c99d7
@ -293,13 +293,13 @@ ERROR: Failed: Runlength_EncodeDecode
|
|||||||
## Log Levels
|
## Log Levels
|
||||||
|
|
||||||
By default, DeepState is not very verbose about testing activity,
|
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
|
threshold for output, with 0 = `DEBUG`, 1 = `TRACE` (output from the
|
||||||
tests, including from `printf`), 2 = INFO (DeepState messages, the default), 3 = `WARNING`,
|
tests, including from `printf`), 2 = INFO (DeepState messages, the default), 3 = `WARNING`,
|
||||||
4 = `ERROR`, 5 = `EXTERNAL` (output from other programs such as
|
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;
|
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.
|
execution will give sufficient information to debug your test harness.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -144,8 +144,8 @@ class DeepState(object):
|
|||||||
help="Verbosity level for symbolic execution tool (default: 1, lower means less output).")
|
help="Verbosity level for symbolic execution tool (default: 1, lower means less output).")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--log_level", default=2, type=int,
|
"--min_log_level", default=2, type=int,
|
||||||
help="DeepState log level (default: 2), 0-6 (debug, trace, info, warning, error, external, critical).")
|
help="Minimum DeepState log level to print (default: 2), 0-6 (debug, trace, info, warning, error, external, critical).")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"binary", type=str, help="Path to the test binary to run.")
|
"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_ERROR: logging.ERROR,
|
||||||
LOG_LEVEL_FATAL: logging.CRITICAL
|
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:
|
if args.output_test_dir is not None:
|
||||||
test_dir = os.path.join(args.output_test_dir,
|
test_dir = os.path.join(args.output_test_dir,
|
||||||
|
|||||||
@ -74,7 +74,7 @@ DECLARE_bool(fuzz);
|
|||||||
DECLARE_bool(fuzz_save_passing);
|
DECLARE_bool(fuzz_save_passing);
|
||||||
DECLARE_bool(fork);
|
DECLARE_bool(fork);
|
||||||
|
|
||||||
DECLARE_int(log_level);
|
DECLARE_int(min_log_level);
|
||||||
DECLARE_int(seed);
|
DECLARE_int(seed);
|
||||||
DECLARE_int(timeout);
|
DECLARE_int(timeout);
|
||||||
|
|
||||||
@ -794,8 +794,8 @@ static int DeepState_RunSingleSavedTestDir(void) {
|
|||||||
int num_failed_tests = 0;
|
int num_failed_tests = 0;
|
||||||
struct DeepState_TestInfo *test = NULL;
|
struct DeepState_TestInfo *test = NULL;
|
||||||
|
|
||||||
if (!HAS_FLAG_log_level) {
|
if (!HAS_FLAG_min_log_level) {
|
||||||
FLAGS_log_level = 2;
|
FLAGS_min_log_level = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeepState_Setup();
|
DeepState_Setup();
|
||||||
@ -876,8 +876,8 @@ static int DeepState_RunSavedTestCases(void) {
|
|||||||
int num_failed_tests = 0;
|
int num_failed_tests = 0;
|
||||||
struct DeepState_TestInfo *test = NULL;
|
struct DeepState_TestInfo *test = NULL;
|
||||||
|
|
||||||
if (!HAS_FLAG_log_level) {
|
if (!HAS_FLAG_min_log_level) {
|
||||||
FLAGS_log_level = 2;
|
FLAGS_min_log_level = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeepState_Setup();
|
DeepState_Setup();
|
||||||
|
|||||||
@ -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(fuzz_save_passing, false, "Save passing tests during fuzzing.");
|
||||||
DEFINE_bool(fork, true, "Fork when running a test.");
|
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(seed, 0, "Seed for brute force fuzzing (uses time if not set).");
|
||||||
DEFINE_int(timeout, 120, "Timeout for brute force fuzzing.");
|
DEFINE_int(timeout, 120, "Timeout for brute force fuzzing.");
|
||||||
|
|
||||||
@ -739,8 +739,8 @@ bool DeepState_CatchAbandoned(void) {
|
|||||||
int DeepState_Fuzz(void){
|
int DeepState_Fuzz(void){
|
||||||
DeepState_LogFormat(DeepState_LogInfo, "Starting fuzzing");
|
DeepState_LogFormat(DeepState_LogInfo, "Starting fuzzing");
|
||||||
|
|
||||||
if (!HAS_FLAG_log_level) {
|
if (!HAS_FLAG_min_log_level) {
|
||||||
FLAGS_log_level = 2;
|
FLAGS_min_log_level = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_FLAG_seed) {
|
if (HAS_FLAG_seed) {
|
||||||
@ -853,7 +853,7 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|||||||
|
|
||||||
const char* loud = getenv("LIBFUZZER_LOUD");
|
const char* loud = getenv("LIBFUZZER_LOUD");
|
||||||
if (loud != NULL) {
|
if (loud != NULL) {
|
||||||
FLAGS_log_level = 0;
|
FLAGS_min_log_level = 0;
|
||||||
DeepState_LibFuzzerLoud = 1;
|
DeepState_LibFuzzerLoud = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ char DeepState_LogBuf[DeepState_LogBufSize + 1] = {};
|
|||||||
DEEPSTATE_NOINLINE
|
DEEPSTATE_NOINLINE
|
||||||
void DeepState_Log(enum DeepState_LogLevel level, const char *str) {
|
void DeepState_Log(enum DeepState_LogLevel level, const char *str) {
|
||||||
if ((DeepState_UsingLibFuzzer && !DeepState_LibFuzzerLoud && (level < DeepState_LogExternal)) ||
|
if ((DeepState_UsingLibFuzzer && !DeepState_LibFuzzerLoud && (level < DeepState_LogExternal)) ||
|
||||||
(level < FLAGS_log_level)) {
|
(level < FLAGS_min_log_level)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(DeepState_LogBuf, 0, DeepState_LogBufSize);
|
memset(DeepState_LogBuf, 0, DeepState_LogBufSize);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user