Commit d7760736 authored by Daniel Brown's avatar Daniel Brown
Browse files

storing built kat files for future use by nobuild options

parent 6483b91e
......@@ -60,12 +60,6 @@ class FinesseTestProcess(Thread):
self.TEST_DIR = TEST_DIR
self.BASE_DIR = BASE_DIR
if os.path.exists(self.BASE_DIR):
print "Deleting previous base_dir " + BASE_DIR
shutil.rmtree(self.BASE_DIR)
os.mkdir(self.BASE_DIR)
self.emails = ""
if type(nobuild) is str:
......@@ -135,6 +129,13 @@ class FinesseTestProcess(Thread):
# Firstly we need to build the latest version of finesse
if not self.nobuild:
if os.path.exists(self.BASE_DIR):
print "Deleting previous base_dir " + self.BASE_DIR
shutil.rmtree(self.BASE_DIR)
os.mkdir(self.BASE_DIR)
print "deleting build dir..." + BUILD_PATH
if os.path.exists(BUILD_PATH):
shutil.rmtree(BUILD_PATH)
......@@ -164,20 +165,29 @@ class FinesseTestProcess(Thread):
utils.runcmd(["./finesse.sh","--build"],cwd=BUILD_PATH)
self.cancelCheck()
FINESSE_EXE = os.path.join(self.BASE_DIR,"build","kat" + EXE)
# check if kat runs
if not os.path.exists(FINESSE_EXE):
raise Exception("Kat file was not found in " + FINESSE_EXE)
# check version numbers match up
out = utils.runcmd([FINESSE_EXE])
out = None
shortid = out[0].split("\n")[2].split("(build ")[-1].rstrip(")").split("-")[-1].lstrip("g")
# check version numbers match up
out = utils.runcmd([FINESSE_EXE,"-v"])
# I am sure there is a regex expression that could make this
# easier but I am being lazy
out = out[0]
out = out.split("\n")
out = out[0].split("(")[1].split(")")
out = out[0].split("-")[-1]
shortid = out.lstrip("g")
if shortid != self.git_commit[0:len(shortid)]:
raise Exception("Version of kat did not match the version that it was requested to build. Not sure why...")
raise Exception("Version of kat {0} did not match the version that it was requested to build {1}.".format(shortid, self.git_commit[0:len(shortid)]))
self.built = True
......
......@@ -20,7 +20,7 @@ def runcmd(args, cwd="."):
out, err = p.communicate()
if p.returncode != 0:
print "STDERR: " + err
print "STDERR: " + errk
print "STDOUT: " + out
raise RunException(p.returncode, args, err, out)
......
......@@ -115,6 +115,26 @@ class FinesseProcessWatcher(Thread):
print "Watcher is continuing"
try:
# store a copy of the kat file for future use if a nobuild is
# requested from the user.
if sys.platform == "win32":
EXE = ".exe"
else:
EXE = ""
KAT_EXE = os.path.join(app.instance_path,"tests",str(self.process_to_watch.test_id),"build","kat" + EXE)
KAT_STORE_PATH = os.path.join(app.instance_path,"kat_store")
KAT_STORE_EXE = os.path.join(KAT_STORE_PATH,"kat_" + str(self.process_to_watch.get_version()) + EXE)
if not os.path.exists(KAT_STORE_PATH):
os.mkdir(KAT_STORE_PATH)
if os.path.exists(KAT_EXE):
if os.path.exists(KAT_STORE_EXE):
os.remove(KAT_STORE_EXE)
shutil.copyfile(KAT_EXE, KAT_STORE_EXE)
testdoc = db.get('testid',
self.process_to_watch.test_id,
with_doc=True)["doc"]
......@@ -177,7 +197,7 @@ class FinesseProcessWatcher(Thread):
doc["timing"].append(self.process_to_watch.run_times[suite][kat])
db.insert(doc)
#finally update with details on the kat files ran
testdoc["kats_run"] = kats_run
db.update(testdoc)
......
Supports Markdown
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