test: Do not fail imageresize on curl non 0 exit status

main
Sean McBride 4 years ago
parent 5f2804939c
commit 69c82ead61

@ -25,7 +25,7 @@ for ((i = 0; i < total_count; i++)); do
ext="$RANDOM" ext="$RANDOM"
# Small # 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)" pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)"
echo "Pixel Differences: $pixel_differences" echo "Pixel Differences: $pixel_differences"
if [[ "$pixel_differences" != "0" ]]; then if [[ "$pixel_differences" != "0" ]]; then
@ -34,11 +34,11 @@ for ((i = 0; i < total_count; i++)); do
exit 1 exit 1
fi fi
else else
echo "curl failed with $?" echo "curl failed with ${?}. See man curl for meaning."
fi fi
# Medium # 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)" pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)"
echo "Pixel Differences: $pixel_differences" echo "Pixel Differences: $pixel_differences"
if [[ "$pixel_differences" != "0" ]]; then if [[ "$pixel_differences" != "0" ]]; then
@ -47,11 +47,11 @@ for ((i = 0; i < total_count; i++)); do
exit 1 exit 1
fi fi
else else
echo "curl failed with $?" echo "curl failed with ${?}. See man curl for meaning."
fi fi
# Large # 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)" pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)"
echo "Pixel Differences: $pixel_differences" echo "Pixel Differences: $pixel_differences"
if [[ "$pixel_differences" != "0" ]]; then if [[ "$pixel_differences" != "0" ]]; then
@ -60,7 +60,7 @@ for ((i = 0; i < total_count; i++)); do
exit 1 exit 1
fi fi
else else
echo "curl failed with $?" echo "curl failed with ${?}. See man curl for meaning."
fi fi
success_count=$((success_count + 1)) success_count=$((success_count + 1))

@ -16,7 +16,7 @@ fi
if [ "$1" != "-d" ]; then if [ "$1" != "-d" ]; then
PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" &
sleep 2 sleep 3
else else
echo "Running under gdb" echo "Running under gdb"
fi fi
@ -27,7 +27,8 @@ 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 || exit 1
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
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)"
@ -38,6 +39,9 @@ for ((i = 0; i < total_count; i++)); do
echo "$pixel_differences pixel differences detected" echo "$pixel_differences pixel differences detected"
exit 1 exit 1
fi fi
else
echo "curl failed with ${?}. See man curl for meaning."
fi
done done
echo "$success_count / $total_count" echo "$success_count / $total_count"

Loading…
Cancel
Save