test: Improve test runner

main
Sean McBride 4 years ago
parent 41ca2f802e
commit 2bdbb62902

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
runtime_directory=$(cd ../../../.. && pwd) runtime_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$runtime_directory"/bin && pwd) binary_directory=$(cd "$runtime_directory"/bin && pwd)
log="$experiment_directory/log.csv" log="$experiment_directory/log.csv"

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
did_pass=true did_pass=true

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../.. && pwd) project_directory=$(cd ../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
log="$experiment_directory/log.csv" log="$experiment_directory/log.csv"

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
@ -26,7 +27,7 @@ total_count=10
for ((i = 0; i < total_count; i++)); do for ((i = 0; i < total_count; i++)); do
echo "$i" echo "$i"
ext="$RANDOM" ext="$RANDOM"
curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@flower.jpg" --output "result_$ext.png" localhost:10000 2>/dev/null 1>/dev/null curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@flower.jpg" --output "result_$ext.png" localhost:10000 2>/dev/null 1>/dev/null || exit 1
pixel_differences="$(compare -identify -metric AE "result_$ext.png" expected_result.png null: 2>&1 >/dev/null)" pixel_differences="$(compare -identify -metric AE "result_$ext.png" expected_result.png null: 2>&1 >/dev/null)"

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
log="$experiment_directory/log.csv" log="$experiment_directory/log.csv"

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
log="$experiment_directory/log.csv" log="$experiment_directory/log.csv"

@ -2,7 +2,7 @@
# Installs the deps needed for run.sh # Installs the deps needed for run.sh
if [ "$(whoami)" == "root" ]; then if [ "$(whoami)" == "root" ]; then
apt-get install netpbm pango1.0-tools wamerican apt-get install netpbm pango1.0-tools wamerican fonts-roboto fonts-cascadia-code fonts-dejavu
else else
sudo apt-get install netpbm pango1.0-tools wamerican sudo apt-get install netpbm pango1.0-tools wamerican fonts-roboto fonts-cascadia-code fonts-dejavu
fi fi

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
log="$experiment_directory/log.csv" log="$experiment_directory/log.csv"
@ -17,8 +18,8 @@ else
fi fi
word_count=100 word_count=100
fonts=("mono" "URW Gothic" "Lobster Two") fonts=("DejaVu Sans Mono" "Roboto" "Cascadia Code")
total_count=100 total_count=10
for ((i = 1; i <= total_count; i++)); do for ((i = 1; i <= total_count; i++)); do
echo "Test $i" echo "Test $i"
@ -27,25 +28,25 @@ for ((i = 1; i <= total_count; i++)); do
for font in "${fonts[@]}"; do for font in "${fonts[@]}"; do
# For whatever reason, templating in multiple word strips was a pain, so brute forcing # For whatever reason, templating in multiple word strips was a pain, so brute forcing
case "$font" in case "$font" in
"mono") "DejaVu Sans Mono")
echo "Mono" echo "DejaVu Sans Mono"
pango-view --font="mono" -qo mono_words.png -t "$words" pango-view --font="DejaVu Sans Mono" -qo mono_words.png -t "$words" || exit 1
pngtopnm mono_words.png >mono_words.pnm pngtopnm mono_words.png >mono_words.pnm || exit 1
result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @mono_words.pnm localhost:10000 2>/dev/null) result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @mono_words.pnm localhost:10000 2>/dev/null)
diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result")
;; ;;
"URW Gothic") "Roboto")
echo "URW Gothic" echo "Roboto"
pango-view --font="URW Gothic" -qo URW_Gothic_words.png -t "$words" pango-view --font="Roboto" -qo Roboto_words.png -t "$words" || exit 1
pngtopnm URW_Gothic_words.png >URW_Gothic_words.pnm pngtopnm Roboto_words.png >Roboto_words.pnm || exit 1
result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @URW_Gothic_words.pnm localhost:10002 2>/dev/null) result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Roboto_words.pnm localhost:10002 2>/dev/null)
diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result")
;; ;;
"Lobster Two") "Cascadia Code")
echo "Lobster Two" echo "Cascadia Code"
pango-view --font="Lobster Two" -qo Lobster_Two_words.png -t "$words" pango-view --font="Cascadia Code" -qo Cascadia_Code_words.png -t "$words" || exit 1
pngtopnm Lobster_Two_words.png >Lobster_Two_words.pnm pngtopnm Cascadia_Code_words.png >Cascadia_Code_words.pnm || exit 1
result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Lobster_Two_words.pnm localhost:10001 2>/dev/null) result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @Cascadia_Code_words.pnm localhost:10001 2>/dev/null)
diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result")
;; ;;
esac esac

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
log="$experiment_directory/log.csv" log="$experiment_directory/log.csv"
@ -31,8 +32,8 @@ for ((i = 0; i < total_count; i++)); do
for word_count in "${word_counts[@]}"; do for word_count in "${word_counts[@]}"; do
echo "${word_count}"_words.pnm echo "${word_count}"_words.pnm
words="$(shuf -n"$word_count" /usr/share/dict/american-english)" words="$(shuf -n"$word_count" /usr/share/dict/american-english)"
pango-view --font=mono -qo "$word_count"_words.png -t "$words" pango-view --font=mono -qo "$word_count"_words.png -t "$words" || exit 1
pngtopnm "$word_count"_words.png >"$word_count"_words.pnm pngtopnm "$word_count"_words.png >"$word_count"_words.pnm || exit 1
result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @"${word_count}"_words.pnm localhost:${word_count_to_port["$word_count"_words.pnm]} 2>/dev/null) result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @"${word_count}"_words.pnm localhost:${word_count_to_port["$word_count"_words.pnm]} 2>/dev/null)

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)

