test: Complete ekf test

main
Sean McBride 4 years ago
parent 1bf4bc5a82
commit 66dd582fc5

@ -1,3 +1,9 @@
# EKF # EKF
TODO Executes TinyEKF as shows by [You Chong's GPS example](http://www.mathworks.com/matlabcentral/fileexchange/31487-extended-kalman-filter-ekf--for-gps)
In order to be compatible with the stdin/stdout model of serverless, the input and output files are binary concatenations of various C structs.
See `main()` in `runtime/tests/TinyEKF/extras/c/gps_ekf_fn.c` for specifics.
This test executes multiple iterations, comparing the binary result against a known memoized result stored at `expected_result.dat`.

@ -20,34 +20,18 @@ else
echo "Running under gdb" echo "Running under gdb"
fi fi
# expected_result="$(cat ./expected_result.jpg)" expected_result="$(tr -d '\0' <./expected_result.dat)"
# expected_size="$(find expected_result.jpg -printf "%s")"
success_count=0 success_count=0
total_count=50 total_count=50
curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@ekf_raw.dat" --output "result.dat" localhost:10000
# ab -c 1 -n 10000 -p ekf_raw.dat -T "application/octet-stream"
# WIP
exit
for ((i = 0; i < total_count; i++)); do for ((i = 0; i < total_count; i++)); do
echo "$i" echo "$i"
ext="$RANDOM" result="$(curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@ekf_raw.dat" localhost:10000 2>/dev/null | tr -d '\0')"
curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@flower.jpg" --output "result_$ext.jpg" localhost:10000 2>/dev/null if [[ "$expected_result" == "$result" ]]; then
actual_size="$(find result_"$ext".jpg -printf "%s")"
# echo "$result"
if [[ "$expected_size" == "$actual_size" ]]; then
success_count=$((success_count + 1)) success_count=$((success_count + 1))
rm result.jpg
else else
echo "FAIL" echo "FAIL"
echo "Expected Size:"
echo "$expected_size"
echo "==============================================="
echo "Actual Size:"
echo "$actual_size"
fi fi
done done
@ -56,7 +40,6 @@ echo "$success_count / $total_count"
if [ "$1" != "-d" ]; then if [ "$1" != "-d" ]; then
sleep 5 sleep 5
echo -n "Running Cleanup: " echo -n "Running Cleanup: "
rm result_*.jpg
pkill sledgert >/dev/null 2>/dev/null pkill sledgert >/dev/null 2>/dev/null
echo "[DONE]" echo "[DONE]"
fi fi

Loading…
Cancel
Save