Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lwc
/
compare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
67bcb93e
authored
Mar 08, 2020
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some compilation and scheduling fixes
parent
3a0ee47f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
29 deletions
+64
-29
compile_all.py
+21
-17
index.html
+0
-0
process_zip.sh
+1
-1
test-dude.py
+42
-8
test_common.py
+0
-3
No files found.
compile_all.py
View file @
67bcb93e
...
@@ -117,27 +117,30 @@ def main(argv):
...
@@ -117,27 +117,30 @@ def main(argv):
subs
=
os
.
listdir
(
submissions_dir
)
subs
=
os
.
listdir
(
submissions_dir
)
# get all the submissions by looking for files named "api.h"
# get all the submissions by looking for files named "api.h"
subfile
s
=
[]
implementation
s
=
[]
for
submission
in
subs
:
for
submission
in
subs
:
implementation
s_dir
=
os
.
path
.
join
(
variant
s_dir
=
os
.
path
.
join
(
submissions_dir
,
submission
,
"Implementations"
,
"crypto_aead"
)
submissions_dir
,
submission
,
"Implementations"
,
"crypto_aead"
)
if
not
os
.
path
.
isdir
(
implementation
s_dir
):
if
not
os
.
path
.
isdir
(
variant
s_dir
):
continue
continue
if
"NOT ACCEPTED"
in
implementation
s_dir
:
if
"NOT ACCEPTED"
in
variant
s_dir
:
continue
continue
print
()
print
()
print
(
"###
%
s ###"
%
submission
)
print
(
"###
%
s ###"
%
submission
)
c
=
0
c
=
0
# r=root, d=directories, f = files
for
variant
in
os
.
listdir
(
variants_dir
):
for
r
,
d
,
f
in
os
.
walk
(
implementations_dir
):
implementations_dir
=
os
.
path
.
join
(
for
file
in
f
:
variants_dir
,
variant
)
if
file
==
"api.h"
:
for
implementation
in
os
.
listdir
(
implementations_dir
):
f
=
os
.
path
.
join
(
r
,
file
)
implementation_dir
=
os
.
path
.
join
(
subfiles
.
append
(
f
)
implementations_dir
,
implementation
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
implementation_dir
,
"api.h"
)):
implementations
.
append
(
(
submission
,
variant
,
implementation
))
c
+=
1
c
+=
1
if
c
==
0
:
if
c
==
0
:
...
@@ -147,10 +150,16 @@ def main(argv):
...
@@ -147,10 +150,16 @@ def main(argv):
print
(
"Include list has
%
d entries"
%
len
(
include_list
))
print
(
"Include list has
%
d entries"
%
len
(
include_list
))
files
=
[]
files
=
[]
for
f
in
subfiles
:
for
submission
,
variant
,
implementation
in
implementations
:
# base name n (a.k.a. cipher slug)
n
=
'.'
.
join
([
submission
,
variant
,
implementation
])
print
(
n
)
# Source directory d
# Source directory d
d
=
os
.
path
.
split
(
f
)[
0
]
d
=
os
.
path
.
join
(
submissions_dir
,
submission
,
"Implementations"
,
"crypto_aead"
,
variant
,
implementation
)
assert
os
.
path
.
isdir
(
d
)
assert
os
.
path
.
isdir
(
d
)
print
(
d
)
print
(
d
)
...
@@ -158,11 +167,6 @@ def main(argv):
...
@@ -158,11 +167,6 @@ def main(argv):
t
=
find_test_vectors
(
d
)
t
=
find_test_vectors
(
d
)
print
(
t
)
print
(
t
)
# base name n
pieces
=
f
.
split
(
os
.
sep
)
n
=
pieces
[
1
]
+
"."
+
"."
.
join
(
pieces
[
4
:
-
1
])
print
(
n
)
# if include_list was provided, skip elements not in the list
# if include_list was provided, skip elements not in the list
if
include_list
is
not
None
:
if
include_list
is
not
None
:
if
n
not
in
include_list
:
if
n
not
in
include_list
:
...
...
index.html
View file @
67bcb93e
This diff is collapsed.
Click to expand it.
process_zip.sh
View file @
67bcb93e
...
@@ -37,8 +37,8 @@ function run() {
...
@@ -37,8 +37,8 @@ function run() {
mkdir
-p
"./queues"
mkdir
-p
"./queues"
QUEUE_PATH
=
"./queues/
$TEMPLATE
"
QUEUE_PATH
=
"./queues/
$TEMPLATE
"
TEST_PATH
=
"
$DESTDIR
/
$CIPHER_SLUG
"
CIPHER_SLUG
=
$(
basename
$cipher
)
CIPHER_SLUG
=
$(
basename
$cipher
)
TEST_PATH
=
"
$DESTDIR
/
$CIPHER_SLUG
"
mkdir
-p
"
$TEST_PATH
"
||
exit
1
mkdir
-p
"
$TEST_PATH
"
||
exit
1
mv
$cipher
/
*
.log
"
$TEST_PATH
"
mv
$cipher
/
*
.log
"
$TEST_PATH
"
...
...
test-dude.py
View file @
67bcb93e
...
@@ -2,10 +2,12 @@
...
@@ -2,10 +2,12 @@
import
os
import
os
import
sys
import
signal
import
datetime
import
datetime
import
threading
import
threading
import
subprocess
import
subprocess
from
flask
import
Flask
,
request
from
flask
import
Flask
,
request
,
Response
from
flask_restful
import
Resource
,
Api
from
flask_restful
import
Resource
,
Api
from
flask_jsonpify
import
jsonify
from
flask_jsonpify
import
jsonify
...
@@ -43,11 +45,12 @@ class Runner(threading.Thread):
...
@@ -43,11 +45,12 @@ class Runner(threading.Thread):
self
.
template
=
template
self
.
template
=
template
self
.
program
=
program
self
.
program
=
program
self
.
process
=
None
self
.
process
=
None
self
.
job
=
None
self
.
job
=
None
self
.
event
=
threading
.
Event
()
self
.
stop_event
=
threading
.
Event
()
threading
.
Thread
.
__init__
(
self
)
threading
.
Thread
.
__init__
(
self
)
self
.
name
+=
"-
%
s"
%
template
self
.
start
()
self
.
start
()
def
to_dict
(
self
):
def
to_dict
(
self
):
...
@@ -58,9 +61,11 @@ class Runner(threading.Thread):
...
@@ -58,9 +61,11 @@ class Runner(threading.Thread):
'job'
:
str
(
id
(
self
.
job
))
if
self
.
job
is
not
None
else
None
'job'
:
str
(
id
(
self
.
job
))
if
self
.
job
is
not
None
else
None
}
}
def
stop
(
self
):
self
.
stop_event
.
set
()
def
run
(
self
):
def
run
(
self
):
while
1
:
while
not
self
.
stop_event
.
is_set
():
self
.
event
.
clear
()
my_queue
=
[
my_queue
=
[
s
for
s
in
schedule
s
for
s
in
schedule
if
s
.
state
==
'SCHEDULED'
if
s
.
state
==
'SCHEDULED'
...
@@ -69,7 +74,7 @@ class Runner(threading.Thread):
...
@@ -69,7 +74,7 @@ class Runner(threading.Thread):
my_queue
.
sort
(
key
=
lambda
s
:
s
.
added
)
my_queue
.
sort
(
key
=
lambda
s
:
s
.
added
)
if
len
(
my_queue
)
==
0
:
if
len
(
my_queue
)
==
0
:
# No tasks for this thread, go to sleep
# No tasks for this thread, go to sleep
self
.
event
.
wait
(
timeout
=
5
)
self
.
stop_
event
.
wait
(
timeout
=
5
)
continue
continue
job
=
my_queue
[
0
]
job
=
my_queue
[
0
]
...
@@ -96,7 +101,13 @@ class Runner(threading.Thread):
...
@@ -96,7 +101,13 @@ class Runner(threading.Thread):
stdout
=
out_fd
,
stdout
=
out_fd
,
stderr
=
err_fd
stderr
=
err_fd
)
)
self
.
process
.
wait
()
while
self
.
process
.
poll
()
is
None
:
if
self
.
stop_event
.
wait
(
timeout
=
1
):
self
.
process
.
send_signal
(
signal
.
SIGINT
)
try
:
self
.
process
.
wait
(
timeout
=
1
)
except
subprocess
.
TimeoutExpired
:
pass
if
self
.
process
.
returncode
==
0
:
if
self
.
process
.
returncode
==
0
:
self
.
job
.
state
=
'SUCCESSFUL'
self
.
job
.
state
=
'SUCCESSFUL'
...
@@ -108,7 +119,9 @@ class Runner(threading.Thread):
...
@@ -108,7 +119,9 @@ class Runner(threading.Thread):
[
'zip'
,
'-r'
,
'results.zip'
,
'.'
],
[
'zip'
,
'-r'
,
'results.zip'
,
'.'
],
cwd
=
self
.
job
.
path
)
cwd
=
self
.
job
.
path
)
print
(
"Job
%
d has finished"
%
id
(
self
.
job
))
self
.
job
=
None
self
.
job
=
None
print
(
"Thread
%
s has finished"
%
self
.
name
)
class
Status
(
Resource
):
class
Status
(
Resource
):
...
@@ -177,7 +190,17 @@ def view_log(job_id, log_id):
...
@@ -177,7 +190,17 @@ def view_log(job_id, log_id):
if
not
os
.
path
.
isfile
(
log_path
):
if
not
os
.
path
.
isfile
(
log_path
):
return
'Log not found'
,
404
return
'Log not found'
,
404
with
open
(
log_path
,
'r'
)
as
f
:
with
open
(
log_path
,
'r'
)
as
f
:
return
f
.
read
()
return
Response
(
f
.
read
(),
mimetype
=
'text/plain'
)
@app.route
(
'/results/<string:job_id>/results.zip'
)
def
get_results_zip
(
job_id
):
job
=
next
(
filter
(
lambda
job
:
str
(
id
(
job
))
==
job_id
,
schedule
),
None
)
if
job
is
None
:
return
'Job not found'
,
404
zip_path
=
os
.
path
.
join
(
job
.
path
,
'results.zip'
)
with
open
(
zip_path
,
'rb'
)
as
zip
:
return
Response
(
zip
.
read
(),
mimetype
=
'application/zip'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -186,4 +209,15 @@ if __name__ == '__main__':
...
@@ -186,4 +209,15 @@ if __name__ == '__main__':
runners
.
append
(
Runner
(
'uno'
))
runners
.
append
(
Runner
(
'uno'
))
runners
.
append
(
Runner
(
'esp32'
))
runners
.
append
(
Runner
(
'esp32'
))
runners
.
append
(
Runner
(
'bluepill'
))
runners
.
append
(
Runner
(
'bluepill'
))
def
signal_handler
(
signal
,
frame
):
print
(
"Process interrupted!"
,
file
=
sys
.
stderr
)
for
r
in
runners
:
print
(
"Stopping runner
%
s"
%
r
.
name
,
file
=
sys
.
stderr
)
r
.
stop
()
r
.
join
()
print
(
"Runner
%
s stopped"
%
r
.
name
,
file
=
sys
.
stderr
)
sys
.
exit
(
0
)
signal
.
signal
(
signal
.
SIGINT
,
signal_handler
)
app
.
run
(
port
=
'5002'
)
app
.
run
(
port
=
'5002'
)
test_common.py
View file @
67bcb93e
...
@@ -5,7 +5,6 @@ import re
...
@@ -5,7 +5,6 @@ import re
import
sys
import
sys
import
time
import
time
import
fcntl
import
fcntl
import
pickle
import
struct
import
struct
import
socket
import
socket
import
subprocess
import
subprocess
...
@@ -392,7 +391,6 @@ class FileMutex:
...
@@ -392,7 +391,6 @@ class FileMutex:
class
OpenOcd
:
class
OpenOcd
:
def
__init__
(
self
,
config_file
,
tcl_port
=
6666
,
verbose
=
False
):
def
__init__
(
self
,
config_file
,
tcl_port
=
6666
,
verbose
=
False
):
self
.
verbose
=
verbose
self
.
verbose
=
verbose
self
.
tclRpcIp
=
"127.0.0.1"
self
.
tclRpcIp
=
"127.0.0.1"
...
@@ -451,7 +449,6 @@ class OpenOcd:
...
@@ -451,7 +449,6 @@ class OpenOcd:
def
run_nist_lws_aead_test
(
dut
,
vectors_file
,
build_dir
,
def
run_nist_lws_aead_test
(
dut
,
vectors_file
,
build_dir
,
logic_mask
=
0xffff
):
logic_mask
=
0xffff
):
kat
=
list
(
parse_nist_aead_test_vectors
(
vectors_file
))
kat
=
list
(
parse_nist_aead_test_vectors
(
vectors_file
))
dut
.
flash
()
dut
.
flash
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment