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
3a0ee47f
authored
Mar 06, 2020
by
lwc-tester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working template for bluepill, and tester produces zip of results
parent
1dffe232
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
73 deletions
+68
-73
process_zip.sh
+0
-1
templates/bluepill/openocd.cfg
+2
-2
templates/bluepill/test
+8
-9
templates/esp32/test
+8
-9
templates/f7/test
+2
-1
templates/maixduino/test
+5
-6
templates/uno/test
+8
-9
test-dude.py
+16
-8
test_common.py
+19
-28
No files found.
process_zip.sh
View file @
3a0ee47f
...
...
@@ -64,7 +64,6 @@ function run() {
curl
\
--request
'POST'
\
--header
"Content-Type: application/json"
\
--header
"Authorization: OAuth ecP9ZsoKMPui4akg1MyGoT7yoGR2bLPo"
\
--data
"{
\"
path
\"
:
\"
$(
realpath
$TEST_PATH
)
\"
,
\"
template
\"
:
\"
$TEMPLATE
\"
}"
\
"http://127.0.0.1:5002/schedule_test"
...
...
templates/bluepill/openocd.cfg
View file @
3a0ee47f
...
...
@@ -21,6 +21,6 @@ source [find target/stm32f1x.cfg]
#tpiu config internal swodump.stm32f103-generic.log uart off 72000000
#
reset_config srst_only srst_push_pull srst_nogate connect_assert_srst
reset_config none srst_push_pull srst_nogate
reset_config srst_only srst_push_pull srst_nogate connect_assert_srst
#
reset_config none srst_push_pull srst_nogate
templates/bluepill/test
View file @
3a0ee47f
...
...
@@ -70,6 +70,12 @@ class BluePill(DeviceUnderTestAeadUARTP):
eprint
(
res
)
assert
res
==
''
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
115200
,
timeout
=
5
)
self
.
reset
()
def
reset
(
self
,
halt
=
False
):
ocd_cmd
=
'reset halt'
if
halt
else
'reset run'
res
=
self
.
ocd
.
send
(
ocd_cmd
)
...
...
@@ -77,14 +83,6 @@ class BluePill(DeviceUnderTestAeadUARTP):
assert
res
==
''
eprint
(
"Reset!"
)
def
prepare
(
self
):
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
115200
,
timeout
=
5
)
self
.
reset
()
DeviceUnderTestAeadUARTP
.
prepare
(
self
)
def
dump_ram
(
self
):
res
=
self
.
ocd
.
send
(
'dump_image
%
s 0x20000000 0x
%
x'
%
...
...
@@ -110,7 +108,8 @@ def main(argv):
build_dir
=
argv
[
1
]
kat_path
=
os
.
path
.
join
(
build_dir
,
'LWC_AEAD_KAT.txt'
)
run_nist_lws_aead_test
(
kat_path
,
build_dir
,
0x0002
,
BluePill
)
dut
=
BluePill
(
build_dir
)
run_nist_lws_aead_test
(
dut
,
kat_path
,
build_dir
,
0x0002
)
return
0
...
...
templates/esp32/test
View file @
3a0ee47f
...
...
@@ -46,14 +46,6 @@ class ESP32(DeviceUnderTestAeadUARTP):
self
.
ser
.
setRTS
(
False
)
# EN=HIGH, chip out of reset
time
.
sleep
(
1
)
def
prepare
(
self
):
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
500000
,
timeout
=
5
)
self
.
reset
()
DeviceUnderTestAeadUARTP
.
prepare
(
self
)
def
flash
(
self
):
pio_packages_path
=
"/home/tester/.platformio/packages/"
esptoolpy_path
=
os
.
path
.
join
(
...
...
@@ -94,6 +86,12 @@ class ESP32(DeviceUnderTestAeadUARTP):
eprint
(
"Firmware flashed."
)
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
500000
,
timeout
=
5
)
self
.
reset
()
def
dump_ram
(
self
):
return
None
...
...
@@ -106,7 +104,8 @@ def main(argv):
build_dir
=
argv
[
1
]
kat_path
=
os
.
path
.
join
(
build_dir
,
'LWC_AEAD_KAT.txt'
)
run_nist_lws_aead_test
(
kat_path
,
build_dir
,
0x0020
,
ESP32
)
dut
=
ESP32
(
build_dir
)
run_nist_lws_aead_test
(
dut
,
kat_path
,
build_dir
,
0x0020
)
return
0
...
...
templates/f7/test
View file @
3a0ee47f
...
...
@@ -70,7 +70,8 @@ def main(argv):
build_dir
=
argv
[
1
]
kat_path
=
os
.
path
.
join
(
build_dir
,
'LWC_AEAD_KAT.txt'
)
run_nist_lws_aead_test
(
kat_path
,
build_dir
,
0x0008
,
F7
)
dut
=
F7
(
build_dir
)
run_nist_lws_aead_test
(
dut
,
kat_path
,
build_dir
,
0x0008
)
return
0
...
...
templates/maixduino/test
View file @
3a0ee47f
...
...
@@ -54,11 +54,6 @@ class Maixduino(DeviceUnderTestAeadUARTP):
self
.
ser
.
setRTS
(
True
)
time
.
sleep
(
1
)
def
prepare
(
self
):
self
.
reset
()
self
.
reset
()
DeviceUnderTestAeadUARTP
.
prepare
(
self
)
def
flash
(
self
):
pio_packages_path
=
"/home/tester/.platformio/packages/"
kflash_path
=
os
.
path
.
join
(
...
...
@@ -73,6 +68,9 @@ class Maixduino(DeviceUnderTestAeadUARTP):
eprint
(
"Firmware flashed."
)
self
.
reset
()
self
.
reset
()
def
dump_ram
(
self
):
return
None
...
...
@@ -85,7 +83,8 @@ def main(argv):
build_dir
=
argv
[
1
]
kat_path
=
os
.
path
.
join
(
build_dir
,
'LWC_AEAD_KAT.txt'
)
run_nist_lws_aead_test
(
kat_path
,
build_dir
,
0x0080
,
Maixduino
)
dut
=
Maixduino
(
build_dir
)
run_nist_lws_aead_test
(
dut
,
kat_path
,
build_dir
,
0x0080
)
return
0
...
...
templates/uno/test
View file @
3a0ee47f
...
...
@@ -44,14 +44,6 @@ class Uno(DeviceUnderTestAeadUARTP):
self
.
ser
.
setDTR
(
False
)
time
.
sleep
(
1
)
def
prepare
(
self
):
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
115200
,
timeout
=
5
)
self
.
reset
()
DeviceUnderTestAeadUARTP
.
prepare
(
self
)
def
flash
(
self
):
pipe
=
subprocess
.
PIPE
avrdude_dir
=
'/home/tester/.platformio/packages/tool-avrdude/'
...
...
@@ -81,6 +73,12 @@ class Uno(DeviceUnderTestAeadUARTP):
assert
p
.
returncode
==
0
eprint
(
"Firmware flashed."
)
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
115200
,
timeout
=
5
)
self
.
reset
()
def
dump_ram
(
self
):
return
None
...
...
@@ -93,7 +91,8 @@ def main(argv):
build_dir
=
argv
[
1
]
kat_path
=
os
.
path
.
join
(
build_dir
,
'LWC_AEAD_KAT.txt'
)
run_nist_lws_aead_test
(
kat_path
,
build_dir
,
0x0800
,
Uno
)
dut
=
Uno
(
build_dir
)
run_nist_lws_aead_test
(
dut
,
kat_path
,
build_dir
,
0x0800
)
return
0
...
...
test-dude.py
View file @
3a0ee47f
...
...
@@ -87,19 +87,27 @@ class Runner(threading.Thread):
cmd
+=
self
.
program
cmd
+=
[
self
.
job
.
path
]
print
(
"Executing ``
%
s´´"
%
' '
.
join
(
cmd
))
out_fd
=
open
(
os
.
path
.
join
(
self
.
job
.
path
,
'test.stdout.log'
),
'w'
)
err_fd
=
open
(
os
.
path
.
join
(
self
.
job
.
path
,
'test.stderr.log'
),
'w'
)
self
.
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
out_fd
,
stderr
=
err_fd
)
self
.
process
.
wait
()
out_path
=
os
.
path
.
join
(
self
.
job
.
path
,
'test.stdout.log'
)
err_path
=
os
.
path
.
join
(
self
.
job
.
path
,
'test.stderr.log'
)
with
open
(
out_path
,
'w'
)
as
out_fd
,
\
open
(
err_path
,
'w'
)
as
err_fd
:
self
.
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
out_fd
,
stderr
=
err_fd
)
self
.
process
.
wait
()
if
self
.
process
.
returncode
==
0
:
self
.
job
.
state
=
'SUCCESSFUL'
else
:
self
.
job
.
state
=
'FAILED'
self
.
process
=
None
subprocess
.
check_call
(
[
'zip'
,
'-r'
,
'results.zip'
,
'.'
],
cwd
=
self
.
job
.
path
)
self
.
job
=
None
...
...
test_common.py
View file @
3a0ee47f
...
...
@@ -449,29 +449,17 @@ class OpenOcd:
return
data
.
decode
(
'ascii'
)
def
run_nist_lws_aead_test
(
vectors_file
,
build_dir
,
logic_mask
=
0xffff
,
basecls
=
DeviceUnderTestAeadUARTP
,
results_path
=
None
):
results
=
{}
def
run_nist_lws_aead_test
(
dut
,
vectors_file
,
build_dir
,
logic_mask
=
0xffff
):
kat
=
list
(
parse_nist_aead_test_vectors
(
vectors_file
))
results
[
'test_vectors'
]
=
kat
dut
=
basecls
(
build_dir
)
fw_path
=
dut
.
firmware_path
if
fw_path
is
not
None
:
with
open
(
fw_path
,
'rb'
)
as
fw_file
:
firmware
=
fw_file
.
read
()
results
[
'firmware'
]
=
(
fw_path
,
os
.
stat
(
fw_path
),
firmware
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
dump_a
=
dut
.
dump_ram
()
ram_dumps
=
[
dut
.
dump_ram
()]
tool
=
LogicMultiplexerTimeMeasurements
(
logic_mask
)
try
:
...
...
@@ -482,10 +470,10 @@ def run_nist_lws_aead_test(vectors_file, build_dir,
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
if
i
==
1
and
dump_a
is
not
None
:
dump_b
=
dut
.
dump_ram
(
)
results
[
'ram_dumps'
]
=
[
dump_a
,
dump_b
]
longest
=
compare_dumps
(
dump_a
,
dump_b
)
if
i
==
1
and
ram_dumps
[
0
]
is
not
None
:
ram_dumps
.
append
(
dut
.
dump_ram
()
)
longest
=
compare_dumps
(
ram_dumps
[
0
],
ram_dumps
[
1
]
)
print
(
" longest chunk of untouched memory =
%
d"
%
longest
)
except
Exception
as
ex
:
...
...
@@ -495,12 +483,15 @@ def run_nist_lws_aead_test(vectors_file, build_dir,
finally
:
tool
.
end_measurement
()
results
[
'time_dips'
]
=
tool
.
capture
if
results_path
is
None
:
results_path
=
os
.
path
.
join
(
build_dir
,
'results.pickle'
)
if
results_path
is
not
False
:
with
open
(
results_path
,
'wb'
)
as
f
:
pickle
.
dump
(
results
,
f
,
pickle
.
HIGHEST_PROTOCOL
)
return
results
for
i
,
d
in
enumerate
(
ram_dumps
):
path
=
os
.
path
.
join
(
build_dir
,
'ram_dump.
%
d.bin'
%
i
)
if
d
is
not
None
:
with
open
(
path
,
'wb'
)
as
f
:
f
.
write
(
d
)
logic_trace
=
tool
.
capture
path
=
os
.
path
.
join
(
build_dir
,
'logic_trace.csv'
)
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
)
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