9 to_display_version
="$6"
13 # retrying until we get offered an update
14 while [ "$try" -le "$max_tries" ]; do
15 echo "Using $update_url"
16 # retrying until AUS gives us any response at all
17 cached_download update.xml
"${update_url}"
19 echo "Got this response:"
21 # If the first line after <updates> is </updates> then we have an
22 # empty snippet. Otherwise we're done
23 if [ "$(grep -A1 '<updates>' update.xml | tail -1)" != "</updates>" ]; then
26 echo "Empty response, sleeping"
33 update_line
=$
(grep -F "<update " update.xml
)
35 if [ 0 -ne $grep_rv ]; then
36 echo "TEST-UNEXPECTED-FAIL: no <update/> found for $update_url"
39 command=$
(echo "$update_line" |
sed -e 's/^.*<update //' -e 's:>.*$::' -e 's:\&:\&:g')
40 eval "export $command"
42 # buildID and some other variables further down are gathered by eval'ing
43 # the massaged `update.xml` file a bit further up. Because of this, shellcheck
44 # cannot verify their existence, and gets grumpy. Ideally we would do this
45 # differently, but it's not worth the trouble at the time of writing.
46 # shellcheck disable=SC2154
47 if [ -n "$to_build_id" ] && [ "$buildID" != "$to_build_id" ]; then
48 echo "TEST-UNEXPECTED-FAIL: expected buildID $to_build_id does not match actual $buildID"
52 # shellcheck disable=SC2154
53 if [ -n "$to_display_version" ] && [ "$displayVersion" != "$to_display_version" ]; then
54 echo "TEST-UNEXPECTED-FAIL: expected displayVersion $to_display_version does not match actual $displayVersion"
58 # shellcheck disable=SC2154
59 if [ -n "$to_app_version" ] && [ "$appVersion" != "$to_app_version" ]; then
60 echo "TEST-UNEXPECTED-FAIL: expected appVersion $to_app_version does not match actual $appVersion"
65 if [ -z "$only" ]; then
66 only
="partial complete"
68 for patch_type
in $only
70 line
=$
(grep -F "patch type=\"$patch_type" update.xml
)
73 if [ 0 -ne $grep_rv ]; then
74 echo "TEST-UNEXPECTED-FAIL: no $patch_type update found for $update_url"
78 command=$
(echo "$line" |
sed -e 's/^.*<patch //' -e 's:/>.*$::' -e 's:\&:\&:g')
79 eval "export $command"
81 if [ "$test_only" == "1" ]
87 if ! cached_download
"update/${patch_type}.mar" "${URL}"; then
88 echo "Could not download $patch_type!"
92 actual_size
=$
(perl
-e "printf \"%d\n\", (stat(\"update/$patch_type.mar\"))[7]")
93 # shellcheck disable=SC2154
94 actual_hash
=$
(openssl dgst
-"$hashFunction" update
/"$patch_type".mar |
sed -e 's/^.*= //')
96 # shellcheck disable=SC2154
97 if [ "$actual_size" != "$size" ]; then
98 echo "TEST-UNEXPECTED-FAIL: $patch_type from $update_url wrong size"
99 # shellcheck disable=SC2154
100 echo "TEST-UNEXPECTED-FAIL: update.xml size: $size"
101 echo "TEST-UNEXPECTED-FAIL: actual size: $actual_size"
105 # shellcheck disable=SC2154
106 if [ "$actual_hash" != "$hashValue" ]; then
107 echo "TEST-UNEXPECTED-FAIL: $patch_type from $update_url wrong hash"
108 # shellcheck disable=SC2154
109 echo "TEST-UNEXPECTED-FAIL: update.xml hash: $hashValue"
110 echo "TEST-UNEXPECTED-FAIL: actual hash: $actual_hash"
114 cp update
/"$patch_type".mar update
/update.mar
115 echo "$actual_size" > update
/"$patch_type".size