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
69d96640
authored
Jul 28, 2019
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
less complicated test.py and less aggressive compile_all.py
parent
b5fadc28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
16 deletions
+9
-16
compile_all.py
+7
-4
test.py
+2
-12
No files found.
compile_all.py
View file @
69d96640
...
...
@@ -9,6 +9,9 @@ import subprocess
def
build
(
algo_dir
,
template_dir
,
build_dir
):
if
os
.
path
.
isdir
(
build_dir
):
return
None
# create a new directory for the build
while
build_dir
is
None
:
r
=
"
%09
d"
%
random
.
randint
(
0
,
999999999
)
...
...
@@ -172,10 +175,8 @@ def main(argv):
#files = files[:1]
print
(
"
%
d algorithms will be compiled"
%
len
(
files
))
# Clear the build directory as it is a leftover from the previous execution
if
os
.
path
.
isdir
(
'build'
):
shutil
.
rmtree
(
'build'
)
os
.
mkdir
(
'build'
)
if
not
os
.
path
.
isdir
(
'build'
):
os
.
mkdir
(
'build'
)
print
()
...
...
@@ -191,6 +192,8 @@ def main(argv):
try
:
build_dir
=
os
.
path
.
join
(
"build"
,
name
)
b
=
build
(
d
,
template_dir
,
build_dir
)
if
b
is
None
:
continue
test_script
.
write
(
"
\n\n
echo
\"
TEST NUMBER
%03
d: TESTING
%
s
\"\n
"
%
(
i
,
d
))
test_script
.
write
(
"python3 -u ./test.py
%
s
%
s 2>
%
s | tee
%
s
\n
"
%
(
t
,
...
...
test.py
View file @
69d96640
...
...
@@ -6,8 +6,6 @@ import sys
import
struct
from
subprocess
import
Popen
,
PIPE
MEASURE_TIME
=
True
MEASURE_RAM
=
False
def
main
(
argv
):
if
len
(
argv
)
<
3
:
...
...
@@ -18,13 +16,11 @@ def main(argv):
for
attempt
in
range
(
3
):
print
(
"beginning test
%
d of '
%
s' using test vectors '
%
s'"
%
(
attempt
,
' '
.
join
(
cmd
),
argv
[
1
]))
try
:
if
MEASURE_TIME
:
measurements
=
begin_measurement
()
measurements
=
begin_measurement
()
try
:
test
(
argv
[
1
],
cmd
)
finally
:
if
MEASURE_TIME
:
end_measurement
(
measurements
)
end_measurement
(
measurements
)
print
(
"TEST SUCCESSFUL"
)
return
0
...
...
@@ -118,12 +114,6 @@ def test(test_file, cmd):
print
(
" m =
%
s"
%
output
.
hex
())
if
m
!=
output
:
raise
Exception
(
"output of encryption is different from expected ciphertext"
)
if
MEASURE_RAM
:
write
(
b
'u'
)
output
=
obtain
()
print
(
" untouched memory =
%
d"
%
struct
.
unpack
(
"<I"
,
output
))
break
elif
res
is
not
None
:
if
res
[
1
]
.
lower
()
==
'count'
:
...
...
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