From 5f2804939c6f328c2ff32091883d0f204de0abea Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 18:19:29 +0000 Subject: [PATCH] chore: additional resize by resolution debugging --- .github/workflows/main.yaml | 4 +- .../imageresize/by_resolution/run.sh | 56 +++++++++++-------- test.sh | 8 +-- 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f15ea22..31c73e0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -156,9 +156,9 @@ jobs: run: | ./test.sh image_resize if: success() || failure() - - name: License Plate Detection by Resolution + - name: Image Resize by Resolution run: | - ./test.sh lpd_by_resolution + ./test.sh image_resize_by_resolution if: success() || failure() - name: License Plate Detection by Plate Count run: | diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index ec3fdd8..e3f17bd 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -12,7 +12,7 @@ log="$experiment_directory/log.csv" if [ "$1" != "-d" ]; then SLEDGE_SANDBOX_PERF_LOG=$log PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & - sleep 2 + sleep 3 else echo "Running under gdb" fi @@ -24,31 +24,43 @@ for ((i = 0; i < total_count; i++)); do echo "$i" ext="$RANDOM" - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000 - pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)" - echo "Pixel Differences: $pixel_differences" - if [[ "$pixel_differences" != "0" ]]; then - echo "Small FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + # Small + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000; then + pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" + if [[ "$pixel_differences" != "0" ]]; then + echo "Small FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi + else + echo "curl failed with $?" fi - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001 - pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)" - echo "Pixel Differences: $pixel_differences" - if [[ "$pixel_differences" != "0" ]]; then - echo "Small FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + # Medium + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001; then + pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" + if [[ "$pixel_differences" != "0" ]]; then + echo "Medium FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi + else + echo "curl failed with $?" fi - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002 - pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)" - echo "Pixel Differences: $pixel_differences" - if [[ "$pixel_differences" != "0" ]]; then - echo "Small FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + # Large + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002; then + pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" + if [[ "$pixel_differences" != "0" ]]; then + echo "Large FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi + else + echo "curl failed with $?" fi success_count=$((success_count + 1)) diff --git a/test.sh b/test.sh index 4dc13c2..c4d5f7e 100755 --- a/test.sh +++ b/test.sh @@ -20,7 +20,7 @@ declare -ra tests=( ekf_one_iteration image_classification image_resize - lpd_by_resolution + image_resize_by_resolution lpd_by_plate_count bimodal concurrency @@ -139,13 +139,13 @@ image_resize() { return 0 } -lpd_by_resolution() { - if [[ ! -f "$base_dir/runtime/bin/lpd_wasm.so" ]]; then +image_resize_by_resolution() { + if [[ ! -f "$base_dir/runtime/bin/resize_wasm.so" ]]; then make sod -C "$base_dir/runtime/tests" || exit 1 fi pushd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" || exit 1 ./install.sh || exit 1 - ./run.sh || failed_tests+=("lpd_by_resolution") + ./run.sh || failed_tests+=("image_resize_resolution") popd || exit 1 return 0 }