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
ae81dda7
authored
Mar 03, 2020
by
lwc-tester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compile all and process zip updated
parent
26c47244
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
27 deletions
+52
-27
compile_all.py
+8
-12
process_zip.sh
+44
-15
No files found.
compile_all.py
View file @
ae81dda7
...
...
@@ -6,7 +6,6 @@ import stat
import
argparse
import
shutil
import
subprocess
import
shutil
def
build
(
algo_dir
,
template_dir
,
build_dir
):
...
...
@@ -54,18 +53,16 @@ def build(algo_dir, template_dir, build_dir):
os
.
chdir
(
build_dir
)
try
:
if
os
.
path
.
isfile
(
'./configure'
):
p
=
subprocess
.
Popen
([
"./configure"
])
p
.
wait
()
assert
p
.
returncode
==
0
subprocess
.
check_call
([
"./configure"
])
p
=
subprocess
.
Popen
([
'make'
])
p
.
wait
()
assert
p
.
returncode
==
0
stdout_path
=
'make.stdout.log'
stderr_path
=
'make.stderr.log'
with
open
(
stdout_path
,
'w'
)
as
outfile
,
\
open
(
stderr_path
,
'w'
)
as
errfile
:
subprocess
.
check_call
([
'make'
],
stdout
=
outfile
,
stderr
=
errfile
)
if
os
.
path
.
isfile
(
'./cleanup'
):
p
=
subprocess
.
Popen
([
"./cleanup"
])
p
.
wait
()
assert
p
.
returncode
==
0
subprocess
.
check_call
([
"./cleanup"
])
finally
:
sys
.
stdout
.
flush
()
...
...
@@ -101,7 +98,7 @@ def main(argv):
# Parse the arguments
argparser
=
argparse
.
ArgumentParser
(
description
=
'Compiles all LWC submissions for a given template'
)
description
=
'Compiles all LWC submissions for a given template'
)
argparser
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
'count'
)
argparser
.
add_argument
(
'-t'
,
'--template'
,
default
=
'templates/linux'
)
...
...
@@ -206,7 +203,6 @@ def main(argv):
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
View file @
ae81dda7
...
...
@@ -5,47 +5,76 @@ shopt -s extglob
function
run
()
{
TEMPLATE
=
"
$1
"
MAIN
DIR
=
"
$2
"
DEST
DIR
=
"
$2
"
echo
"Template is
$TEMPLATE
, main directory is
$MAINDIR
"
mkdir
-p
$MAINDIR
/
$TEMPLATE
./compile_all.py
-t
templates/
$TEMPLATE
-b
$MAINDIR
/
$TEMPLATE
if
[[
!
-d
"templates/
$TEMPLATE
"
]]
;
then
echo
"Template '
$TEMPLATE
' does not exist"
exit
1
fi
if
[[
-e
"
$DESTDIR
"
]]
;
then
echo
"Destination directory '
$DESTDIR
' already exists"
exit
1
fi
TMPDIR
=
$(
mktemp
-d
-t
build-XXXXXXXXXX
)
if
[[
!
-d
"
$TMPDIR
"
]]
;
then
echo
"Failed to create a temporary build directory"
exit
1
fi
echo
"Template is '
$TEMPLATE
', destination directory is '
$DESTDIR
', temporary directory is '
$TMPDIR
'"
mkdir
-p
$DESTDIR
echo
"Compiling for template '
$TEMPLATE
' in directory '
$TMPDIR
'"
./compile_all.py
-t
"templates/
$TEMPLATE
"
-b
"
$TMPDIR
"
for
cipher
in
$MAINDIR
/
$TEMPLATE
/
*
;
do
for
cipher
in
$TMPDIR
/
*
;
do
CIPHER_SLUG
=
$(
basename
$cipher
)
if
[[
!
-d
$cipher
]]
;
then continue
;
fi
mkdir
-p
$DESTDIR
/
$CIPHER_SLUG
||
exit
1
mv
$cipher
/
*
.log
$DESTDIR
/
$CIPHER_SLUG
/
case
$TEMPLATE
in
f7
)
mv
$cipher
/build/f7.
bin
$cipher
/firmware.bin
f7
)
mv
$cipher
/build/f7.
*
$DESTDIR
/
$CIPHER_SLUG
/
;;
maixduino
)
mv
$cipher
/.pio/build/sipeed-maixduino/firmware.
bin
$cipher
/firmware.bin
maixduino
)
mv
$cipher
/.pio/build/sipeed-maixduino/firmware.
*
$DESTDIR
/
$CIPHER_SLUG
/
;;
bluepill
)
mv
$cipher
/.pio/build/bluepill_f103c8/firmware.
bin
$cipher
/firmware.bin
bluepill
)
mv
$cipher
/.pio/build/bluepill_f103c8/firmware.
*
$DESTDIR
/
$CIPHER_SLUG
/
;;
uno
)
mv
$cipher
/.pio/build/uno/firmware.
hex
$cipher
/firmware.bin
uno
)
mv
$cipher
/.pio/build/uno/firmware.
*
$DESTDIR
/
$CIPHER_SLUG
/
;;
esp32
)
mv
$cipher
/.pio/build/esp32dev/firmware.
bin
$cipher
/firmware.bin
esp32
)
mv
$cipher
/.pio/build/esp32dev/firmware.
*
$DESTDIR
/
$CIPHER_SLUG
/
;;
esac
rm
-r
$(
find
$cipher
!
-wholename
$cipher
!
-name
"firmware.*"
!
-name
"LWC_AEAD_KAT.txt"
)
esac
done
rm
-rf
"
$TMPDIR
"
}
if
[[
$1
==
"run"
]]
;
then
run
$2
$3
else
ZIP_PATH
=
"
$1
"
if
[[
!
-f
$ZIP_PATH
]]
;
then
echo
"Error: '
$ZIP_PATH
' is not a zip file"
exit
1
fi
MAINDIR
=
email-submissions/
$(
date +%Y-%m-%d-%H:%M
)
mkdir
-p
$MAINDIR
unzip
$
1
-d
all-lwc-submission-files
unzip
$
ZIP_PATH
-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
flock
$MAINDIR
/locky.lock
$0
run
$TEMPLATE
$MAINDIR
/
$TEMPLATE
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