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
...
@@ -9,6 +9,9 @@ import subprocess
def
build
(
algo_dir
,
template_dir
,
build_dir
):
def
build
(
algo_dir
,
template_dir
,
build_dir
):
if
os
.
path
.
isdir
(
build_dir
):
return
None
# create a new directory for the build
# create a new directory for the build
while
build_dir
is
None
:
while
build_dir
is
None
:
r
=
"
%09
d"
%
random
.
randint
(
0
,
999999999
)
r
=
"
%09
d"
%
random
.
randint
(
0
,
999999999
)
...
@@ -172,10 +175,8 @@ def main(argv):
...
@@ -172,10 +175,8 @@ def main(argv):
#files = files[:1]
#files = files[:1]
print
(
"
%
d algorithms will be compiled"
%
len
(
files
))
print
(
"
%
d algorithms will be compiled"
%
len
(
files
))
# Clear the build directory as it is a leftover from the previous execution
if
not
os
.
path
.
isdir
(
'build'
):
if
os
.
path
.
isdir
(
'build'
):
os
.
mkdir
(
'build'
)
shutil
.
rmtree
(
'build'
)
os
.
mkdir
(
'build'
)
print
()
print
()
...
@@ -191,6 +192,8 @@ def main(argv):
...
@@ -191,6 +192,8 @@ def main(argv):
try
:
try
:
build_dir
=
os
.
path
.
join
(
"build"
,
name
)
build_dir
=
os
.
path
.
join
(
"build"
,
name
)
b
=
build
(
d
,
template_dir
,
build_dir
)
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
(
"
\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
"
%
(
test_script
.
write
(
"python3 -u ./test.py
%
s
%
s 2>
%
s | tee
%
s
\n
"
%
(
t
,
t
,
...
...
test.py
View file @
69d96640
...
@@ -6,8 +6,6 @@ import sys
...
@@ -6,8 +6,6 @@ import sys
import
struct
import
struct
from
subprocess
import
Popen
,
PIPE
from
subprocess
import
Popen
,
PIPE
MEASURE_TIME
=
True
MEASURE_RAM
=
False
def
main
(
argv
):
def
main
(
argv
):
if
len
(
argv
)
<
3
:
if
len
(
argv
)
<
3
:
...
@@ -18,13 +16,11 @@ def main(argv):
...
@@ -18,13 +16,11 @@ def main(argv):
for
attempt
in
range
(
3
):
for
attempt
in
range
(
3
):
print
(
"beginning test
%
d of '
%
s' using test vectors '
%
s'"
%
(
attempt
,
' '
.
join
(
cmd
),
argv
[
1
]))
print
(
"beginning test
%
d of '
%
s' using test vectors '
%
s'"
%
(
attempt
,
' '
.
join
(
cmd
),
argv
[
1
]))
try
:
try
:
if
MEASURE_TIME
:
measurements
=
begin_measurement
()
measurements
=
begin_measurement
()
try
:
try
:
test
(
argv
[
1
],
cmd
)
test
(
argv
[
1
],
cmd
)
finally
:
finally
:
if
MEASURE_TIME
:
end_measurement
(
measurements
)
end_measurement
(
measurements
)
print
(
"TEST SUCCESSFUL"
)
print
(
"TEST SUCCESSFUL"
)
return
0
return
0
...
@@ -118,12 +114,6 @@ def test(test_file, cmd):
...
@@ -118,12 +114,6 @@ def test(test_file, cmd):
print
(
" m =
%
s"
%
output
.
hex
())
print
(
" m =
%
s"
%
output
.
hex
())
if
m
!=
output
:
if
m
!=
output
:
raise
Exception
(
"output of encryption is different from expected ciphertext"
)
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
:
elif
res
is
not
None
:
if
res
[
1
]
.
lower
()
==
'count'
:
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