From 69c82ead61a117b2c20c25850f9a32ed4da64c0f Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 18:34:12 +0000 Subject: [PATCH] test: Do not fail imageresize on curl non 0 exit status --- .../imageresize/by_resolution/run.sh | 12 +++++------ .../applications/imageresize/test/run.sh | 20 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index e3f17bd..3bfa988 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -25,7 +25,7 @@ for ((i = 0; i < total_count; i++)); do ext="$RANDOM" # Small - if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000; then + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000 2> /dev/null 1> /dev/null; 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 @@ -34,11 +34,11 @@ for ((i = 0; i < total_count; i++)); do exit 1 fi else - echo "curl failed with $?" + echo "curl failed with ${?}. See man curl for meaning." fi # Medium - if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001; then + if 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; 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 @@ -47,11 +47,11 @@ for ((i = 0; i < total_count; i++)); do exit 1 fi else - echo "curl failed with $?" + echo "curl failed with ${?}. See man curl for meaning." fi # Large - if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002; then + if 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; 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 @@ -60,7 +60,7 @@ for ((i = 0; i < total_count; i++)); do exit 1 fi else - echo "curl failed with $?" + echo "curl failed with ${?}. See man curl for meaning." fi success_count=$((success_count + 1)) diff --git a/runtime/experiments/applications/imageresize/test/run.sh b/runtime/experiments/applications/imageresize/test/run.sh index be2390f..4fab433 100755 --- a/runtime/experiments/applications/imageresize/test/run.sh +++ b/runtime/experiments/applications/imageresize/test/run.sh @@ -16,7 +16,7 @@ fi if [ "$1" != "-d" ]; then 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 @@ -27,16 +27,20 @@ total_count=10 for ((i = 0; i < total_count; i++)); do echo "$i" 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 || exit 1 - pixel_differences="$(compare -identify -metric AE "result_$ext.png" expected_result.png null: 2>&1 > /dev/null)" + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@flower.jpg" --output "result_$ext.png" localhost:10000 2> /dev/null 1> /dev/null; then - if [[ "$pixel_differences" == "0" ]]; then - success_count=$((success_count + 1)) + pixel_differences="$(compare -identify -metric AE "result_$ext.png" expected_result.png null: 2>&1 > /dev/null)" + + if [[ "$pixel_differences" == "0" ]]; then + success_count=$((success_count + 1)) + else + echo "FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi else - echo "FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + echo "curl failed with ${?}. See man curl for meaning." fi done