mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
added diff comparison
This commit is contained in:
parent
253b6dac02
commit
aea6e477ce
@ -148,6 +148,7 @@ class TestAutopsy:
|
|||||||
# Logs:
|
# Logs:
|
||||||
self.antlog_dir = ""
|
self.antlog_dir = ""
|
||||||
self.common_log = ""
|
self.common_log = ""
|
||||||
|
self.sorted_log = ""
|
||||||
self.common_log_path = ""
|
self.common_log_path = ""
|
||||||
self.warning_log = ""
|
self.warning_log = ""
|
||||||
self.csv = ""
|
self.csv = ""
|
||||||
@ -436,7 +437,7 @@ def run_test(image_file, count):
|
|||||||
case.image_file = image_file
|
case.image_file = image_file
|
||||||
case.image_name = case.get_image_name(image_file) + "(" + str(count) + ")"
|
case.image_name = case.get_image_name(image_file) + "(" + str(count) + ")"
|
||||||
case.image = case.get_image_name(image_file)
|
case.image = case.get_image_name(image_file)
|
||||||
case.common_log_path = make_local_path(case.output_dir, case.image_name, case.common_log)
|
case.common_log_path = make_local_path(case.output_dir, case.image_name, case.image_name+case.common_log)
|
||||||
case.warning_log = make_local_path(case.output_dir, case.image_name, "AutopsyWarnings.txt")
|
case.warning_log = make_local_path(case.output_dir, case.image_name, "AutopsyWarnings.txt")
|
||||||
case.antlog_dir = make_local_path(case.output_dir, case.image_name, "antlog.txt")
|
case.antlog_dir = make_local_path(case.output_dir, case.image_name, "antlog.txt")
|
||||||
case.known_bad_path = make_path(case.input_dir, "notablehashes.txt-md5.idx")
|
case.known_bad_path = make_path(case.input_dir, "notablehashes.txt-md5.idx")
|
||||||
@ -792,13 +793,32 @@ def generate_common_log():
|
|||||||
log.close()
|
log.close()
|
||||||
common_log.write("\n\n")
|
common_log.write("\n\n")
|
||||||
common_log.close()
|
common_log.close()
|
||||||
sort_dir = make_local_path(case.output_dir, case.image_name, "SortedErrors.txt")
|
case.sorted_log = make_local_path(case.output_dir, case.image_name, case.image_name + "SortedErrors.txt")
|
||||||
srtcmdlst = ["sort", case.common_log_path, "-o", sort_dir]
|
srtcmdlst = ["sort", case.common_log_path, "-o", case.sorted_log]
|
||||||
subprocess.call(srtcmdlst)
|
subprocess.call(srtcmdlst)
|
||||||
|
compare_errors()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
printerror("Error: Unable to generate the common log.")
|
printerror("Error: Unable to generate the common log.")
|
||||||
printerror(str(e) + "\n")
|
printerror(str(e) + "\n")
|
||||||
logging.critical(traceback.format_exc())
|
logging.critical(traceback.format_exc())
|
||||||
|
|
||||||
|
def compare_errors():
|
||||||
|
gold_dir = make_local_path(case.gold, case.image_name, case.image_name + "SortedErrors.txt")
|
||||||
|
common_log = codecs.open(case.sorted_log, "r", "latin-1")
|
||||||
|
gold_log = codecs.open(gold_dir, "r", "latin-1")
|
||||||
|
gold_dat = gold_log.read()
|
||||||
|
common_dat = common_log.read()
|
||||||
|
if (gold_dat != common_dat):
|
||||||
|
diff_dir = make_local_path(case.output_dir, case.image_name, "ErrorDiff.txt")
|
||||||
|
diff_file = open(diff_dir, "w")
|
||||||
|
dffcmdlst = ["diff", case.sorted_log, gold_dir]
|
||||||
|
subprocces.call(dffcmdlst, stdout = diff_file)
|
||||||
|
global attachl
|
||||||
|
global errorem
|
||||||
|
global failedbool
|
||||||
|
attachl.append(diff_dir)
|
||||||
|
errorem += "There was a difference in the exceptions Log.\n"
|
||||||
|
failedbool = True
|
||||||
|
|
||||||
# Fill in the global case's variables that require the log files
|
# Fill in the global case's variables that require the log files
|
||||||
def fill_case_data():
|
def fill_case_data():
|
||||||
@ -1635,11 +1655,10 @@ def execute_test():
|
|||||||
for lm in logres:
|
for lm in logres:
|
||||||
errorem += lm
|
errorem += lm
|
||||||
if failedbool:
|
if failedbool:
|
||||||
attachl.append(case.common_log)
|
attachl.append(case.common_log_path)
|
||||||
attachl.insert(0, html.name)
|
attachl.insert(0, html.name)
|
||||||
send_email()
|
send_email()
|
||||||
html.close()
|
html.close()
|
||||||
#email_send(HTML_email, None)
|
|
||||||
|
|
||||||
|
|
||||||
def send_email():
|
def send_email():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user