diff --git a/Testing/script/config.xml b/Testing/script/config.xml index e09b1e3805..2fc320fc16 100644 --- a/Testing/script/config.xml +++ b/Testing/script/config.xml @@ -19,8 +19,9 @@ appended to at that location. It must be given a specific file, not a directory. Images can be added on any drive including network drives. If the image path is incorrect, or if the image pointed to is an unsupported format, the regression script will inform the user in an error message, but carry on without problems. +All paths given to the script have to be full paths from the root directoy. NOTE: Some image formats can only be parsed by Autopsy using a Windows path -(i.e. X:\this\is\a\windows\path ./this/is/not/a/windows/path) +(i.e. X:\this\is\a\windows\path /this/is/not/a/windows/path) It is up to the user to distinguish between the paths when adding to this file. --> diff --git a/Testing/script/regression.py b/Testing/script/regression.py index 9968bb6eeb..7ea4c3acaf 100644 --- a/Testing/script/regression.py +++ b/Testing/script/regression.py @@ -10,7 +10,9 @@ import time import datetime import xml import re +import socket from xml.dom.minidom import parse, parseString +from sys import platform as _platform # # Please read me... @@ -322,21 +324,21 @@ def run_config_test(config_file): try: parsed = parse(config_file) if parsed.getElementsByTagName("indir"): - case.input_dir = parsed.getElementsByTagName("indir")[0].getAttribute("value").encode() + case.input_dir = parsed.getElementsByTagName("indir")[0].getAttribute("value").encode().decode("utf-8") if parsed.getElementsByTagName("global_csv"): - case.global_csv = parsed.getElementsByTagName("global_csv")[0].getAttribute("value").encode() + case.global_csv = parsed.getElementsByTagName("global_csv")[0].getAttribute("value").encode().decode("utf-8") # Generate the top navbar of the HTML for easy access to all images values = [] for element in parsed.getElementsByTagName("image"): - value = element.getAttribute("value").encode() + value = element.getAttribute("value").encode().decode("utf-8") if file_exists(value): values.append(value) html_add_images(values) # Run the test for each file in the configuration for element in parsed.getElementsByTagName("image"): - value = element.getAttribute("value").encode() + value = element.getAttribute("value").encode().decode("utf-8") if file_exists(value): run_test(value) else: @@ -438,7 +440,11 @@ def run_ant(): printout("Ingesting Image:\n" + case.image_file + "\n") printout("CMD: " + " ".join(case.ant)) printout("Starting test...\n") - subprocess.call(case.ant) + if SYS is OS.CYGWIN: + subprocess.call(case.ant) + elif SYS is OS.WIN: + theproc = subprocess.Popen(case.ant, shell = True) + theproc.communicate() # Returns the type of image file, based off extension class IMGTYPE: @@ -722,7 +728,7 @@ def fill_case_data(): e.print_error() except Exception as e: printerror("Error: Unknown fatal error when finding service times.") - printerror(srt(e) + "\n") + printerror(str(e) + "\n") # Generate the CSV log file def generate_csv(csv_path): @@ -738,6 +744,7 @@ def generate_csv(csv_path): image_path = case.image_file name = case.image_name path = case.output_dir + hostname = socket.gethostname() autopsy_version = case.autopsy_version heap_space = case.heap_space start_date = case.start_date @@ -759,7 +766,7 @@ def generate_csv(csv_path): ant = case.ant_to_string() # Make a list with all the strings in it - seq = (image_path, name, path, autopsy_version, heap_space, start_date, end_date, total_test_time, + seq = (image_path, name, path, hostname, autopsy_version, heap_space, start_date, end_date, total_test_time, total_ingest_time, service_times, exceptions_count, mem_exceptions_count, tsk_objects_count, artifacts_count, attributes_count, gold_db_name, artifact_comparison, attribute_comparison, gold_report_name, report_comparison, ant) @@ -777,7 +784,7 @@ def generate_csv(csv_path): # Generates the CSV header (column names) def csv_header(csv_path): csv = open(csv_path, "w") - seq = ("Image Path", "Image Name", "Output Case Directory", "Autopsy Version", + seq = ("Image Path", "Image Name", "Output Case Directory", "Host Name", "Autopsy Version", "Heap Space Setting", "Test Start Date", "Test End Date", "Total Test Time", "Total Ingest Time", "Service Times", "Exceptions Count", "OutOfMemoryExceptions", "TSK Objects Count", "Artifacts Count", @@ -895,12 +902,12 @@ def print_report(errors, name, okay): # Used instead of the print command when printing out an error def printerror(string): - print string + print(string) case.printerror.append(string) # Used instead of the print command when printing out anything besides errors def printout(string): - print string + print(string) case.printout.append(string) # Generates the HTML log file @@ -912,7 +919,8 @@ def generate_html(): try: html = open(case.html_log, "a") # The image title - title = "

" + case.image_name + "

\ + title = "

" + case.image_name + " \ + tested on " + socket.gethostname() + "

\

\ Errors and Warnings |\ Information |\ @@ -1003,6 +1011,7 @@ def write_html_head():