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/
measurements/
*.log
email-submissions/
compile_all.py
View file @
12fe513c
...
...
@@ -3,21 +3,17 @@
import
os
import
sys
import
stat
import
argparse
import
shutil
import
random
import
subprocess
import
shutil
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
)
d
=
os
.
path
.
join
(
"build"
,
r
)
if
not
os
.
path
.
isdir
(
d
):
build_dir
=
d
print
(
"Building in
%
s"
%
build_dir
)
# copy all the files from the submitted algorithm into the build directory
...
...
@@ -103,15 +99,23 @@ def find_test_vectors(d):
def
main
(
argv
):
submissions_dir
=
"all-lwc-submission-files"
template_dir
=
"templates/linux"
include_list
=
None
if
len
(
argv
)
>
1
:
template_dir
=
argv
[
1
]
if
len
(
argv
)
>
2
:
with
open
(
argv
[
2
],
'r'
)
as
includes
:
include_list
=
[]
for
line
in
includes
.
readlines
():
include_list
.
append
(
line
.
strip
())
# Parse the arguments
argparser
=
argparse
.
ArgumentParser
(
description
=
'Compiles all LWC submissions for a given template'
)
argparser
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
'count'
)
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
)
subs
=
os
.
listdir
(
submissions_dir
)
...
...
@@ -175,13 +179,13 @@ def main(argv):
#files = files[:1]
print
(
"
%
d algorithms will be compiled"
%
len
(
files
))
if
not
os
.
path
.
isdir
(
'build'
):
os
.
mkdir
(
'build'
)
if
not
os
.
path
.
isdir
(
build_root_dir
):
os
.
mkdir
(
build_root_dir
)
print
()
# 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
:
test_script
.
write
(
"#!/bin/sh
\n
"
)
test_script
.
write
(
"mkdir -p logs
\n
"
)
...
...
@@ -190,7 +194,7 @@ def main(argv):
print
()
print
(
d
)
try
:
build_dir
=
os
.
path
.
join
(
"build"
,
name
)
build_dir
=
os
.
path
.
join
(
build_root_dir
,
name
)
b
=
build
(
d
,
template_dir
,
build_dir
)
if
b
is
None
:
continue
...
...
@@ -201,6 +205,8 @@ def main(argv):
os
.
path
.
join
(
b
,
'test_stderr.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
)
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