Skip to content
Snippets Groups Projects
Commit d7760736 authored by Daniel Brown's avatar Daniel Brown
Browse files

storing built kat files for future use by nobuild options

parent 6483b91e
Branches
No related tags found
No related merge requests found
...@@ -60,12 +60,6 @@ class FinesseTestProcess(Thread): ...@@ -60,12 +60,6 @@ class FinesseTestProcess(Thread):
self.TEST_DIR = TEST_DIR self.TEST_DIR = TEST_DIR
self.BASE_DIR = BASE_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 = "" self.emails = ""
if type(nobuild) is str: if type(nobuild) is str:
...@@ -135,6 +129,13 @@ class FinesseTestProcess(Thread): ...@@ -135,6 +129,13 @@ class FinesseTestProcess(Thread):
# Firstly we need to build the latest version of finesse # Firstly we need to build the latest version of finesse
if not self.nobuild: 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 print "deleting build dir..." + BUILD_PATH
if os.path.exists(BUILD_PATH): if os.path.exists(BUILD_PATH):
shutil.rmtree(BUILD_PATH) shutil.rmtree(BUILD_PATH)
...@@ -171,13 +172,22 @@ class FinesseTestProcess(Thread): ...@@ -171,13 +172,22 @@ class FinesseTestProcess(Thread):
if not os.path.exists(FINESSE_EXE): if not os.path.exists(FINESSE_EXE):
raise Exception("Kat file was not found in " + FINESSE_EXE) raise Exception("Kat file was not found in " + FINESSE_EXE)
out = None
# check version numbers match up # check version numbers match up
out = utils.runcmd([FINESSE_EXE]) out = utils.runcmd([FINESSE_EXE,"-v"])
shortid = out[0].split("\n")[2].split("(build ")[-1].rstrip(")").split("-")[-1].lstrip("g") # 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)]: 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 self.built = True
......
...@@ -20,7 +20,7 @@ def runcmd(args, cwd="."): ...@@ -20,7 +20,7 @@ def runcmd(args, cwd="."):
out, err = p.communicate() out, err = p.communicate()
if p.returncode != 0: if p.returncode != 0:
print "STDERR: " + err print "STDERR: " + errk
print "STDOUT: " + out print "STDOUT: " + out
raise RunException(p.returncode, args, err, out) raise RunException(p.returncode, args, err, out)
......
...@@ -115,6 +115,26 @@ class FinesseProcessWatcher(Thread): ...@@ -115,6 +115,26 @@ class FinesseProcessWatcher(Thread):
print "Watcher is continuing" print "Watcher is continuing"
try: 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', testdoc = db.get('testid',
self.process_to_watch.test_id, self.process_to_watch.test_id,
with_doc=True)["doc"] with_doc=True)["doc"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment