changed test so that certain failures won't send

too many emails
This commit is contained in:
Sean-M 2013-02-27 14:46:38 -05:00
parent a22065fb25
commit d38ec481d2

View File

@ -394,14 +394,7 @@ def run_config_test(config_file):
images.append(value) images.append(value)
#Begin infiniloop #Begin infiniloop
if(newDay()): if(newDay()):
global daycount compile()
global nxtproc
setDay()
gitPull("sleuthkit")
vsBuild()
gitPull("autopsy")
antBuild("datamodel", False)
antBuild("autopsy", True)
print("starting process") print("starting process")
outputer = open("ScriptLog.txt", "a") outputer = open("ScriptLog.txt", "a")
pid = subprocess.Popen(nxtproc, pid = subprocess.Popen(nxtproc,
@ -422,6 +415,41 @@ def run_config_test(config_file):
printerror("Error: There was an error running with the configuration file.") printerror("Error: There was an error running with the configuration file.")
printerror(str(e) + "\n") printerror(str(e) + "\n")
logging.critical(traceback.format_exc()) logging.critical(traceback.format_exc())
def compile():
global redo
global redosccd
global daycount
global nxtproc
global failedbool
global errorem
global attachl
global passed
redosccd = False
setDay()
if(not passed):
gitPull("sleuthkit")
if(not passed):
vsBuild()
if(not passed):
gitPull("autopsy")
if(not passed):
antBuild("datamodel", False)
if(not passed):
antBuild("autopsy", True)
if(redo and not (redosccd)):
attachl = []
errorem = "The test standard didn't match the gold standard.\n"
failedbool = False
redosccd = True
compile()
if(redosccd and (not passed)):
errorem += "Rebuilt properly.\n"
send_email()
attachl = []
errorem = "The test standard didn't match the gold standard.\n"
passed = True
# Runs the test on the single given file. # Runs the test on the single given file.
# The path must be guarenteed to be a correct path. # The path must be guarenteed to be a correct path.
def run_test(image_file, count): def run_test(image_file, count):
@ -1320,6 +1348,8 @@ def gitPull(TskOrAutopsy):
#Builds TSK as a win32 applicatiion #Builds TSK as a win32 applicatiion
def vsBuild(): def vsBuild():
global redo
global redosccd
#Please ensure that the current working directory is $autopsy/testing/script #Please ensure that the current working directory is $autopsy/testing/script
vs = [] vs = []
vs.append("/cygdrive/c/windows/microsoft.NET/framework/v4.0.30319/MSBuild.exe") vs.append("/cygdrive/c/windows/microsoft.NET/framework/v4.0.30319/MSBuild.exe")
@ -1336,17 +1366,25 @@ def vsBuild():
chk = os.path.join("..", "..", "..","sleuthkit", "win32", "Release", "libtsk_jni.dll") chk = os.path.join("..", "..", "..","sleuthkit", "win32", "Release", "libtsk_jni.dll")
try: try:
open(chk) open(chk)
if(redo):
redosccd = True
except IOError as e: except IOError as e:
global errorem global errorem
global attachl global attachl
errorem += "LIBTSK C++ failed to build.\n" errorem += "LIBTSK C++ failed to build.\n"
attachl.append(VSpth) attachl.append(VSpth)
if(not redo):
send_email() send_email()
sys.exit() redo = True
if(redo and (not redosccd)):
compile()
#Builds Autopsy or the Datamodel #Builds Autopsy or the Datamodel
def antBuild(which, Build): def antBuild(which, Build):
global redo
global redosccd
directory = os.path.join("..", "..") directory = os.path.join("..", "..")
ant = [] ant = []
if which == "datamodel": if which == "datamodel":
@ -1369,17 +1407,22 @@ def antBuild(which, Build):
chk = os.path.join("..", "..", "..","sleuthkit", "bindings", "java", "dist", "TSK_DataModel.jar") chk = os.path.join("..", "..", "..","sleuthkit", "bindings", "java", "dist", "TSK_DataModel.jar")
try: try:
open(chk) open(chk)
if(redo):
redosccd = True
except IOError as e: except IOError as e:
errorem += "DataModel Java build failed.\n" errorem += "DataModel Java build failed.\n"
attachl.append(antpth) attachl.append(antpth)
if(not redo):
send_email() send_email()
sys.exit() redo = True
elif (succd != 0): if(redo and (not redosccd)):
compile()
elif (succd != 0 and (not redo)):
errorem += "Autopsy build failed.\n" errorem += "Autopsy build failed.\n"
attachl.append(antpth) attachl.append(antpth)
send_email() send_email()
sys.exit() elif (redo and (not redosccd)):
compile()
#Watches clock and waits for current ingest to be done #Watches clock and waits for current ingest to be done
@ -1684,7 +1727,6 @@ def send_email():
s = smtplib.SMTP(serverval) s = smtplib.SMTP(serverval)
s.sendmail(msg['From'], msg['To'], msg.as_string()) s.sendmail(msg['From'], msg['To'], msg.as_string())
s.quit() s.quit()
sys.exit()
def Build_email(msg): def Build_email(msg):
global attachl global attachl
@ -1713,15 +1755,19 @@ def main():
global errorem global errorem
global attachl global attachl
global daycount global daycount
global redo
global passed
setDay() setDay()
daycount = 0 daycount = 0
failedbool = False failedbool = False
redo = False
errorem = "The test standard didn't match the gold standard.\n" errorem = "The test standard didn't match the gold standard.\n"
case = TestAutopsy() case = TestAutopsy()
database = Database() database = Database()
printout("") printout("")
args = Args() args = Args()
attachl = [] attachl = []
passed = False
# The arguments were given wrong: # The arguments were given wrong:
if not args.parse(): if not args.parse():
case.reset() case.reset()
@ -1730,9 +1776,11 @@ def main():
else: else:
execute_test() execute_test()
while args.contin: while args.contin:
redo = False
attachl = [] attachl = []
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
passed = False
execute_test() execute_test()
case = TestAutopsy() case = TestAutopsy()