diff --git a/runtime/experiments/applications/ekf/by_iteration/run.sh b/runtime/experiments/applications/ekf/by_iteration/run.sh index 038d012..381de67 100755 --- a/runtime/experiments/applications/ekf/by_iteration/run.sh +++ b/runtime/experiments/applications/ekf/by_iteration/run.sh @@ -9,6 +9,8 @@ runtime_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$runtime_directory"/bin && pwd) log="$experiment_directory/log.csv" +did_pass=true + # Copy data if not here if [[ ! -f "./initial_state.dat" ]]; then cp $runtime_directory/tests/TinyEKF/extras/c/ekf_raw.dat ./initial_state.dat @@ -31,12 +33,13 @@ for ((i = 0; i < total_count; i++)); do curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@two_iterations_res.dat" localhost:10002 2>/dev/null >./three_iterations_res.dat if diff -s one_iteration_res.dat one_iteration.dat && diff -s two_iterations_res.dat two_iterations.dat && diff -s three_iterations_res.dat three_iterations.dat; then success_count=$((success_count + 1)) + rm *_res.dat else echo "FAIL" - exit + did_pass=false + rm *_res.dat + break fi - - rm *_res.dat done echo "$success_count / $total_count" @@ -47,3 +50,9 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +if $did_pass; then + exit 0 +else + exit 1 +fi diff --git a/runtime/experiments/applications/ekf/one_iteration/run.sh b/runtime/experiments/applications/ekf/one_iteration/run.sh index 0eb5dae..ec4e3cc 100755 --- a/runtime/experiments/applications/ekf/one_iteration/run.sh +++ b/runtime/experiments/applications/ekf/one_iteration/run.sh @@ -7,6 +7,7 @@ experiment_directory=$(pwd) project_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$project_directory"/bin && pwd) +did_pass=true # Copy data if not here if [[ ! -f "./ekf_raw.dat" ]]; then @@ -32,6 +33,8 @@ for ((i = 0; i < total_count; i++)); do success_count=$((success_count + 1)) else echo "FAIL" + did_pass=false + break fi done @@ -43,3 +46,9 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +if $did_pass; then + exit 0 +else + exit 1 +fi diff --git a/runtime/experiments/applications/imageresize/by_resolution/install.sh b/runtime/experiments/applications/imageresize/by_resolution/install.sh new file mode 100755 index 0000000..f1b4de5 --- /dev/null +++ b/runtime/experiments/applications/imageresize/by_resolution/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Installs the deps needed for run.sh +if [ "$(whoami)" == "root" ]; then + apt-get install imagemagick +else + sudo apt-get install imagemagick +fi diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index 6303c73..f55441f 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -28,7 +28,7 @@ for ((i = 0; i < total_count; i++)); do if [[ "$pixel_differences" != "0" ]]; then echo "Small FAIL" echo "$pixel_differences pixel differences detected" - exit + exit 1 fi curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001 2>/dev/null 1>/dev/null @@ -36,7 +36,7 @@ for ((i = 0; i < total_count; i++)); do if [[ "$pixel_differences" != "0" ]]; then echo "Small FAIL" echo "$pixel_differences pixel differences detected" - exit + exit 1 fi curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002 2>/dev/null 1>/dev/null @@ -44,7 +44,7 @@ for ((i = 0; i < total_count; i++)); do if [[ "$pixel_differences" != "0" ]]; then echo "Small FAIL" echo "$pixel_differences pixel differences detected" - exit + exit 1 fi success_count=$((success_count + 1)) @@ -59,3 +59,5 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +exit 0 diff --git a/runtime/experiments/applications/imageresize/test/install.sh b/runtime/experiments/applications/imageresize/test/install.sh new file mode 100755 index 0000000..f1b4de5 --- /dev/null +++ b/runtime/experiments/applications/imageresize/test/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Installs the deps needed for run.sh +if [ "$(whoami)" == "root" ]; then + apt-get install imagemagick +else + sudo apt-get install imagemagick +fi diff --git a/runtime/experiments/applications/imageresize/test/run.sh b/runtime/experiments/applications/imageresize/test/run.sh index ebdee98..a5466d1 100755 --- a/runtime/experiments/applications/imageresize/test/run.sh +++ b/runtime/experiments/applications/imageresize/test/run.sh @@ -35,7 +35,7 @@ for ((i = 0; i < total_count; i++)); do else echo "FAIL" echo "$pixel_differences pixel differences detected" - exit + exit 1 fi done @@ -48,3 +48,5 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +exit 0 diff --git a/runtime/experiments/applications/ocr/by_dpi/install.sh b/runtime/experiments/applications/ocr/by_dpi/install.sh index 5186d30..43f930b 100755 --- a/runtime/experiments/applications/ocr/by_dpi/install.sh +++ b/runtime/experiments/applications/ocr/by_dpi/install.sh @@ -1,4 +1,8 @@ #!/bin/bash # Installs the deps needed for run.sh -sudo apt-get install netpbm pango1.0-tools wamerican +if [ "$(whoami)" == "root" ]; then + apt-get install netpbm pango1.0-tools wamerican +else + sudo apt-get install netpbm pango1.0-tools wamerican +fi diff --git a/runtime/experiments/applications/ocr/by_font/install.sh b/runtime/experiments/applications/ocr/by_font/install.sh index 5186d30..43f930b 100755 --- a/runtime/experiments/applications/ocr/by_font/install.sh +++ b/runtime/experiments/applications/ocr/by_font/install.sh @@ -1,4 +1,8 @@ #!/bin/bash # Installs the deps needed for run.sh -sudo apt-get install netpbm pango1.0-tools wamerican +if [ "$(whoami)" == "root" ]; then + apt-get install netpbm pango1.0-tools wamerican +else + sudo apt-get install netpbm pango1.0-tools wamerican +fi diff --git a/runtime/experiments/applications/ocr/by_word/install.sh b/runtime/experiments/applications/ocr/by_word/install.sh index 5186d30..43f930b 100755 --- a/runtime/experiments/applications/ocr/by_word/install.sh +++ b/runtime/experiments/applications/ocr/by_word/install.sh @@ -1,4 +1,8 @@ #!/bin/bash # Installs the deps needed for run.sh -sudo apt-get install netpbm pango1.0-tools wamerican +if [ "$(whoami)" == "root" ]; then + apt-get install netpbm pango1.0-tools wamerican +else + sudo apt-get install netpbm pango1.0-tools wamerican +fi diff --git a/runtime/experiments/applications/ocr/fivebyeight/run.sh b/runtime/experiments/applications/ocr/fivebyeight/run.sh index 812308d..662178f 100755 --- a/runtime/experiments/applications/ocr/fivebyeight/run.sh +++ b/runtime/experiments/applications/ocr/fivebyeight/run.sh @@ -8,6 +8,8 @@ experiment_directory=$(pwd) project_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$project_directory"/bin && pwd) +did_pass=true + if [ "$1" != "-d" ]; then PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & sleep 1 @@ -33,6 +35,9 @@ for ((i = 0; i < total_count; i++)); do echo "===============================================" echo "Was:" echo "$result" + + did_pass=false + break fi done @@ -44,3 +49,9 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +if $did_pass; then + exit 0 +else + exit 1 +fi diff --git a/runtime/experiments/applications/ocr/handwriting/run.sh b/runtime/experiments/applications/ocr/handwriting/run.sh index ed4ec16..f98d6b7 100755 --- a/runtime/experiments/applications/ocr/handwriting/run.sh +++ b/runtime/experiments/applications/ocr/handwriting/run.sh @@ -8,6 +8,8 @@ experiment_directory=$(pwd) project_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$project_directory"/bin && pwd) +did_pass=true + if [ "$1" != "-d" ]; then PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & sleep 1 @@ -16,7 +18,6 @@ else fi expected_result="$(cat ./expected_result.txt)" - success_count=0 total_count=50 @@ -33,6 +34,8 @@ for ((i = 0; i < total_count; i++)); do echo "===============================================" echo "Was:" echo "$result" + did_pass=false + break fi done @@ -44,3 +47,9 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +if $did_pass; then + exit 0 +else + exit 1 +fi diff --git a/runtime/experiments/applications/ocr/hyde/run.sh b/runtime/experiments/applications/ocr/hyde/run.sh index 2d46d22..c3444cd 100755 --- a/runtime/experiments/applications/ocr/hyde/run.sh +++ b/runtime/experiments/applications/ocr/hyde/run.sh @@ -7,6 +7,7 @@ experiment_directory=$(pwd) project_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$project_directory"/bin && pwd) +did_pass=true if [ "$1" != "-d" ]; then PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & @@ -32,6 +33,8 @@ for ((i = 0; i < total_count; i++)); do echo "===============================================" echo "Was:" echo "$result" + did_pass=false + break fi done @@ -43,3 +46,9 @@ if [ "$1" != "-d" ]; then pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi + +if $did_pass; then + exit 0 +else + exit 1 +fi diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..2ec3e34 --- /dev/null +++ b/test.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Test Driver Script + +# Awsm +cd awsm && cargo build --release && cd .. + +# Sledge +cd runtime && make clean all && cd .. + +# OCR Build +# FIXME: gocr incorectly reports up to date +cd runtime/tests && make -B clean gocr && cd ../.. + +# OCR Tests +cd runtime/experiments/applications/ocr/hyde && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/ocr/handwriting && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/ocr/fivebyeight && ./run.sh && cd ../../../../.. + +# FIXME: Install scripts will only work after on Ubuntu 20 LTS +# cd runtime/experiments/applications/ocr/by_word && ./install.sh && cd ../../../../.. +# cd runtime/experiments/applications/ocr/by_word && ./run.sh && cd ../../../../.. + +# cd runtime/experiments/applications/ocr/by_font && ./install.sh && cd ../../../../.. +# cd runtime/experiments/applications/ocr/by_font && ./run.sh && cd ../../../../.. + +# cd runtime/experiments/applications/ocr/by_dpi && ./install.sh && cd ../../../../.. +# cd runtime/experiments/applications/ocr/by_dpi && ./run.sh && cd ../../../../.. + +# EKF Build +cd runtime/tests && make -B clean tinyekf && cd ../.. + +# EKF Tests +cd runtime/experiments/applications/ekf/by_iteration && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/ekf/one_iteration && ./run.sh && cd ../../../../.. + +# cifar10 Build +cd runtime/tests && make -B clean cifar10 && cd ../.. + +# cifar10 Tests +cd runtime/experiments/applications/imageclassification && ./run.sh && cd ../../../.. + +# sod Build +cd runtime/tests && make -B clean sod && cd ../.. + +# sod Tests +cd runtime/experiments/applications/imageresize/test && ./install.sh && cd ../../../../.. +cd runtime/experiments/applications/imageresize/test && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/imageresize/by_resolution && ./install.sh && cd ../../../../.. +cd runtime/experiments/applications/imageresize/by_resolution && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/licenseplace/1 && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/licenseplace/2 && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/licenseplace/4 && ./run.sh && cd ../../../../.. +cd runtime/experiments/applications/licenseplace && ./run.sh && cd ../../../..