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
f4f4aedf
authored
Feb 24, 2020
by
lwc-tester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
this should be ready
parent
8686290f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
201 deletions
+106
-201
templates/bluepill/test
+3
-36
templates/esp32/test
+3
-27
templates/f7/test
+3
-36
templates/maixduino/test
+3
-27
templates/uno/test
+3
-28
test_common.py
+91
-47
No files found.
templates/bluepill/test
View file @
f4f4aedf
...
...
@@ -4,14 +4,11 @@ import os
import
sys
import
serial.tools.list_ports
from
test_common
import
(
LogicMultiplexerTimeMeasurements
,
parse_nist_aead_test_vectors
,
DeviceUnderTestAeadUARTP
,
compare_dumps
,
eprint
,
OpenOcd
,
FileMutex
,
run_nist_
aead_test_line
,
run_nist_
lws_aead_test
)
...
...
@@ -109,38 +106,8 @@ def main(argv):
print
(
"Usage: test LWC_AEAD_KAT.txt build_dir"
)
return
1
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
1
]))
build_dir
=
argv
[
2
]
dut
=
BluePill
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
dump_a
=
dut
.
dump_ram
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x0002
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
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
()
longest
=
compare_dumps
(
dump_a
,
dump_b
)
print
(
" longest chunk of untouched memory =
%
d"
%
longest
)
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
run_nist_lws_aead_test
(
argv
[
1
],
argv
[
2
],
0x0002
,
BluePill
)
return
0
if
__name__
==
"__main__"
:
...
...
templates/esp32/test
View file @
f4f4aedf
...
...
@@ -6,12 +6,10 @@ import time
import
subprocess
import
serial.tools.list_ports
from
test_common
import
(
LogicMultiplexerTimeMeasurements
,
parse_nist_aead_test_vectors
,
DeviceUnderTestAeadUARTP
,
eprint
,
FileMutex
,
run_nist_
aead_test_line
,
run_nist_
lws_aead_test
,
)
...
...
@@ -74,30 +72,8 @@ def main(argv):
print
(
"Usage: test LWC_AEAD_KAT.txt build_dir"
)
return
1
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
1
]))
build_dir
=
argv
[
2
]
dut
=
ESP32
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x0020
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
run_nist_lws_aead_test
(
argv
[
1
],
argv
[
2
],
0x0020
,
ESP32
)
return
0
if
__name__
==
"__main__"
:
...
...
templates/f7/test
View file @
f4f4aedf
...
...
@@ -5,13 +5,10 @@ import sys
import
pylink
import
serial.tools.list_ports
from
test_common
import
(
LogicMultiplexerTimeMeasurements
,
parse_nist_aead_test_vectors
,
DeviceUnderTestAeadUARTP
,
compare_dumps
,
eprint
,
FileMutex
,
run_nist_
aead_test_line
,
run_nist_
lws_aead_test
,
)
...
...
@@ -66,38 +63,8 @@ def main(argv):
print
(
"Usage: test LWC_AEAD_KAT.txt build_dir"
)
return
1
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
1
]))
build_dir
=
argv
[
2
]
dut
=
F7
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
dump_a
=
dut
.
dump_ram
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x0008
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
if
i
==
1
:
dump_b
=
dut
.
dump_ram
()
longest
=
compare_dumps
(
dump_a
,
dump_b
)
print
(
" longest chunk of untouched memory =
%
d"
%
longest
)
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
run_nist_lws_aead_test
(
argv
[
1
],
argv
[
2
],
0x0008
,
F7
)
return
0
if
__name__
==
"__main__"
:
...
...
templates/maixduino/test
View file @
f4f4aedf
...
...
@@ -6,12 +6,10 @@ import time
import
subprocess
import
serial.tools.list_ports
from
test_common
import
(
LogicMultiplexerTimeMeasurements
,
parse_nist_aead_test_vectors
,
DeviceUnderTestAeadUARTP
,
FileMutex
,
eprint
,
run_nist_
aead_test_line
,
run_nist_
lws_aead_test
,
)
...
...
@@ -76,30 +74,8 @@ def main(argv):
print
(
"Usage: test LWC_AEAD_KAT.txt build_dir"
)
return
1
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
1
]))
build_dir
=
argv
[
2
]
dut
=
Maixduino
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x0080
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
run_nist_lws_aead_test
(
argv
[
1
],
argv
[
2
],
0x0080
,
Maixduino
)
return
0
if
__name__
==
"__main__"
:
...
...
templates/uno/test
View file @
f4f4aedf
...
...
@@ -6,12 +6,10 @@ import time
import
subprocess
import
serial.tools.list_ports
from
test_common
import
(
LogicMultiplexerTimeMeasurements
,
parse_nist_aead_test_vectors
,
DeviceUnderTestAeadUARTP
,
eprint
,
FileMutex
,
run_nist_
aead_test_line
,
run_nist_
lws_aead_test
,
)
...
...
@@ -72,31 +70,8 @@ def main(argv):
print
(
"Usage: test LWC_AEAD_KAT.txt build_dir"
)
return
1
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
1
]))
build_dir
=
argv
[
2
]
dut
=
Uno
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x0800
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
run_nist_lws_aead_test
(
argv
[
1
],
argv
[
2
],
0x0800
,
Uno
)
return
0
if
__name__
==
"__main__"
:
...
...
test_common.py
View file @
f4f4aedf
...
...
@@ -368,53 +368,6 @@ class SaleaeTimeMeasurements(TimeMeasurementTool):
raise
Exception
(
"Capture didn't complete successfully"
)
def
main
(
argv
):
if
len
(
argv
)
<
3
:
print
(
"Usage: test_common.py port LWC_AEAD_KAT.txt"
)
eprint
(
argv
[
0
])
script_dir
=
os
.
path
.
split
(
argv
[
0
])[
0
]
if
len
(
script_dir
)
>
0
:
os
.
chdir
(
script_dir
)
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
2
]))
dev
=
argv
[
1
]
ser
=
serial
.
Serial
(
dev
,
baudrate
=
115200
,
timeout
=
5
)
dut
=
DeviceUnderTestAeadUARTP
(
ser
)
try
:
tool
=
SaleaeTimeMeasurements
()
tool
.
begin_measurement
()
dut
.
flash
()
eprint
(
"Flashed"
)
dut
.
prepare
()
eprint
(
"Prepared"
)
sys
.
stdout
.
write
(
"Hello, World!
\n
"
)
sys
.
stdout
.
flush
()
dump_a
=
dut
.
dump_ram
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
if
dump_a
is
not
None
and
i
==
1
:
dump_b
=
dut
.
dump_ram
()
longest
=
compare_dumps
(
dump_a
,
dump_b
)
print
(
" longest chunk of untouched memory =
%
d"
%
longest
)
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
class
FileMutex
:
def
__init__
(
self
,
lock_path
):
self
.
lock_path
=
lock_path
...
...
@@ -495,5 +448,96 @@ class OpenOcd:
return
data
.
decode
(
'ascii'
)
def
run_nist_lws_aead_test
(
vectors_file
,
build_dir
,
logic_mask
=
0xffff
,
basecls
=
DeviceUnderTestAeadUARTP
):
kat
=
list
(
parse_nist_aead_test_vectors
(
vectors_file
))
dut
=
basecls
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
dump_a
=
dut
.
dump_ram
()
time_dips
=
None
ram_utilization
=
None
rom_utilization
=
None
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
logic_mask
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
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
()
longest
=
compare_dumps
(
dump_a
,
dump_b
)
print
(
" longest chunk of untouched memory =
%
d"
%
longest
)
ram_utilization
=
longest
time_dips
=
tool
.
capture
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
return
time_dips
,
ram_utilization
,
rom_utilization
def
main
(
argv
):
if
len
(
argv
)
<
3
:
print
(
"Usage: test_common.py port LWC_AEAD_KAT.txt"
)
eprint
(
argv
[
0
])
script_dir
=
os
.
path
.
split
(
argv
[
0
])[
0
]
if
len
(
script_dir
)
>
0
:
os
.
chdir
(
script_dir
)
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
2
]))
dev
=
argv
[
1
]
ser
=
serial
.
Serial
(
dev
,
baudrate
=
115200
,
timeout
=
5
)
dut
=
DeviceUnderTestAeadUARTP
(
ser
)
try
:
tool
=
SaleaeTimeMeasurements
()
tool
.
begin_measurement
()
dut
.
flash
()
eprint
(
"Flashed"
)
dut
.
prepare
()
eprint
(
"Prepared"
)
sys
.
stdout
.
write
(
"Hello, World!
\n
"
)
sys
.
stdout
.
flush
()
dump_a
=
dut
.
dump_ram
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
if
dump_a
is
not
None
and
i
==
1
:
dump_b
=
dut
.
dump_ram
()
longest
=
compare_dumps
(
dump_a
,
dump_b
)
print
(
" longest chunk of untouched memory =
%
d"
%
longest
)
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
raise
ex
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
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