Commit 00c79c4b by lwc-tester

aaaaaaaaaaaaaaa

parent 941d12c9
......@@ -214,7 +214,6 @@ def main(argv):
print()
print()
print("Now execute ' %s ' to start the test" % test_script_path)
if __name__ == "__main__":
......
......@@ -2,6 +2,7 @@
shopt -s extglob
export PYTHONPATH="$PYTHONPATH:$(pwd)"
function run() {
TEMPLATE="$1"
......@@ -31,28 +32,38 @@ function run() {
./compile_all.py -t "templates/$TEMPLATE" -b "$TMPDIR"
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/
mkdir -p "./queues"
QUEUE_PATH="./queues/$TEMPLATE"
TEST_PATH="$DESTDIR/$CIPHER_SLUG"
CIPHER_SLUG=$(basename $cipher)
mkdir -p "$TEST_PATH" || exit 1
mv $cipher/*.log "$TEST_PATH"
mv "$cipher/LWC_AEAD_KAT.txt" "$TEST_PATH"
case $TEMPLATE in
f7) mv $cipher/build/f7.* $DESTDIR/$CIPHER_SLUG/
f7) mv $cipher/build/f7.* "$TEST_PATH"
;;
maixduino) mv $cipher/.pio/build/sipeed-maixduino/firmware.* $DESTDIR/$CIPHER_SLUG/
maixduino) mv $cipher/.pio/build/sipeed-maixduino/firmware.* "$TEST_PATH"
;;
bluepill) mv $cipher/.pio/build/bluepill_f103c8/firmware.* $DESTDIR/$CIPHER_SLUG/
bluepill) mv $cipher/.pio/build/bluepill_f103c8/firmware.* "$TEST_PATH"
;;
uno) mv $cipher/.pio/build/uno/firmware.* $DESTDIR/$CIPHER_SLUG/
uno) mv $cipher/.pio/build/uno/firmware.* "$TEST_PATH"
;;
esp32) mv $cipher/.pio/build/esp32dev/firmware.* $DESTDIR/$CIPHER_SLUG/
esp32) mv $cipher/.pio/build/esp32dev/firmware.* $cipher/.pio/build/esp32dev/partitions.bin "$TEST_PATH"
;;
esac
CMD="PYTHONPATH=\$PYTHONPATH:$(pwd) python3 './templates/$TEMPLATE/test' '$TEST_PATH' > '$TEST_PATH/test.stdout.log' 2> '$TEST_PATH/test.stderr.log'"
printf -v CMD "%q" "$CMD"
flock "$QUEUE_PATH" bash -c "echo $CMD >> \"$QUEUE_PATH\""
done
rm -rf "$TMPDIR"
......@@ -69,13 +80,15 @@ else
MAINDIR=email-submissions/$(date +%Y-%m-%d-%H:%M)
mkdir -p $MAINDIR
unzip $ZIP_PATH -d all-lwc-submission-files
TMPDIR=$(mktemp -d -t submission-XXXXXXXXXX)
unzip $ZIP_PATH -d $TMPDIR
for i in templates/*; do
TEMPLATE="${i##*/}"
echo "Template is $TEMPLATE"
touch $MAINDIR/locky.lock
flock $MAINDIR/locky.lock $0 run $TEMPLATE $MAINDIR/$TEMPLATE
done
rm -rf $TMPDIR
fi
......
......@@ -17,7 +17,7 @@ def get_serial():
devices = [
p.device
for p in ports
if p.serial_number == 'FT2XA9MY'
if p.serial_number == '00000000'
]
devices.sort()
return serial.Serial(
......
#!/usr/bin/env python3
import sys
import time
import fcntl
import subprocess
def file_pop_line(path):
try:
with open(path, 'rt+') as q:
fcntl.lockf(q, fcntl.LOCK_EX)
first = q.readline()
if first == '':
return None
rest = q.read()
q.seek(0)
q.write(rest)
q.truncate()
return first
except FileNotFoundError:
return None
def main(argv):
test_queue = argv[1]
while 1:
cmd = file_pop_line(test_queue).strip()
if cmd is None:
time.sleep(5)
else:
print()
print("Executing %s" % cmd)
p = subprocess.Popen(['bash', '-c', cmd])
p.wait()
print()
print("Return code is %d" % p.returncode)
print()
if __name__ == '__main__':
sys.exit(main(sys.argv))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment