Merge pull request #196 from Smoss/master

More updates to the regression test.
This commit is contained in:
adam 2013-05-24 12:47:56 -07:00
commit d17c678e03
5 changed files with 28 additions and 19 deletions

View File

@ -93,12 +93,12 @@ public class RegressionTest extends TestCase{
enableModules(".*"); enableModules(".*");
conf = conf.addTest("testNewCaseWizardOpen", conf = conf.addTest("testNewCaseWizardOpen",
"testNewCaseWizard", "testNewCaseWizard",
"testStartAddImage", "testStartAddDataSource",
"testConfigureIngest1", "testConfigureIngest1",
"testConfigureHash", "testConfigureHash",
"testConfigureIngest2", "testConfigureIngest2",
"testConfigureSearch", "testConfigureSearch",
"testAddImageWizard1", "testAddSourceWizard1",
"testIngest", "testIngest",
"testGenerateReportToolbar", "testGenerateReportToolbar",
"testGenerateReportButton" "testGenerateReportButton"
@ -143,17 +143,17 @@ public class RegressionTest extends TestCase{
wo.btFinish().clickMouse(); wo.btFinish().clickMouse();
} }
public void testStartAddImage() { public void testStartAddDataSource() {
logger.info("Starting Add Image process"); logger.info("Starting Add Image process");
WizardOperator wo = new WizardOperator("Add Image"); WizardOperator wo = new WizardOperator("Add Data");
JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0); JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0);
String imageDir = System.getProperty("img_path"); String imageDir = System.getProperty("img_path");
((JTextField)jtfo0.getSource()).setText(imageDir); ((JTextField)jtfo0.getSource()).setText(imageDir);
wo.btNext().clickMouse(); wo.btNext().clickMouse();
} }
public void testAddImageWizard1() { public void testAddSourceWizard1() {
WizardOperator wo = new WizardOperator("Add Image"); WizardOperator wo = new WizardOperator("Add Data");
while(!wo.btFinish().isEnabled()) { while(!wo.btFinish().isEnabled()) {
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
} }
@ -163,7 +163,7 @@ public class RegressionTest extends TestCase{
public void testConfigureIngest1() { public void testConfigureIngest1() {
logger.info("Ingest 1"); logger.info("Ingest 1");
WizardOperator wo = new WizardOperator("Add Image"); WizardOperator wo = new WizardOperator("Add Data");
JTableOperator jto = new JTableOperator(wo, 0); JTableOperator jto = new JTableOperator(wo, 0);
int row = jto.findCellRow("Hash Lookup", 1, 0); int row = jto.findCellRow("Hash Lookup", 1, 0);
jto.clickOnCell(row, 1); jto.clickOnCell(row, 1);
@ -203,7 +203,7 @@ public class RegressionTest extends TestCase{
public void testConfigureIngest2() { public void testConfigureIngest2() {
logger.info("Ingest 2"); logger.info("Ingest 2");
WizardOperator wo = new WizardOperator("Add Image"); WizardOperator wo = new WizardOperator("Add Data");
JTableOperator jto = new JTableOperator(wo, 0); JTableOperator jto = new JTableOperator(wo, 0);
int row = jto.findCellRow("Keyword Search", 1, 0); int row = jto.findCellRow("Keyword Search", 1, 0);
jto.clickOnCell(row, 1); jto.clickOnCell(row, 1);
@ -239,7 +239,7 @@ public class RegressionTest extends TestCase{
} }
JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0); JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0);
jbo2.pushNoBlock(); jbo2.pushNoBlock();
WizardOperator wo = new WizardOperator("Add Image"); WizardOperator wo = new WizardOperator("Add Data");
JCheckBoxOperator jbco0 = new JCheckBoxOperator(wo, "Process Unallocated Space"); JCheckBoxOperator jbco0 = new JCheckBoxOperator(wo, "Process Unallocated Space");
if(Boolean.parseBoolean(System.getProperty("ignore_unalloc"))) { if(Boolean.parseBoolean(System.getProperty("ignore_unalloc"))) {
jbco0.doClick(); jbco0.doClick();

View File

@ -23,10 +23,12 @@ def send_email(parsed, errorem, attachl, passFail):
serverval = element.getAttribute("value").encode().decode("utf_8") serverval = element.getAttribute("value").encode().decode("utf_8")
# Create the container (outer) email message. # Create the container (outer) email message.
msg = MIMEMultipart() msg = MIMEMultipart()
element = parsed.getElementsByTagName("subject")[0]
subval = element.getAttribute("value").encode().decode("utf_8")
if(passFail): if(passFail):
msg['Subject'] = '[Test]Autopsy test passed.' msg['Subject'] = '[Test]Autopsy ' + subval + ' test passed.'
else: else:
msg['Subject'] = '[Test]Autopsy test failed.' msg['Subject'] = '[Test]Autopsy ' + subval + ' test failed.'
# me == the sender's email address # me == the sender's email address
# family = the list of all recipients' email addresses # family = the list of all recipients' email addresses
msg['From'] = 'AutopsyTest' msg['From'] = 'AutopsyTest'

View File

@ -194,6 +194,8 @@ class TestAutopsy:
self.sorted_data_file = "" self.sorted_data_file = ""
self.gold_dbdump = "" self.gold_dbdump = ""
self.autopsy_dbdump = "" self.autopsy_dbdump = ""
self.artifact_count = 0
self.artifact_fail = 0
# Infinite Testing info # Infinite Testing info
timer = 0 timer = 0
@ -396,9 +398,12 @@ class Database:
def retrieve_data(data_file, autopsy_con,autopsy_db_file): def retrieve_data(data_file, autopsy_con,autopsy_db_file):
autopsy_cur2 = autopsy_con.cursor() autopsy_cur2 = autopsy_con.cursor()
global errorem
autopsy_cur2.execute("SELECT tsk_files.parent_path, tsk_files.name, blackboard_artifact_types.display_name, blackboard_artifacts.artifact_id FROM blackboard_artifact_types INNER JOIN blackboard_artifacts ON blackboard_artifact_types.artifact_type_id = blackboard_artifacts.artifact_type_id INNER JOIN tsk_files ON tsk_files.obj_id = blackboard_artifacts.obj_id") autopsy_cur2.execute("SELECT tsk_files.parent_path, tsk_files.name, blackboard_artifact_types.display_name, blackboard_artifacts.artifact_id FROM blackboard_artifact_types INNER JOIN blackboard_artifacts ON blackboard_artifact_types.artifact_type_id = blackboard_artifacts.artifact_type_id INNER JOIN tsk_files ON tsk_files.obj_id = blackboard_artifacts.obj_id")
database_log = codecs.open(data_file, "wb", "utf_8") database_log = codecs.open(data_file, "wb", "utf_8")
rw = autopsy_cur2.fetchone() rw = autopsy_cur2.fetchone()
case.artifact_count = 0
case.artifact_fail = 0
appnd = False appnd = False
counter = 0 counter = 0
try: try:
@ -409,6 +414,7 @@ def retrieve_data(data_file, autopsy_con,autopsy_db_file):
database_log.write(rw[1] + ' <artifact type = "' + rw[2] + '" > ') database_log.write(rw[1] + ' <artifact type = "' + rw[2] + '" > ')
autopsy_cur1 = autopsy_con.cursor() autopsy_cur1 = autopsy_con.cursor()
looptry = True looptry = True
case.artifact_count += 1
try: try:
key = "" key = ""
key = str(rw[3]) key = str(rw[3])
@ -418,7 +424,9 @@ def retrieve_data(data_file, autopsy_con,autopsy_db_file):
except Exception as e: except Exception as e:
print(str(e)) print(str(e))
print(str(rw[3])) print(str(rw[3]))
errorem += "Artifact with id#" + str(rw[3]) + " encountered an error.\n"
looptry = False looptry = False
case.artifact_fail += 1
pass pass
if(looptry == True): if(looptry == True):
src = attributes[0][0] src = attributes[0][0]
@ -464,6 +472,7 @@ def retrieve_data(data_file, autopsy_con,autopsy_db_file):
rw = autopsy_cur2.fetchone() rw = autopsy_cur2.fetchone()
except Exception as e: except Exception as e:
print('outer exception: ' + str(e)) print('outer exception: ' + str(e))
errorem += "There were " + str(case.artifact_count) + " artifacts for " + case.image_name + " and " + str(case.artifact_fail) + " of them were unusable.\n"
def dbDump(): def dbDump():
autopsy_db_file = Emailer.make_path(case.output_dir, case.image_name, autopsy_db_file = Emailer.make_path(case.output_dir, case.image_name,
@ -648,7 +657,7 @@ def run_test(image_file, count):
if(not file_exists(img_archive)): if(not file_exists(img_archive)):
img_archive = Emailer.make_path(case.gold_parse, case.image_name+"-archive.zip") img_archive = Emailer.make_path(case.gold_parse, case.image_name+"-archive.zip")
gold_path = case.gold_parse gold_path = case.gold_parse
img_gold = Emailer.make_path(gold_path, case.image_name) img_gold = Emailer.make_path(gold_path, "tmp", case.image_name)
extrctr = zipfile.ZipFile(img_archive, 'r', compression=zipfile.ZIP_DEFLATED) extrctr = zipfile.ZipFile(img_archive, 'r', compression=zipfile.ZIP_DEFLATED)
extrctr.extractall(gold_path) extrctr.extractall(gold_path)
extrctr.close extrctr.close
@ -1828,21 +1837,19 @@ def execute_test():
logres = search_common_log("TskCoreException") logres = search_common_log("TskCoreException")
if (len(logres)>0): if (len(logres)>0):
failedbool = True failedbool = True
global imgfail
imgfail = True imgfail = True
global errorem
errorem += "Autopsy Nightly test failed.\n"
passFail = False passFail = False
for lm in logres: for lm in logres:
errorem += lm errorem += lm
html.close() html.close()
if failedbool: if failedbool:
passFail = False passFail = False
errorem += "The test output didn't match the gold standard.\n"
errorem += "Autopsy test failed.\n"
attachl.append(case.common_log_path) attachl.append(case.common_log_path)
attachl.insert(0, html.name) attachl.insert(0, html.name)
else: else:
errorem = "" errorem += "Autopsy test passed.\n"
errorem += "Autopsy Nightly test passed.\n"
passFail = True passFail = True
attachl = [] attachl = []
if not args.gold_creation: if not args.gold_creation:
@ -1872,7 +1879,7 @@ def main():
daycount = 0 daycount = 0
failedbool = False failedbool = False
redo = False redo = False
errorem = "The test standard didn't match the gold standard.\n" errorem = ""
case = TestAutopsy() case = TestAutopsy()
database = Database() database = Database()
printout("") printout("")

View File

@ -50,10 +50,10 @@ def compile(errore, attachli, parsedin):
errorem = "The test standard didn't match the gold standard.\n" errorem = "The test standard didn't match the gold standard.\n"
failedbool = False failedbool = False
if(tryredo): if(tryredo):
errorem = ""
errorem += "Rebuilt properly.\n" errorem += "Rebuilt properly.\n"
Emailer.send_email(parsed, errorem, attachl, True) Emailer.send_email(parsed, errorem, attachl, True)
attachl = [] attachl = []
errorem = "The test standard didn't match the gold standard.\n"
passed = True passed = True
#Pulls from git #Pulls from git