Commit 3e8013bc by 文周繁

feat:asan.py add remove duplication

parent 4d1763f6
......@@ -4,7 +4,9 @@ import os
import re
pattern_asan_head = re.compile(r'==\d+==ERROR: AddressSanitizer:')
pattern_asan = re.compile(r' {4}#\d+ 0x\w+ in ')
pattern_asan_0 = re.compile(r' {4}#0 0x\w+ in ')
invalid_cause_dict = dict()
def search_file(dirname):
paths = []
......@@ -26,8 +28,23 @@ def TIMEOUT_COMMAND(command, stdout, stderr):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
outs, errs = process.communicate()
stdout.write(outs)
is_search_0 = False
search_by_count = 0
error_cause = ''
if pattern_asan_head.search(errs) is not None:
stderr.write(errs)
for i in errs.splitlines():
if pattern_asan_0.match(i) is not None and not is_search_0:
is_search_0 = True
_, end = pattern_asan_0.search(i).span()
error_cause += i[end:]
elif pattern_asan.match(i) is not None and search_by_count <= 10:
search_by_count += 1
_, end = pattern_asan.search(i).span()
error_cause += i[end:]
if not invalid_cause_dict.has_key(error_cause):
stderr.write(errs)
# TODO write to mangodb
invalid_cause_dict[error_cause] = 1
def generation_command(target, parameter, paths, stdout_outputfile, stderr_outputfile):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment