test-macosx.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #! /bin/bash -xe
  2. set -x -e
  3. echo "running as" $(id)
  4. ####
  5. # Taskcluster friendly wrapper for performing fx Mac OSX tests via mozharness.
  6. ####
  7. # Inputs, with defaults
  8. : MOZHARNESS_URL ${MOZHARNESS_URL}
  9. : MOZHARNESS_SCRIPT ${MOZHARNESS_SCRIPT}
  10. : MOZHARNESS_CONFIG ${MOZHARNESS_CONFIG}
  11. WORKSPACE=$HOME
  12. cd $WORKSPACE
  13. rm -rf artifacts
  14. mkdir artifacts
  15. # test required parameters are supplied
  16. if [[ -z ${MOZHARNESS_URL} ]]; then fail "MOZHARNESS_URL is not set"; fi
  17. if [[ -z ${MOZHARNESS_SCRIPT} ]]; then fail "MOZHARNESS_SCRIPT is not set"; fi
  18. if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi
  19. # Download mozharness with exponential backoff
  20. # curl already applies exponential backoff, but not for all
  21. # failed cases, apparently, as we keep getting failed downloads
  22. # with 404 code.
  23. download_mozharness() {
  24. local max_attempts=10
  25. local timeout=1
  26. local attempt=0
  27. echo "Downloading mozharness"
  28. while [[ $attempt < $max_attempts ]]; do
  29. if curl --fail -o mozharness.zip --retry 10 -L $MOZHARNESS_URL; then
  30. rm -rf mozharness
  31. if unzip -q mozharness.zip; then
  32. return 0
  33. fi
  34. echo "error unzipping mozharness.zip" >&2
  35. else
  36. echo "failed to download mozharness zip" >&2
  37. fi
  38. echo "Download failed, retrying in $timeout seconds..." >&2
  39. sleep $timeout
  40. timeout=$((timeout*2))
  41. attempt=$((attempt+1))
  42. done
  43. fail "Failed to download and unzip mozharness"
  44. }
  45. download_mozharness
  46. rm mozharness.zip
  47. # For telemetry purposes, the build process wants information about the
  48. # source it is running; tc-vcs obscures this a little, but we can provide
  49. # it directly.
  50. export MOZ_SOURCE_REPO="${GECKO_HEAD_REPOSITORY}"
  51. export MOZ_SOURCE_CHANGESET="${GECKO_HEAD_REV}"
  52. # support multiple, space delimited, config files
  53. config_cmds=""
  54. for cfg in $MOZHARNESS_CONFIG; do
  55. config_cmds="${config_cmds} --config-file ${cfg}"
  56. done
  57. rm -rf build logs properties target.dmg
  58. # run the given mozharness script and configs, but pass the rest of the
  59. # arguments in from our own invocation
  60. python2.7 $WORKSPACE/mozharness/scripts/${MOZHARNESS_SCRIPT} ${config_cmds} "${@}"