Commit 771e4a5b authored by Daniel Brown's avatar Daniel Brown

Removed old nightly testing code server

parent 2ac87f8b
This diff is collapsed.
import subprocess as sub
import os
try:
GIT_BIN = os.environ["GIT_BIN"]
except:
GIT_BIN = "/usr/bin/git"
print ("GIT_BIN = " + GIT_BIN)
class RunException(Exception):
def __init__(self, returncode, args, err, out):
self.returncode = returncode
self.args = args
self.err = err
self.out = out
def runcmd(args, cwd="."):
p = sub.Popen(args, stdout=sub.PIPE, stderr=sub.PIPE, cwd=cwd)
out, err = p.communicate()
if p.returncode != 0:
print ("STDERR: " + err)
print ("STDOUT: " + out)
raise RunException(p.returncode, args, err, out)
return [out,err]
def git(args, git_bin=GIT_BIN, cwd="."):
cmd = ""
if type(args) is not list:
if type(args) is not str:
print (type(args))
raise Exception("arg for utils.git must be a list or string")
if type(args) is str:
args = args.split(" ")
args.insert(0, git_bin)
p = sub.Popen(args, stdout=sub.PIPE, stderr=sub.PIPE, cwd=cwd)
out, err = p.communicate()
if p.poll() != 0:
raise RunException(p.poll(), args, err, out)
return [out, err]
from flask import Flask
import os
global app
app = Flask(__name__, instance_path=os.getcwd())
\ No newline at end of file
from CodernityDB.tree_index import TreeBasedIndex
from CodernityDB.hash_index import HashIndex
from hashlib import md5
class TestIDIndex(TreeBasedIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = 'I'
super(TestIDIndex, self).__init__(*args, **kwargs)
def make_key_value(self, data):
if data['t'] == 'test':
key = int(data['test_id'])
return key, None
else:
return None
def make_key(self, key):
return key
class SrcCommitIndex(HashIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = '40s'
super(SrcCommitIndex, self).__init__(*args, **kwargs)
def make_key_value(self, data):
if data['t'] == 'test':
key = str(data['git_commit'])
return key, None
else:
return None
def make_key(self, key):
return key
class KatTestIndex(HashIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = '32s'
super(KatTestIndex, self).__init__(*args, **kwargs)
def make_key_value(self, data):
if data['t'] == 'kattest':
key = str(data['suite']) + "_" + str(data['kat'])
return md5(key).hexdigest(), None
else:
return None
def make_key(self, key):
return md5(key).hexdigest()
\ No newline at end of file
<html>
<head>
<!--<link rel="stylesheet" type="text/css" href="/css/style.css"/>-->
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
</head>
<body>
<div>
<h1>FINESSE Test - {{kat}} history</h1>
<table id="tblHistory">
<thead>
<td>Test ID</td>
<td>Commit ID</td>
<td>Commit Date</td>
<td>Max rel Diff</td>
<td>Run time [s]</td>
</thead>
{% for item in data%}
<tr>
<td><a href="/finesse/view/{{item[0]}}/">{{item[0]}}</a></td>
<td><a href="https://git.ligo.org/finesse/finesse/commit/{{item[1]}}/">{{item[1]}}</a></td>
<td>{{item[2]}}</td>
<td>{{item[3]}}</td>
<td>{{item[4]}}</td>
</tr>
{% endfor %}
</table>
</div>
</body>
<script type="text/JavaScript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/JavaScript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<script type="text/JavaScript">
$(document).ready(function(){
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"num-html-pre": function ( a ) {
var x = String(a).replace( /<[\s\S]*?>/g, "" );
return parseFloat( x );
},
"num-html-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"num-html-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
gtable = $('#tblHistory').dataTable({
"iDisplayLength":250,
"aoColumns": [
{ "sType": "num-html" },
null,
{ "sType": "date" },
{ "sType": "numeric" },
{ "sType": "numeric" }
]
} );
});
</script>
</html>
\ No newline at end of file
This diff is collapsed.
<html>
<head>
<!--<link rel="stylesheet" type="text/css" href="/css/style.css"/>-->
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
</head>
<body>
<div>
<h1>FINESSE Test {{ view_test_id }} View</h1>
<a href="/finesse/view/{{view_test_id}}/build.log">build.log</a> | <a href="/finesse/view/{{view_test_id}}/make.log">make.log</a>| <a href="/finesse/view/{{view_test_id}}/report.log">report.log</a>
<h3>Test Exceptions:</h3>
<pre>{{ excp_message }}</pre>
<pre>{{ excp_traceback }}</pre>
<h3>Files that were ERROR</h3>
<table id="tblResultsERR">
<thead>
<td>Suite</td>
<td>Kat</td>
<td>Max Rel. Difference</td>
<td>View .kat</td>
<td>View .out</td>
<td>View ref</td>
<td>View log</td>
<td>View Diff</td>
<td>View History
</thead>
{% for suite in kats_err.keys() %}
{% for item in kats_err[suite] %}
<tr>
<td>{{ suite }}</td>
<td>{{item[0]}}</td>
<td>{{item[1]}}</td>
<td><a target="_blank" href="/finesse/kat/{{suite}}/{{item[0]}}">Kat</a></td>
<td><a target="_blank" href="/finesse/out/{{view_test_id}}/{{suite}}/{{item[0]}}">Out</a></td>
<td><a target="_blank" href="/finesse/ref/{{suite}}/{{item[0]}}">Ref</a></td>
<td><a target="_blank" href="/finesse/log/{{view_test_id}}/{{suite}}/{{item[0]}}">Log</a></td>
<td><a target="_blank" href="/finesse/view/{{view_test_id}}/diff/{{suite}}/{{item[0]}}">Diff</a></td>
<td><a target="_blank" href="/finesse/kat_history/{{suite}}/{{item[0]}}">History</a></td>
</tr>
{% endfor %}
{% endfor %}
</table>
<br/>
<br/>
<h3>Files that were OK</h3>
<table id="tblResultsOK">
<thead>
<td>Suite</td>
<td>Kat</td>
<td>Max Rel. Difference</td>
<td>View .kat</td>
<td>View .out</td>
<td>View ref</td>
<td>View log</td>
<td>View Diff</td>
<td>View History
</thead>
{% for suite in kats_ok.keys() %}
{% for item in kats_ok[suite] %}
<tr>
<td>{{ suite }}</td>
<td>{{item[0]}}</td>
<td>{{item[1]}}</td>
<td><a target="_blank" href="/finesse/kat/{{suite}}/{{item[0]}}">Kat</a></td>
<td><a target="_blank" href="/finesse/out/{{view_test_id}}/{{suite}}/{{item[0]}}">Out</a></td>
<td><a target="_blank" href="/finesse/ref/{{suite}}/{{item[0]}}">Ref</a></td>
<td><a target="_blank" href="/finesse/log/{{view_test_id}}/{{suite}}/{{item[0]}}">Log</a></td>
<td><a target="_blank" href="/finesse/view/{{view_test_id}}/diff/{{suite}}/{{item[0]}}">Diff</a></td>
<td><a target="_blank" href="/finesse/kat_history/{{suite}}/{{item[0]}}">History</a></td>
</tr>
{% endfor %}
{% endfor %}
</table>
</div>
</body>
<script type="text/JavaScript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/JavaScript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<script type="text/JavaScript">
$(document).ready(function(){
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"num-html-pre": function ( a ) {
console.log("1");
var x = String(a).replace( /<[\s\S]*?>/g, "" );
return parseFloat( x );
},
"num-html-asc": function ( a, b ) {
console.log("2");
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"num-html-desc": function ( a, b ) {
console.log("3");
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
gtable = $('#tblResultsOK').dataTable({
"iDisplayLength":250,
"aLengthMenu": [[-1], ['All']],
"aoColumns": [
null,
null,
{ "sType": "numeric" },
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false}
]
} );
gtable = $('#tblResultsERR').dataTable({
"iDisplayLength":250,
"aLengthMenu": [[-1], ['All']],
"aoColumns": [
null,
null,
{ "sType": "numeric" },
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false},
{"bSearchable": false, "bSortable": false}
]
} );
});
</script>
</html>
\ No newline at end of file
This diff is collapsed.
import os
import sys
from flask import Flask
from optparse import OptionParser
repo_url = "https://git.ligo.org/finesse"
def start(instance_path,port=5000, debug=True, ip="0.0.0.0", git_bin="/usr/bin/git"):
os.environ["GIT_BIN"] = git_bin
# we import this now so that we can set the GIT_BIN env var
from pykat.testing import utils
print("starting web server...")
if instance_path is None:
raise Exception("instance_path must be defined")
elif type(instance_path) is not str:
raise Exception("instance_path must be a string")
if not os.path.exists(instance_path):
os.mkdir(instance_path)
os.chdir(instance_path)
from pykat.testing.web import app
if(app.instance_path!=instance_path):
print (app.instance_path, instance_path)
raise Exception("Instance path of Flask app (%s) didn't match the requested value (%s)" %(app.instance_path, instance_path))
os.chdir(instance_path)
# need local copy of src
if not os.path.exists(os.path.join(app.instance_path,"finesse_src")):
print ("finesse src folder didn't exist, cloning now...")
utils.git(["clone","%s/finesse.git"%repo_url,"finesse_src"])
else:
# get the latest version for logs etc.
utils.git("pull", cwd=os.path.join(app.instance_path,"finesse_src"))
os.chdir(instance_path)
# need local copy of test
if not os.path.exists(os.path.join(app.instance_path,"finesse_test")):
print ("finesse test folder didn't exist, cloning now...")
utils.git(["clone","%s/test.git"%repo_url,"finesse_test"])
utils.git(["config","core.sharedRepository","true"], cwd="./finesse_test/")
# load up the actual interface code
import pykat.testing.web.web_interface
app.secret_key = os.urandom(24)
app.run(debug=debug, port=int(port), host=ip,use_reloader=False)
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-P","--path",type="string",dest="instance_path",help="")
parser.add_option("-p","--port",type="int",default=5000,dest="port",help="")
parser.add_option("-g","--git-bin",type="string",default="/usr/bin/git",dest="git_bin",help="")
options, args = parser.parse_args()
if options.instance_path is None:
print ("Must specify a path for the web server")
exit()
start(options.instance_path, port=options.port, git_bin=options.git_bin )
Markdown is supported
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