@@ -1048,6 +1048,16 @@ rollback_on_smoke_error() {
10481048 fi
10491049 exit " ${smoke_status} "
10501050}
1051+ reject_post_activation_smoke () {
1052+ local smoke_status=$1
1053+ if [[ ! " ${smoke_status} " =~ ^[1-9][0-9]* $ ||
1054+ " ${smoke_status} " -gt 255 ]]; then
1055+ printf ' Invalid post-activation smoke status: %s.\n' \
1056+ " ${smoke_status} " >&2
1057+ return 70
1058+ fi
1059+ return " ${smoke_status} "
1060+ }
10511061trap rollback_on_smoke_error ERR
10521062
10531063smoke_root=$( mktemp -d)
@@ -1122,13 +1132,13 @@ for firmware_release in out/firmware/v*; do
11221132 if [[ " ${firmware_path} " == " ${checksum_line} " ]]; then
11231133 printf ' Invalid firmware checksum entry: %s\n' \
11241134 " ${checksum_line} " >&2
1125- exit 67
1135+ reject_post_activation_smoke 67
11261136 fi
11271137 case " ${firmware_path} " in
11281138 " " |/* |* \\ * |* ..* )
11291139 printf ' Unsafe firmware checksum path: %s\n' \
11301140 " ${firmware_path} " >&2
1131- exit 67
1141+ reject_post_activation_smoke 67
11321142 ;;
11331143 esac
11341144 mkdir -p -- " $( dirname -- " ${public_release} /${firmware_path} " ) "
@@ -1154,7 +1164,7 @@ readonly not_found_status=$(
11541164if [[ " ${not_found_status} " != 404 ]]; then
11551165 printf ' Public 404 smoke failed: expected 404, received %s.\n' \
11561166 " ${not_found_status} " >&2
1157- exit 66
1167+ reject_post_activation_smoke 66
11581168fi
11591169
11601170retired_public_asset_paths=(
@@ -1180,7 +1190,7 @@ for retired_public_asset_path in "${retired_public_asset_paths[@]}"; do
11801190 " ${retired_public_asset_method} " \
11811191 " ${retired_public_asset_path} " \
11821192 " ${retired_public_asset_status} " >&2
1183- exit 66
1193+ reject_post_activation_smoke 66
11841194 fi
11851195 retired_public_asset_normalized_headers=" ${retired_public_asset_headers} .normalized"
11861196 tr -d ' \r' < " ${retired_public_asset_headers} " > \
@@ -1190,7 +1200,7 @@ for retired_public_asset_path in "${retired_public_asset_paths[@]}"; do
11901200 printf ' Retired public asset smoke failed for %s %s: Cache-Control is not no-store.\n' \
11911201 " ${retired_public_asset_method} " \
11921202 " ${retired_public_asset_path} " >&2
1193- exit 66
1203+ reject_post_activation_smoke 66
11941204 fi
11951205 done
11961206 retired_public_asset_index=$(( retired_public_asset_index + 1 ))
@@ -1227,7 +1237,7 @@ for firmware_not_found_path in "${firmware_not_found_paths[@]}"; do
12271237 " ${firmware_not_found_method} " \
12281238 " ${firmware_not_found_path} " \
12291239 " ${firmware_not_found_status} " >&2
1230- exit 66
1240+ reject_post_activation_smoke 66
12311241 fi
12321242 firmware_not_found_normalized_headers=" ${firmware_not_found_headers} .normalized"
12331243 tr -d ' \r' < " ${firmware_not_found_headers} " > \
@@ -1237,7 +1247,7 @@ for firmware_not_found_path in "${firmware_not_found_paths[@]}"; do
12371247 printf ' Firmware 404 smoke failed for %s %s: Cache-Control is not no-store.\n' \
12381248 " ${firmware_not_found_method} " \
12391249 " ${firmware_not_found_path} " >&2
1240- exit 66
1250+ reject_post_activation_smoke 66
12411251 fi
12421252 done
12431253 firmware_not_found_index=$(( firmware_not_found_index + 1 ))
0 commit comments