Commit 39cdf84b by Enrico Pozzobon

small changes made on tester pc

parent c87607fe
......@@ -139,6 +139,8 @@ def main(argv):
for variant in os.listdir(variants_dir):
implementations_dir = os.path.join(
variants_dir, variant)
if not os.path.isdir(implementations_dir):
continue
for implementation in os.listdir(implementations_dir):
implementation_dir = os.path.join(
implementations_dir, implementation)
......
......@@ -142,7 +142,8 @@ function onStatusGet(status) {
// Find out correct placement in table
let ids = Object.keys(schedule);
ids.sort();
ids.sort(i => i | 0);
const idx = ids.indexOf(s.id);
if (idx == -1) {
throw new Error(s.id + " NOT FOUND");
......@@ -172,11 +173,11 @@ function onStatusGet(status) {
}
const row = schedule[s.id].row;
row.cells[1].innerText = s.added.substr(0, 16)
+ '\n' + s.added.substr(17);
row.cells[2].innerText = s.path;
row.cells[3].innerText = s.template;
row.cells[4].innerText = s.state;
updateInnerText(row.cells[1], s.added.substr(0, 16)
+ '\n' + s.added.substr(17));
updateInnerText(row.cells[2], s.path);
updateInnerText(row.cells[3], s.template);
updateInnerText(row.cells[4], s.state);
if (s.state == 'FAILED') {
row.style.backgroundColor = '#fcc';
} else if (s.state == 'SUCCESSFUL') {
......@@ -191,6 +192,13 @@ function onStatusGet(status) {
}
function updateInnerText(element, text) {
if (element.innerText !== text) {
element.innerText = text;
}
}
function showJobMenu(event, jobId) {
closeJobMenu();
......@@ -204,7 +212,7 @@ function showJobMenu(event, jobId) {
const button = document.createElement('a');
button.innerHTML = label;
button.onclick = (e) => {closeJobMenu(); onClick(e);};
button.href = '#';
button.href = 'javascript:;';
button.className = 'menuEntry';
return button;
}
......@@ -269,6 +277,15 @@ function restartJob(jobId) {
}
function deleteJob(jobId) {
if (confirm("Confirm deleting job " + jobId + "?")) {
const xhttp = new XMLHttpRequest();
xhttp.open("GET", "/delete_test/" + jobId, true);
xhttp.send();
}
}
function cancelJob(jobId) {
const xhttp = new XMLHttpRequest();
xhttp.open("GET", "/cancel_test/" + jobId, true);
......@@ -397,4 +414,4 @@ requestStatus();
})();
</script>
</body>
</html>
\ No newline at end of file
</html>
......@@ -94,7 +94,7 @@ function run() {
done
#rm -rf "$TMPDIR"
rm -rf "$TMPDIR"
}
if [[ $1 == "run" ]]; then
......
......@@ -56,6 +56,13 @@ class ScheduledTest:
res[k] = getattr(self, k)
return res
def from_dict(dict):
a = ScheduledTest()
for k in ScheduledTest.__slots__:
if k not in ScheduledTest._unserialized_slots:
setattr(a, k, dict[k])
return a
class Runner(threading.Thread):
_next_id = 1
......@@ -136,12 +143,13 @@ class Runner(threading.Thread):
except subprocess.TimeoutExpired:
pass
if self.process.returncode == 0:
self.job.state = 'SUCCESSFUL'
else:
self.job.state = 'FAILED'
returncode = self.process.returncode
self.process = None
if returncode != 0:
raise Exception(
"Test has failed with return code", returncode)
pack_results(
self.job,
self.platform)
......@@ -156,7 +164,9 @@ class Runner(threading.Thread):
try:
self.do_job()
self.job.state = 'SUCCESSFUL'
except Exception as ex:
self.job.state = 'FAILED'
print(ex)
print("Job %s has finished" % self.job.id)
......@@ -173,6 +183,21 @@ class Status(Resource):
})
class DeleteJob(Resource):
def get(self, job_id):
job = [job for job in schedule if job.id == job_id]
job = job[0] if len(job) > 0 else None
if job is None:
return 'Job not found', 404
with job.lock:
if job.state != 'RUNNING':
schedule.remove(job)
return jsonify({'success': True})
else:
return 'Job is already running', 400
class RestartJob(Resource):
def get(self, job_id):
job = [job for job in schedule if job.id == job_id]
......@@ -211,6 +236,7 @@ class ScheduleJob(Resource):
api.add_resource(Status, '/status')
api.add_resource(ScheduleJob, '/schedule_test')
api.add_resource(RestartJob, '/restart_test/<string:job_id>')
api.add_resource(DeleteJob, '/delete_test/<string:job_id>')
@app.route('/')
......
......@@ -652,4 +652,4 @@ def run_nist_lws_aead_test(dut, vectors_file, build_dir,
with open(path, 'wt') as f:
print("TIME,VALUE", file=f)
for t, v in logic_trace:
print("%f,0x%x" % (t, v), file=f)
print("%.10f,0x%x" % (t, v), file=f)
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 sign in to comment