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

adding history view for different kat files

parent 1d400990
...@@ -43,11 +43,11 @@ class KatTestIndex(HashIndex): ...@@ -43,11 +43,11 @@ class KatTestIndex(HashIndex):
def make_key_value(self, data): def make_key_value(self, data):
if data['t'] == 'kattest': if data['t'] == 'kattest':
key = str(data['suite']) + str(data['kat']) key = str(data['suite']) + "_" + str(data['kat'])
return md5(key).digest(), None return md5(key).hexdigest(), None
else: else:
return None return None
def make_key(self, key): def make_key(self, key):
return md5(key).digest() return md5(key).hexdigest()
\ No newline at end of file
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
<li>{{ suite }}</li> <li>{{ suite }}</li>
<ul> <ul>
{% for item in kats[suite] %} {% for item in kats[suite] %}
<li><span style="display:inline-block;width: 300px">{{item[0]}}</span><a href="/finesse/kat/{{suite}}/{{item[0]}}">View kat</a>&nbsp;<a href="/finesse/view/{{view_test_id}}/diff/{{suite}}/{{item[0]}}">View Diff</a> &nbsp; Max rel diff = {{item[1]}}</li> <li><span style="display:inline-block;width: 300px">
{{item[0]}}</span> <a href="/finesse/kat/{{suite}}/{{item[0]}}">Kat</a>
&nbsp; <a href="/finesse/view/{{view_test_id}}/diff/{{suite}}/{{item[0]}}">Diff</a>
&nbsp; <a href="/finesse/kat_history/{{suite}}/{{item[0]}}">History</a>
&nbsp; Max rel diff = {{item[1]}}</li>
{% if item[2][0] != "" %} {% if item[2][0] != "" %}
<ul> <ul>
<li>stdout: <pre>{{item[2][0]}}</pre></li> <li>stdout: <pre>{{item[2][0]}}</pre></li>
......
...@@ -131,8 +131,8 @@ class FinesseProcessWatcher(Thread): ...@@ -131,8 +131,8 @@ class FinesseProcessWatcher(Thread):
for suite in self.process_to_watch.run_times.keys(): for suite in self.process_to_watch.run_times.keys():
print suite print suite
for kat in self.process_to_watch.run_times[suite].keys(): for kat in self.process_to_watch.run_times[suite].keys():
key = md5(str(suite) + str(kat)).digest() key = str(suite) + "_" + str(kat)
out = kat[:-4] + ".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]:
max_diff = self.process_to_watch.output_differences[suite][out][2] max_diff = self.process_to_watch.output_differences[suite][out][2]
...@@ -149,23 +149,31 @@ class FinesseProcessWatcher(Thread): ...@@ -149,23 +149,31 @@ class FinesseProcessWatcher(Thread):
kat = kat, kat = kat,
max_diff = float(max_diff), max_diff = float(max_diff),
runexception = runexception)) runexception = runexception))
out = utils.git(["log",str(self.process_to_watch.get_version()),"-1",'--pretty="%ai"'],cwd=os.path.join(app.instance_path,"finesse_src"))
commit_date = out[0].replace("\\","").replace('"','').replace("\n","")
print commit_date
try: try:
doc = db.get('kattest', key, with_doc=True)["doc"] doc = db.get('kattest', key, with_doc=True)["doc"]
doc["max_diff"].append(max_diff) doc["max_diff"].append(float(max_diff))
doc["test_id"].append(self.process_to_watch.test_id) doc["test_id"].append(self.process_to_watch.test_id)
doc["commit"].append(self.process_to_watch.get_version()) doc["commit"].append(self.process_to_watch.get_version())
doc["commit_date"].append(str(commit_date))
doc["timing"].append(self.process_to_watch.run_times[suite][kat]) doc["timing"].append(self.process_to_watch.run_times[suite][kat])
db.update(doc) db.update(doc)
except RecordNotFound: except RecordNotFound:
doc = dict(t="kattest",max_diff=[],test_id=[],commit=[],timing=[],suite=suite,kat=kat) doc = dict(t="kattest",max_diff=[],test_id=[],commit=[],commit_date=[],timing=[],suite=suite,kat=kat)
doc["max_diff"].append(max_diff) doc["max_diff"].append(float(max_diff))
doc["test_id"].append(self.process_to_watch.test_id) doc["test_id"].append(self.process_to_watch.test_id)
doc["commit"].append(self.process_to_watch.get_version()) doc["commit"].append(self.process_to_watch.get_version())
doc["commit_date"].append(str(commit_date))
doc["timing"].append(self.process_to_watch.run_times[suite][kat]) doc["timing"].append(self.process_to_watch.run_times[suite][kat])
db.insert(doc) db.insert(doc)
#finally update with details on the kat files ran #finally update with details on the kat files ran
...@@ -548,6 +556,28 @@ def finesse_view_kat(suite, kat): ...@@ -548,6 +556,28 @@ def finesse_view_kat(suite, kat):
return response return response
@app.route('/finesse/kat_history/<suite>/<kat>', methods=["GET"])
def finesse_view_kat_history(suite, kat):
try:
doc = db.get("kattest", str(suite)+"_"+str(kat), with_doc=True)
doc = doc["doc"]
print doc
data = zip(doc["test_id"],doc["commit"],doc["commit_date"],doc["max_diff"],doc["timing"])
response = render_template("finesse_kat_history.html",
kat=kat,
data=data)
except RecordNotFound:
response = make_response("None Found")
response.headers["Content-type"] = "text/plain"
return response
@app.route('/finesse/view/<view_test_id>/diff/<suite>/<kat>/', methods=["GET"]) @app.route('/finesse/view/<view_test_id>/diff/<suite>/<kat>/', methods=["GET"])
def finesse_view_diff(view_test_id, suite, kat): def finesse_view_diff(view_test_id, suite, kat):
out = kat[:-4] + ".out" out = kat[:-4] + ".out"
......
...@@ -3,7 +3,7 @@ import sys ...@@ -3,7 +3,7 @@ import sys
from flask import Flask from flask import Flask
from optparse import OptionParser from optparse import OptionParser
def start(instance_path,port=5000, debug=False, ip="0.0.0.0", git_bin="/usr/bin/git"): def start(instance_path,port=5000, debug=True, ip="0.0.0.0", git_bin="/usr/bin/git"):
os.environ["GIT_BIN"] = git_bin os.environ["GIT_BIN"] = git_bin
# we import this now so that we can set the GIT_BIN env var # we import this now so that we can set the GIT_BIN env var
......
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