testing/release/updates/verify.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/release/updates/verify.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,150 @@
     1.4 +#!/bin/bash
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +#set -x
    1.10 +
    1.11 +. ../common/unpack.sh 
    1.12 +. ../common/download_mars.sh
    1.13 +. ../common/download_builds.sh
    1.14 +. ../common/check_updates.sh
    1.15 +
    1.16 +ftp_server="http://stage.mozilla.org/pub/mozilla.org"
    1.17 +aus_server="https://aus2.mozilla.org"
    1.18 +
    1.19 +runmode=0
    1.20 +config_file="updates.cfg"
    1.21 +UPDATE_ONLY=1
    1.22 +TEST_ONLY=2
    1.23 +MARS_ONLY=3
    1.24 +COMPLETE=4
    1.25 +
    1.26 +usage()
    1.27 +{
    1.28 +  echo "Usage: verify.sh [OPTION] [CONFIG_FILE]"
    1.29 +  echo "    -u, --update-only      only download update.xml"
    1.30 +  echo "    -t, --test-only        only test that MARs exist"
    1.31 +  echo "    -m, --mars-only        only test MARs"
    1.32 +  echo "    -c, --complete         complete upgrade test"
    1.33 +}
    1.34 +
    1.35 +if [ -z "$*" ]
    1.36 +then
    1.37 +  usage
    1.38 +  exit 0
    1.39 +fi
    1.40 +
    1.41 +pass_arg_count=0
    1.42 +while [ "$#" -gt "$pass_arg_count" ]
    1.43 +do
    1.44 +  case "$1" in
    1.45 +    -u | --update-only)
    1.46 +      runmode=$UPDATE_ONLY
    1.47 +      shift
    1.48 +      ;;
    1.49 +    -t | --test-only)
    1.50 +      runmode=$TEST_ONLY
    1.51 +      shift
    1.52 +      ;;
    1.53 +    -m | --mars-only)
    1.54 +      runmode=$MARS_ONLY
    1.55 +      shift
    1.56 +      ;;
    1.57 +    -c | --complete)
    1.58 +      runmode=$COMPLETE
    1.59 +      shift
    1.60 +      ;;
    1.61 +    *)
    1.62 +      # Move the unrecognized arg to the end of the list
    1.63 +      arg="$1"
    1.64 +      shift
    1.65 +      set -- "$@" "$arg"
    1.66 +      pass_arg_count=`expr $pass_arg_count + 1`
    1.67 +  esac
    1.68 +done
    1.69 +
    1.70 +if [ -n "$arg" ]
    1.71 +then
    1.72 +  config_file=$arg
    1.73 +  echo "Using config file $config_file"
    1.74 +else
    1.75 +  echo "Using default config file $config_file"
    1.76 +fi
    1.77 +
    1.78 +if [ "$runmode" == "0" ]
    1.79 +then
    1.80 +  usage
    1.81 +  exit 0
    1.82 +fi
    1.83 +
    1.84 +while read entry
    1.85 +do
    1.86 +  # initialize all config variables
    1.87 +  release="" 
    1.88 +  product="" 
    1.89 +  platform="" 
    1.90 +  build_id="" 
    1.91 +  locales=""
    1.92 +  channel=""
    1.93 +  from=""
    1.94 +  to=""
    1.95 +  eval $entry
    1.96 +  for locale in $locales
    1.97 +  do
    1.98 +    for patch_type in partial complete
    1.99 +    do
   1.100 +      if [ "$runmode" == "$MARS_ONLY" ] || [ "$runmode" == "$COMPLETE" ] ||
   1.101 +         [ "$runmode" == "$TEST_ONLY" ]
   1.102 +      then
   1.103 +        if [ "$runmode" == "$TEST_ONLY" ]
   1.104 +        then
   1.105 +          download_mars "${aus_server}/update/1/$product/$release/$build_id/$platform/$locale/$channel/update.xml" $patch_type 1
   1.106 +          err=$?
   1.107 +        else
   1.108 +          download_mars "${aus_server}/update/1/$product/$release/$build_id/$platform/$locale/$channel/update.xml" $patch_type
   1.109 +          err=$?
   1.110 +        fi
   1.111 +        if [ "$err" != "0" ]; then
   1.112 +          echo "FAIL: download_mars returned non-zero exit code: $err"
   1.113 +          continue
   1.114 +        fi
   1.115 +      else
   1.116 +        update_path="$product/$release/$build_id/$platform/$locale/$channel"
   1.117 +        mkdir -p updates/$update_path/complete
   1.118 +        mkdir -p updates/$update_path/partial
   1.119 +        wget --no-check-certificate -q -O $patch_type updates/$update_path/$patch_type/update.xml "${aus_server}/update/1/$update_path/update.xml"
   1.120 +
   1.121 +      fi
   1.122 +      if [ "$runmode" == "$COMPLETE" ]
   1.123 +      then
   1.124 +        if [ -z "$from" ] || [ -z "$to" ]
   1.125 +        then
   1.126 +          continue
   1.127 +        fi
   1.128 +        from_path=`echo $from | sed "s/%locale%/${locale}/"`
   1.129 +        to_path=`echo $to | sed "s/%locale%/${locale}/"`
   1.130 +        download_builds "${ftp_server}/${from_path}" "${ftp_server}/${to_path}"
   1.131 +        err=$?
   1.132 +        if [ "$err" != "0" ]; then
   1.133 +          echo "FAIL: download_builds returned non-zero exit code: $err"
   1.134 +          continue
   1.135 +        fi
   1.136 +        source_file=`basename "$from_path"`
   1.137 +        target_file=`basename "$to_path"`
   1.138 +        check_updates "$platform" "downloads/$source_file" "downloads/$target_file" $locale
   1.139 +        err=$?
   1.140 +        if [ "$err" == "0" ]; then
   1.141 +          continue
   1.142 +        elif [ "$err" == "1" ]; then
   1.143 +          echo "FAIL: check_updates returned failure for $platform downloads/$source_file vs. downloads/$target_file: $err"
   1.144 +        elif [ "$err" == "2" ]; then
   1.145 +          echo "WARN: check_updates returned warning for $platform downloads/$source_file vs. downloads/$target_file: $err"
   1.146 +        else
   1.147 +          echo "FAIL: check_updates returned unknown error for $platform downloads/$source_file vs. downloads/$target_file: $err"
   1.148 +        fi
   1.149 +      fi
   1.150 +    done
   1.151 +  done
   1.152 +done < $config_file
   1.153 +

mercurial