| 1 | #!/bin/bash -e |
| 2 | # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*- |
| 3 | |
| 4 | # This Source Code Form is subject to the terms of the Mozilla Public |
| 5 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 | |
| 8 | if [[ -z "$TEST_DIR" ]]; then |
| 9 | cat <<EOF |
| 10 | `basename $0`: error |
| 11 | |
| 12 | TEST_DIR, the location of the Sisyphus framework, |
| 13 | is required to be set prior to calling this script. |
| 14 | EOF |
| 15 | exit 2 |
| 16 | fi |
| 17 | |
| 18 | if [[ ! -e $TEST_DIR/bin/library.sh ]]; then |
| 19 | echo "TEST_DIR=$TEST_DIR" |
| 20 | echo "" |
| 21 | echo "This script requires the Sisyphus testing framework. Please " |
| 22 | echo "cvs check out the Sisyphys framework from mozilla/testing/sisyphus" |
| 23 | echo "and set the environment variable TEST_DIR to the directory where it" |
| 24 | echo "located." |
| 25 | echo "" |
| 26 | |
| 27 | exit 2 |
| 28 | fi |
| 29 | |
| 30 | # |
| 31 | # options processing |
| 32 | # |
| 33 | usage() |
| 34 | { |
| 35 | cat <<EOF |
| 36 | usage: detect-universe.sh -p products -b branches -R repositories -T buildtypes |
| 37 | |
| 38 | Outputs to stdout the universe data for this machine. |
| 39 | |
| 40 | variable description |
| 41 | =============== ============================================================ |
| 42 | -p products required. one or more of firefox, thunderbird, fennec, js |
| 43 | -b branches required. one or more of supported branches. set library.sh |
| 44 | -R repositories required. one or more of CVS, mozilla-central, ... |
| 45 | -T buildtype required. one or more of opt debug |
| 46 | |
| 47 | if an argument contains more than one value, it must be quoted. |
| 48 | EOF |
| 49 | exit 2 |
| 50 | } |
| 51 | |
| 52 | while getopts "p:b:R:T:" optname |
| 53 | do |
| 54 | case $optname in |
| 55 | p) |
| 56 | products=$OPTARG;; |
| 57 | b) |
| 58 | branches=$OPTARG;; |
| 59 | R) |
| 60 | repos=$OPTARG;; |
| 61 | T) |
| 62 | buildtypes=$OPTARG;; |
| 63 | esac |
| 64 | done |
| 65 | |
| 66 | if [[ -z "$products" || -z "$branches" || -z "$buildtypes" ]]; then |
| 67 | usage |
| 68 | fi |
| 69 | |
| 70 | source $TEST_DIR/bin/library.sh |
| 71 | |
| 72 | (for product in $products; do |
| 73 | for branch in $branches; do |
| 74 | for repo in $repos; do |
| 75 | |
| 76 | if [[ ("$branch" != "1.8.0" && "$branch" != "1.8.1" && "$branch" != "1.9.0") && $repo == "CVS" ]]; then |
| 77 | continue; |
| 78 | fi |
| 79 | |
| 80 | if [[ ("$branch" == "1.8.0" || "$branch" == "1.8.1" || "$branch" == "1.9.0") && $repo != "CVS" ]]; then |
| 81 | continue |
| 82 | fi |
| 83 | |
| 84 | for buildtype in $buildtypes; do |
| 85 | if [[ $product == "js" ]]; then |
| 86 | testtype=shell |
| 87 | else |
| 88 | testtype=browser |
| 89 | fi |
| 90 | echo "TEST_OS=$OSID, TEST_KERNEL=$TEST_KERNEL, TEST_PROCESSORTYPE=$TEST_PROCESSORTYPE, TEST_MEMORY=$TEST_MEMORY, TEST_TIMEZONE=$TEST_TIMEZONE, TEST_BRANCH=$branch, TEST_REPO=$repo, TEST_BUILDTYPE=$buildtype, TEST_TYPE=$testtype" |
| 91 | done |
| 92 | done |
| 93 | done |
| 94 | done) | sort -u |