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
12fe513c
authored
Feb 21, 2020
by
Sebastian Renner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compile for all templates and delete build files
parent
87489b2a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
18 deletions
+78
-18
.gitignore
+1
-0
compile_all.py
+24
-18
process_zip.sh
+53
-0
No files found.
.gitignore
View file @
12fe513c
build/
build/
measurements/
measurements/
*.log
*.log
email-submissions/
compile_all.py
View file @
12fe513c
...
@@ -3,21 +3,17 @@
...
@@ -3,21 +3,17 @@
import
os
import
os
import
sys
import
sys
import
stat
import
stat
import
argparse
import
shutil
import
shutil
import
random
import
random
import
subprocess
import
subprocess
import
shutil
def
build
(
algo_dir
,
template_dir
,
build_dir
):
def
build
(
algo_dir
,
template_dir
,
build_dir
):
if
os
.
path
.
isdir
(
build_dir
):
if
os
.
path
.
isdir
(
build_dir
):
return
None
return
None
# create a new directory for the build
while
build_dir
is
None
:
r
=
"
%09
d"
%
random
.
randint
(
0
,
999999999
)
d
=
os
.
path
.
join
(
"build"
,
r
)
if
not
os
.
path
.
isdir
(
d
):
build_dir
=
d
print
(
"Building in
%
s"
%
build_dir
)
print
(
"Building in
%
s"
%
build_dir
)
# copy all the files from the submitted algorithm into the build directory
# copy all the files from the submitted algorithm into the build directory
...
@@ -103,15 +99,23 @@ def find_test_vectors(d):
...
@@ -103,15 +99,23 @@ def find_test_vectors(d):
def
main
(
argv
):
def
main
(
argv
):
submissions_dir
=
"all-lwc-submission-files"
submissions_dir
=
"all-lwc-submission-files"
template_dir
=
"templates/linux"
include_list
=
None
include_list
=
None
if
len
(
argv
)
>
1
:
template_dir
=
argv
[
1
]
# Parse the arguments
if
len
(
argv
)
>
2
:
argparser
=
argparse
.
ArgumentParser
(
with
open
(
argv
[
2
],
'r'
)
as
includes
:
description
=
'Compiles all LWC submissions for a given template'
)
include_list
=
[]
for
line
in
includes
.
readlines
():
argparser
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
'count'
)
include_list
.
append
(
line
.
strip
())
argparser
.
add_argument
(
'-t'
,
'--template'
,
default
=
'templates/linux'
)
argparser
.
add_argument
(
'-b'
,
'--build-dir'
)
argparser
.
add_argument
(
'-i'
,
'--include'
,
action
=
'append'
)
args
=
argparser
.
parse_args
(
argv
[
1
:])
template_dir
=
args
.
template
build_root_dir
=
args
.
build_dir
include_list
=
args
.
include
print
(
"Using template
%
s"
%
template_dir
)
print
(
"Using template
%
s"
%
template_dir
)
subs
=
os
.
listdir
(
submissions_dir
)
subs
=
os
.
listdir
(
submissions_dir
)
...
@@ -175,13 +179,13 @@ def main(argv):
...
@@ -175,13 +179,13 @@ 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
))
if
not
os
.
path
.
isdir
(
'build'
):
if
not
os
.
path
.
isdir
(
build_root_dir
):
os
.
mkdir
(
'build'
)
os
.
mkdir
(
build_root_dir
)
print
()
print
()
# Write a script that executes all the tests one after the other
# Write a script that executes all the tests one after the other
test_script_path
=
os
.
path
.
join
(
"build"
,
"test_all.sh"
)
test_script_path
=
os
.
path
.
join
(
build_root_dir
,
"test_all.sh"
)
with
open
(
test_script_path
,
'w'
)
as
test_script
:
with
open
(
test_script_path
,
'w'
)
as
test_script
:
test_script
.
write
(
"#!/bin/sh
\n
"
)
test_script
.
write
(
"#!/bin/sh
\n
"
)
test_script
.
write
(
"mkdir -p logs
\n
"
)
test_script
.
write
(
"mkdir -p logs
\n
"
)
...
@@ -190,7 +194,7 @@ def main(argv):
...
@@ -190,7 +194,7 @@ def main(argv):
print
()
print
()
print
(
d
)
print
(
d
)
try
:
try
:
build_dir
=
os
.
path
.
join
(
"build"
,
name
)
build_dir
=
os
.
path
.
join
(
build_root_dir
,
name
)
b
=
build
(
d
,
template_dir
,
build_dir
)
b
=
build
(
d
,
template_dir
,
build_dir
)
if
b
is
None
:
if
b
is
None
:
continue
continue
...
@@ -201,6 +205,8 @@ def main(argv):
...
@@ -201,6 +205,8 @@ def main(argv):
os
.
path
.
join
(
b
,
'test_stderr.log'
),
os
.
path
.
join
(
b
,
'test_stderr.log'
),
os
.
path
.
join
(
b
,
'test_stdout.log'
))
os
.
path
.
join
(
b
,
'test_stdout.log'
))
)
)
shutil
.
copyfile
(
t
,
os
.
path
.
join
(
b
,
'LWC_AEAD_KAT.txt'
))
print
(
"COMPILATION SUCCESS FOR
%
s"
%
d
)
print
(
"COMPILATION SUCCESS FOR
%
s"
%
d
)
except
Exception
as
ex
:
except
Exception
as
ex
:
...
...
process_zip.sh
0 → 100755
View file @
12fe513c
#!/bin/bash
shopt
-s
extglob
function
run
()
{
TEMPLATE
=
"
$1
"
MAINDIR
=
"
$2
"
echo
"Template is
$TEMPLATE
, main directory is
$MAINDIR
"
mkdir
-p
$MAINDIR
/
$TEMPLATE
./compile_all.py
-t
templates/
$TEMPLATE
-b
$MAINDIR
/
$TEMPLATE
for
cipher
in
$MAINDIR
/
$TEMPLATE
/
*
;
do
case
$TEMPLATE
in
f7
)
mv
$cipher
/build/f7.bin
$cipher
/firmware.bin
;;
maixduino
)
mv
$cipher
/.pio/build/sipeed-maixduino/firmware.bin
$cipher
/firmware.bin
;;
bluepill
)
mv
$cipher
/.pio/build/bluepill_f103c8/firmware.bin
$cipher
/firmware.bin
;;
uno
)
mv
$cipher
/.pio/build/uno/firmware.hex
$cipher
/firmware.bin
;;
esp32
)
mv
$cipher
/.pio/build/esp32dev/firmware.bin
$cipher
/firmware.bin
;;
esac
rm
-r
$(
find
$cipher
!
-wholename
$cipher
!
-name
"firmware.*"
!
-name
"LWC_AEAD_KAT.txt"
)
done
}
if
[[
$1
==
"run"
]]
;
then
run
$2
$3
else
MAINDIR
=
email-submissions/
$(
date +%Y-%m-%d-%H:%M
)
mkdir
-p
$MAINDIR
unzip
$1
-d
all-lwc-submission-files
for
i
in
templates/
*
;
do
TEMPLATE
=
"
${
i
##*/
}
"
echo
"Template is
$TEMPLATE
"
touch
$MAINDIR
/locky.lock
flock
$MAINDIR
/locky.lock
$0
run
$TEMPLATE
$MAINDIR
done
fi
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