Commit 39cdf84b by Enrico Pozzobon

small changes made on tester pc

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