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