mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 20:24:07 +00:00
fix style
This commit is contained in:
parent
3aedcee75b
commit
abd3747806
@ -3,30 +3,33 @@
|
||||
import configparser
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
DEBUGGER = os.getenv("DEBUGGER", "")
|
||||
FUZZER_ARGS = os.getenv("FUZZER_ARGS", "")
|
||||
|
||||
|
||||
def report(source: str, reason: str, call_stack: list, test_unit: str):
|
||||
print(f"########### REPORT: {source} {reason} {test_unit}")
|
||||
for line in call_stack:
|
||||
print(f" {line}")
|
||||
print("########### END OF REPORT ###########")
|
||||
|
||||
|
||||
def process_fuzzer_output(output: str):
|
||||
pass
|
||||
|
||||
|
||||
def process_error(error: str):
|
||||
ERROR = r'^==\d+== ERROR: (\S+): (.*)'
|
||||
error_source = ''
|
||||
error_reason = ''
|
||||
SUMMARY = r'^SUMMARY: '
|
||||
ERROR = r"^==\d+== ERROR: (\S+): (.*)"
|
||||
error_source = ""
|
||||
error_reason = ""
|
||||
SUMMARY = r"^SUMMARY: "
|
||||
TEST_UNIT_LINE = r"artifact_prefix='.*/'; Test unit written to (.*)"
|
||||
test_unit = ''
|
||||
CALL_STACK_LINE = r'^\s+(#\d+.*)'
|
||||
test_unit = ""
|
||||
CALL_STACK_LINE = r"^\s+(#\d+.*)"
|
||||
call_stack = []
|
||||
is_call_stack = False
|
||||
|
||||
@ -56,6 +59,7 @@ def process_error(error: str):
|
||||
|
||||
report(error_source, error_reason, call_stack, test_unit)
|
||||
|
||||
|
||||
def run_fuzzer(fuzzer: str):
|
||||
logging.info("Running fuzzer %s...", fuzzer)
|
||||
|
||||
@ -68,7 +72,6 @@ def run_fuzzer(fuzzer: str):
|
||||
if not os.path.exists(active_corpus_dir):
|
||||
os.makedirs(active_corpus_dir)
|
||||
|
||||
|
||||
options_file = f"{fuzzer}.options"
|
||||
custom_libfuzzer_options = ""
|
||||
fuzzer_arguments = ""
|
||||
@ -104,7 +107,9 @@ def run_fuzzer(fuzzer: str):
|
||||
for key, value in parser["fuzzer_arguments"].items()
|
||||
)
|
||||
|
||||
cmd_line = f"{DEBUGGER} ./{fuzzer} {FUZZER_ARGS} {active_corpus_dir} {seed_corpus_dir}"
|
||||
cmd_line = (
|
||||
f"{DEBUGGER} ./{fuzzer} {FUZZER_ARGS} {active_corpus_dir} {seed_corpus_dir}"
|
||||
)
|
||||
if custom_libfuzzer_options:
|
||||
cmd_line += f" {custom_libfuzzer_options}"
|
||||
if fuzzer_arguments:
|
||||
@ -116,7 +121,7 @@ def run_fuzzer(fuzzer: str):
|
||||
cmd_line += " < /dev/null"
|
||||
|
||||
logging.info("...will execute: %s", cmd_line)
|
||||
#subprocess.check_call(cmd_line, shell=True)
|
||||
# subprocess.check_call(cmd_line, shell=True)
|
||||
|
||||
try:
|
||||
result = subprocess.run(
|
||||
@ -125,15 +130,16 @@ def run_fuzzer(fuzzer: str):
|
||||
stdout=subprocess.DEVNULL,
|
||||
text=True,
|
||||
check=True,
|
||||
shell=True
|
||||
shell=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
# print("Command failed with error:", e)
|
||||
# print("Command failed with error:", e)
|
||||
print("Stderr output:", e.stderr)
|
||||
process_error(e.stderr)
|
||||
else:
|
||||
process_fuzzer_output(result.stderr)
|
||||
|
||||
|
||||
def main():
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user