@ -5,6 +5,7 @@
# Also disables pagination and stopping on SIGUSR1 # Also disables pagination and stopping on SIGUSR1
experiment_directory=$(pwd) experiment_directory=$(pwd)
echo "$experiment_directory"
project_directory=$(cd ../../../.. && pwd) project_directory=$(cd ../../../.. && pwd)
binary_directory=$(cd "$project_directory"/bin && pwd) binary_directory=$(cd "$project_directory"/bin && pwd)
did_pass=true did_pass=true

@ -1,53 +1,54 @@
#!/bin/bash #!/bin/bash
# Test Driver Script # Test Driver Script
if [[ $0 != "./test.sh" ]]; then
echo "Must run in same directory as ./test.sh"
exit 1
fi
base_dir=$(pwd)
# Awsm # Awsm
cd awsm && cargo build --release && cd .. cd "$base_dir/awsm" && cargo build --release || exit 1
# Sledge # Sledge
cd runtime && make clean all && cd .. cd "$base_dir/runtime" && make clean all || exit 1
# OCR Build # OCR Build
# FIXME: gocr incorectly reports up to date # FIXME: gocr incorectly reports up to date
cd runtime/tests && make -B clean gocr && cd ../.. cd "$base_dir/runtime/tests" && make -B clean gocr || exit 1
# OCR Tests # OCR Tests
cd runtime/experiments/applications/ocr/hyde && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ocr/hyde" && ./run.sh || exit 1
cd runtime/experiments/applications/ocr/handwriting && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ocr/handwriting" && ./run.sh || exit 1
cd runtime/experiments/applications/ocr/fivebyeight && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ocr/fivebyeight" && ./run.sh || exit 1
cd "$base_dir/runtime/experiments/applications/ocr/by_word" && ./install.sh || exit 1
# FIXME: Install scripts will only work after on Ubuntu 20 LTS cd "$base_dir/runtime/experiments/applications/ocr/by_word" && ./run.sh || exit 1
# cd runtime/experiments/applications/ocr/by_word && ./install.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ocr/by_font" && ./install.sh || exit 1
# cd runtime/experiments/applications/ocr/by_word && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ocr/by_font" && ./run.sh || exit 1
cd "$base_dir/runtime/experiments/applications/ocr/by_dpi" && ./install.sh || exit 1
# cd runtime/experiments/applications/ocr/by_font && ./install.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ocr/by_dpi" && ./run.sh || exit 1
# 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 # EKF Build
cd runtime/tests && make -B clean tinyekf && cd ../.. cd "$base_dir/runtime/tests" && make -B clean tinyekf || exit 1
# EKF Tests # EKF Tests
cd runtime/experiments/applications/ekf/by_iteration && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ekf/by_iteration" && ./run.sh || exit 1
cd runtime/experiments/applications/ekf/one_iteration && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/ekf/one_iteration" && ./run.sh || exit 1
# cifar10 Build # cifar10 Build
cd runtime/tests && make -B clean cifar10 && cd ../.. cd "$base_dir/runtime/tests" && make -B clean cifar10 || exit 1
# cifar10 Tests # cifar10 Tests
cd runtime/experiments/applications/imageclassification && ./run.sh && cd ../../../.. cd "$base_dir/runtime/experiments/applications/imageclassification" && ./run.sh || exit 1
# sod Build # sod Build
cd runtime/tests && make -B clean sod && cd ../.. cd "$base_dir/runtime/tests" && make -B clean sod || exit 1
# sod Tests # sod Tests
cd runtime/experiments/applications/imageresize/test && ./install.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/imageresize/test" && ./install.sh || exit 1
cd runtime/experiments/applications/imageresize/test && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/imageresize/test" && ./run.sh || exit 1
cd runtime/experiments/applications/imageresize/by_resolution && ./install.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" && ./install.sh || exit 1
cd runtime/experiments/applications/imageresize/by_resolution && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" && ./run.sh || exit 1
cd runtime/experiments/applications/licenseplace/1 && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/licenseplate/by_plate_count" && ./run.sh || exit 1
cd runtime/experiments/applications/licenseplace/2 && ./run.sh && cd ../../../../.. cd "$base_dir/runtime/experiments/applications/licenseplate" && ./run.sh || exit 1
cd runtime/experiments/applications/licenseplace/4 && ./run.sh && cd ../../../../..
cd runtime/experiments/applications/licenseplace && ./run.sh && cd ../../../..

Loading…
Cancel
Save