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

gzips output files

parent 6ab2a901
Branches
No related tags found
No related merge requests found
#!/bin/python #!/bin/python
import gzip
from threading import Thread, Lock from threading import Thread, Lock
from time import sleep from time import sleep
from optparse import OptionParser from optparse import OptionParser
...@@ -165,7 +166,7 @@ class FinesseTestProcess(Thread): ...@@ -165,7 +166,7 @@ class FinesseTestProcess(Thread):
self.cancelCheck() self.cancelCheck()
FINESSE_EXE = os.path.join(self.BASE_DIR,"build","kat" + EXE) FINESSE_EXE = os.path.join(self.BASE_DIR,"build","kat" + EXE)
print "NOBUILD",self.nobuild
# check if kat runs # check if kat runs
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)
...@@ -261,10 +262,17 @@ class FinesseTestProcess(Thread): ...@@ -261,10 +262,17 @@ class FinesseTestProcess(Thread):
out,err = utils.runcmd([FINESSE_EXE, "--noheader", kat], cwd=SUITE_PATH) out,err = utils.runcmd([FINESSE_EXE, "--noheader", kat], cwd=SUITE_PATH)
OUT_FILE = os.path.join(SUITE_PATH,basename + ".out") OUT_FILE = os.path.join(SUITE_PATH,basename + ".out")
LOG_FILE = os.path.join(SUITE_PATH,basename + ".log")
f_in = open(LOG_FILE, 'rb')
f_out = gzip.open(LOG_FILE + ".gz", 'wb')
f_out.writelines(f_in)
f_out.close()
f_in.close()
shutil.move(OUT_FILE, SUITE_OUTPUT_DIR) shutil.move(OUT_FILE, SUITE_OUTPUT_DIR)
shutil.move(LOG_FILE + ".gz", SUITE_OUTPUT_DIR)
LOG_FILE = os.path.join(SUITE_PATH,basename + ".log")
shutil.move(LOG_FILE, SUITE_OUTPUT_DIR)
except utils.RunException as e: except utils.RunException as e:
print "STDERR: " + e.out print "STDERR: " + e.out
...@@ -345,6 +353,18 @@ class FinesseTestProcess(Thread): ...@@ -345,6 +353,18 @@ class FinesseTestProcess(Thread):
self.output_differences[suite][out] = (False, self.output_differences[suite][out] = (False,
max) max)
# compress the data
f_in = open(out_file, 'rb')
f_out = gzip.open(out_file + ".gz", 'wb')
f_out.writelines(f_in)
f_out.close()
f_in.close()
os.remove(out_file)
self.done_kats += 1 self.done_kats += 1
REPORT_PATH = os.path.join(self.BASE_DIR,"reports") REPORT_PATH = os.path.join(self.BASE_DIR,"reports")
......
...@@ -135,7 +135,7 @@ class FinesseProcessWatcher(Thread): ...@@ -135,7 +135,7 @@ class FinesseProcessWatcher(Thread):
out = kat.replace(".kat",".out") out = kat.replace(".kat",".out")
if out in self.process_to_watch.output_differences[suite]: if out in self.process_to_watch.output_differences[suite]:
print "asdasd", self.process_to_watch.output_differences[suite][out]
if self.process_to_watch.output_differences[suite][out][0]: if self.process_to_watch.output_differences[suite][out][0]:
max_diff = self.process_to_watch.output_differences[suite][out][3] max_diff = self.process_to_watch.output_differences[suite][out][3]
else: else:
...@@ -396,6 +396,8 @@ def __finesse_start_test(git_commit, kats, nobuild=False): ...@@ -396,6 +396,8 @@ def __finesse_start_test(git_commit, kats, nobuild=False):
utils.git(["clone","git://gitmaster.atlas.aei.uni-hannover.de/finesse/base.git",TEST_BUILD_PATH]) utils.git(["clone","git://gitmaster.atlas.aei.uni-hannover.de/finesse/base.git",TEST_BUILD_PATH])
KAT_NEW_EXE = os.path.join(TEST_BUILD_PATH,"kat" + EXE) KAT_NEW_EXE = os.path.join(TEST_BUILD_PATH,"kat" + EXE)
shutil.copyfile(KAT_EXE, KAT_NEW_EXE) shutil.copyfile(KAT_EXE, KAT_NEW_EXE)
else:
nobuild = False
test = finesse_test.FinesseTestProcess(os.path.join(app.instance_path, "finesse_test"), test = finesse_test.FinesseTestProcess(os.path.join(app.instance_path, "finesse_test"),
TEST_RUN_PATH, TEST_RUN_PATH,
...@@ -632,7 +634,7 @@ def finesse_view_kat(suite, kat): ...@@ -632,7 +634,7 @@ def finesse_view_kat(suite, kat):
@app.route('/finesse/out/<test_id>/<suite>/<out>', methods=["GET"]) @app.route('/finesse/out/<test_id>/<suite>/<out>', methods=["GET"])
def finesse_view_out(test_id,suite, out): def finesse_view_out(test_id,suite, out):
out = str(out).replace(".kat",".out") out = str(out).replace(".kat",".out")
OUT_FILE = os.path.join(app.instance_path,"tests",str(test_id),"outputs",suite,out) OUT_FILE = os.path.join(app.instance_path,"tests",str(test_id),"outputs",suite,out+".gz")
if os.path.exists(OUT_FILE): if os.path.exists(OUT_FILE):
contents = open(OUT_FILE).read() contents = open(OUT_FILE).read()
...@@ -641,6 +643,7 @@ def finesse_view_out(test_id,suite, out): ...@@ -641,6 +643,7 @@ def finesse_view_out(test_id,suite, out):
response = make_response(contents) response = make_response(contents)
response.headers["Content-type"] = "text/plain" response.headers["Content-type"] = "text/plain"
response.headers["Content-encoding"] = "gzip"
return response return response
...@@ -662,7 +665,7 @@ def finesse_view_ref(suite, out): ...@@ -662,7 +665,7 @@ def finesse_view_ref(suite, out):
@app.route('/finesse/log/<test_id>/<suite>/<kat>', methods=["GET"]) @app.route('/finesse/log/<test_id>/<suite>/<kat>', methods=["GET"])
def finesse_view_log(test_id,suite, kat): def finesse_view_log(test_id,suite, kat):
log = str(kat).replace(".kat",".log") log = str(kat).replace(".kat",".log")
OUT_FILE = os.path.join(app.instance_path,"tests",str(test_id),"outputs",suite,log) OUT_FILE = os.path.join(app.instance_path,"tests",str(test_id),"outputs",suite,log + ".gz")
if os.path.exists(OUT_FILE): if os.path.exists(OUT_FILE):
contents = open(OUT_FILE).read() contents = open(OUT_FILE).read()
...@@ -671,6 +674,7 @@ def finesse_view_log(test_id,suite, kat): ...@@ -671,6 +674,7 @@ def finesse_view_log(test_id,suite, kat):
response = make_response(contents) response = make_response(contents)
response.headers["Content-type"] = "text/plain" response.headers["Content-type"] = "text/plain"
response.headers["Content-encoding"] = "gzip"
return response return response
...@@ -730,8 +734,6 @@ def finesse_view_exception(view_test_id,suite,kat): ...@@ -730,8 +734,6 @@ def finesse_view_exception(view_test_id,suite,kat):
if "kats_run" in doc: if "kats_run" in doc:
for run in doc["kats_run"]: for run in doc["kats_run"]:
if run["kat"] == kat: if run["kat"] == kat:
print run["runexception"]
print "\n\n".join(str(run["runexception"]))
response = make_response("\n\n".join(str(run["runexception"]))) response = make_response("\n\n".join(str(run["runexception"])))
else: else:
print "NOTHING" print "NOTHING"
...@@ -761,7 +763,6 @@ def finesse_view(view_test_id): ...@@ -761,7 +763,6 @@ def finesse_view(view_test_id):
for run in doc["kats_run"]: for run in doc["kats_run"]:
suite = run["suite"] suite = run["suite"]
print "RUN ERROR",run["error"]
if run["error"]: if run["error"]:
if not suite in kats_err: if not suite in kats_err:
kats_err[suite] = [] kats_err[suite] = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment