aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/full-test-cycle-wrapper.sh
blob: 6b62d7fc73ae59b54b0dce307c1dc287dfc541b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#!/bin/bash
#
# Full Test Cycle wrapper
#
# Copyright (c) 2017, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
#
# This script is wrapper to create a set of test runs on testo[pia
# for a full QA execution cycle.


#Set variables to be used globally
export CONFIG_FILE='testopia_update.config'
export ACTION='create'
export ENVIRONMENTS=""
export EXECUTION_TYPE=""
export OPTIONAL=""
export TEST_PLAN=""
export IMAGE="core-image-sato-sdk_"

#Go to the main directory of qa-tools
FILEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
QADIR="`echo $FILEDIR | sed 's/scripts//g'`"
cd $QADIR


display_bars(){
   if [ $1 == "START"  ]; then
	echo "|########### CREATING TEST RUNS FOR  - $2 - ############|"
   elif [ $1 == "END"  ]; then
        echo "|----------- TEST RUNS COMPLETED FOR - $2 - -------------"
   fi
}


#Function that creates the Test Runs for specific component
create_test_run(){
   #Check if optional parameters are given
   if [ -z $2  ]; then
      OPT=""
   else
      OPT="-o $2"
   fi

#If point release is used then milestone is not asigned
   if [[ $MILESTONE == M* ]]; then
      BUILD_MILESTONE="$VERSION $MILESTONE"
   else
      BUILD_MILESTONE="$VERSION$MILESTONE"
   fi

   #echo "############ CREATING TEST RUNS FOR - $1 - #############"
   for ENV in "${ENVIRONMENTS[@]}"
   do
     if [[ $2 == "BSP-MAN"  ]]; then
         OPT="-o $IMAGE$ENV"
     fi
     for EXTP in $EXECUTION_TYPE
     do
        #call the script that creates Test Runs
        ./testopia_update.py --config $CONFIG_FILE -a $ACTION -p "${1}" -c $EXTP -b $BRANCH \
        -e "$ENV"  --project-version $VERSION --project-milestone "$BUILD_MILESTONE" \
        --project-date $PJDATE --project-revision $RELEASE-$REVISION $OPT $TEST_PLAN --verbose
     done
   done
   #echo "############ TEST RUNS COMPLETED FOR - $1 - #############"
   #echo "........................................................."

}

create_yocto(){
   #BSP MANUALS
   ENVIRONMENTS=("Genericx86_MMAX32" "Genericx86-64_NUC" "Beaglebone-Black" "EdgeRouter" "MPC8315e-rdb")
   EXECUTION_TYPE="MANUAL"
   create_test_run "${1}" "BSP-MAN"

   #QEMUs Manuals
   ENVIRONMENTS=("qemu-x86" "qemuarm" "qemuarm64" "qemumips" "qemumips64" "qemuppc" "qemux86-64")
   EXECUTION_TYPE="MANUAL"
   create_test_run "${1}" "core-image-sato-sdk_ANYQEMU"

   #QEMUs Autos
   ENVIRONMENTS=("qemu-x86" "qemuarm" "qemuarm64" "qemumips" "qemumips64" "qemuppc" "qemux86-64", "qemux86-64-WIC", "qemux86-WIC")
   EXECUTION_TYPE="AUTO"
   create_test_run "${1}" "core-image-sato-sdk_ANYQEMU"

   #QEMUs Autos LSB
   ENVIRONMENTS=("qemux86-lsb" "qemux86_64-lsb")
   EXECUTION_TYPE="AUTO"
   create_test_run "${1}" "core-image-lsb-sdk_ANYQEMU"

   #BSP Autos
   ENVIRONMENTS=("genericx86 - on MMAX32bit" "genericx86-64 on MMAX64" "genericx86-64 on NUC" "genericx86-64-WIC on MMAX64" \
                "genericx86-64-WIC on NUC" "genericx86-WIC on MMAX32"  "MPC8315e-rdb" "Beaglebone Black" "EdgeRouter")
   EXECUTION_TYPE="AUTO"
   create_test_run "${1}" "core-image-sato-sdk_ANYBSP"

   #BSP Autos
   ENVIRONMENTS=("genericx86-64-lsb on NUC" "genericx86-64-lsb on MMAX64" "genericx86-lsb on MMAX32bit")
   EXECUTION_TYPE="AUTO"
   create_test_run "${1}" "core-image-lsb-sdk_ANYBSP"

}

create_meta-intel(){
   #BSP MANUALS
   ENVIRONMENTS=("core2-32_MMAX32" "corei7-64_NUC")
   EXECUTION_TYPE="MANUAL"
   create_test_run "${1}" "BSP-MAN"

   #BSP Autos
   ENVIRONMENTS=("core2-32_MMAX32" "corei7-64_NUC" "corei7-64_MMAX64" "corei7-64_Joule" \
                "core2-32_WIC_MMAX32" "corei7-64_WIC_NUC" "corei7-64_WIC_MMAX64" "corei7-64_WIC_Joule" \
		"intel-quark_Galileo" "intel-quark_WIC_Galileo" "corei7-64_CherryHill" "corei7-64_WIC_CherryHill")

   EXECUTION_TYPE="AUTO"
   create_test_run "${1}" "core-image-sato-sdk_ANYBSP"

   #BSP Autos LSB
   ENVIRONMENTS=("core2-32_lsb_MMAX32" "corei7-64_lsb_NUC" "corei7-64_lsb_MMAX64" "corei7-64_lsb_CherryHill")

   EXECUTION_TYPE="AUTO"
   create_test_run "${1}" "core-image-lsb-sdk_ANYBSP"
}


#Function that set the environments and execution per component
create_test_cycle(){

    TEST_PLAN=""
    case "$1" in
                "ADT")
		       ENVIRONMENTS=("Fedora 25 i686" "Ubuntu 16.04 x86_64")
		       EXECUTION_TYPE="MANUAL AUTO"
                       create_test_run "${1}"
		       ;;
             "BitBake")
		       ENVIRONMENTS=("Fedora 24 x86_64")
		       EXECUTION_TYPE="MANUAL"
                       create_test_run "${1}"
		       ;;
           "BSP/QEMU")
		       if [ $TYPE == "YOCTO"  ]; then
			  create_yocto $1
		       else
			  create_meta-intel $1
		       fi
		       ;;
              "CROPS")
                       ENVIRONMENTS=("Centos 7.1")
		       EXECUTION_TYPE="AUTO"
		       OPTIONAL="eSDK Poky"
		       for OPT in $OPTIONAL
		        do
			   create_test_run "${1}" $OPT
		        done
		       ;;
     "Eclipse Plugin")
	               ENVIRONMENTS=("Mars on Fedora 22 x86_64", "Neon on Fedora 22 x86_64")
		       EXECUTION_TYPE="MANUAL"
		       create_test_run "${1}"
	               ;;
               "eSDK")
                       ENVIRONMENTS=("Centos 7.1")
		       EXECUTION_TYPE="AUTO"
		       OPTIONAL="oeselftest sdkext"
		       for OPT in $OPTIONAL
		        do
			   create_test_run "${1}" $OPT
		        done
	               ;;
     "General Runtime")
	               ENVIRONMENTS=("VMWare Player on Ubuntu")
		       EXECUTION_TYPE="AUTO"
		       #This case test plan name is diferent from product name
		       TEST_PLAN="--test-plan Runtime"
		       create_test_run "${1}"
		       ;;
             "Kernel")
	               ENVIRONMENTS=("Centos 7")
		       EXECUTION_TYPE="MANUAL"
		       create_test_run "${1}"
		       ;;
         "Meta-yocto")
	               ENVIRONMENTS=("Ubuntu 14.04 x86_64")
		       EXECUTION_TYPE="MANUAL"
		       create_test_run "${1}"
		       ;;
            "OE-Core")
	               ENVIRONMENTS=("CentOS 7.1 x86_64" "Debian 8 x86_64" "Fedora 25 x86_64" "Fedora 24 x86_64" \
			            "OpenSuse 13.2 x86_64" "OpenSuse421 x86_64" "ubuntu 16.04 x86_64" \
				    "Ubuntu 16.10 x86-64")
		       EXECUTION_TYPE="AUTO"
		       create_test_run "${1}"
		       ;;
            "Runtime")
	               ENVIRONMENTS=("user-preference")
		       EXECUTION_TYPE="MANUAL"
		       #This case test plan name is diferen from product name
		       TEST_PLAN="--test-plan Build-Appliance"
		       create_test_run "${1}"
		       ;;
            "Toaster")
	               ENVIRONMENTS=("Debian 4.3.0-0.bpo.1-amd64")
		       EXECUTION_TYPE="MANUAL"
		       OPTIONAL="UI-managed-mode"
		       create_test_run "${1}" $OPTIONAL
		       EXECUTION_TYPE="AUTO"
		       OPTIONAL="UI"
		       create_test_run "${1}" $OPTIONAL
		       ;;
"Package Management Issues")
	               ENVIRONMENTS=("Any Supported Distro")
	               EXECUTION_TYPE="MANUAL"
	               #This case test plan name is diferent from product name
	               TEST_PLAN="--test-plan Package-Management-Updates"
	               create_test_run "${1}"
															                          ;;

  esac
}


usage(){
  echo "Usage: ./full-test-cycle-wrapper.sh [-h] || [ [-b] [-p] [-m] [-r] [-l] [-d] ]"
  echo "Arguments:"
  echo " -h, --help               Show this help message and exit"
  echo " -t TYPE OF CYCLE {YOCTO,META-INTEL}"
  echo "                          Type of test cycle, could be YOCTO or META-INTEL"
  echo " -b BRANCH {master,jethro,dizzy,daisy,noexists}, --branch {master,jethro,dizzy,daisy,noexists}
	                  Branch for create or update."
  echo " -p PROJECT VERSION  {2.2 2.3 2.4}
                          Version of the project."
  echo " -m PROJECT MILESTONE {M1 M2 M3 M4}
                          Milestone of the project.
			  if is point release set milestone with .#
		          .1 .2 .3"
  echo " -r RELEASE COMMIT {XXXXXX}
                          SCM Revision of the project, commit of branch tested."
  echo " -c RELEAE CANDIDATE {rc1 rc2 rcX}
                          Release candidate to be used"
  echo " -d PROJECT DATE {YYY-MM-DD}
                          SCM version/revision date of the project."
  exit
}


if [[ ( $# == "--help") ||  $# == "-h" || $# -eq 0 ]] ; then
    usage
    exit 0
elif [  $# -ne 14 ]; then
    echo "ERROR: missing arguments"
    usage
    exit 1
fi

while getopts ":t:b:p:m:r:c:d:" opt
do
  case $opt in
       t) #Check for specific type of QA cycle
          export TYPE=$OPTARG
          if [ "$TYPE" != "YOCTO" -a  "$TYPE" != "META-INTEL" ]; then
	       echo "ERROR: TYPE (-t) should be YOCTO or META-INTEL"
	       exit 1
	  fi
	  ;;
       b) #Creates Test Run for a exection on master
          export BRANCH=$OPTARG
          ;;
       p) #Project version (ie 2.3)
	  export VERSION=$OPTARG
	  ;;
       m) #Milestone under test
	  export MILESTONE=$OPTARG
	  ;;
       r) #Project revision
          export REVISION=$OPTARG
	  ;;
       c) #Project Release
          export RELEASE=$OPTARG
	  ;;
       d) #Project Date YYYY-MM-DD
	  export PJDATE=$OPTARG
	  ;;
      \?)
	  echo "ERROR: INAVLID OPTION"
          usage
          ;;
  esac
done

#Initialize the environment
virtualenv venv
source venv/bin/activate

## Define components by t ype of test cycle
if [[ $TYPE == "YOCTO" ]]; then
    case $VERSION in
	    "2.1")   COMPONENTS=("ADT" "BitBake" "BSP/QEMU" "Eclipse Plugin" "General Runtime" "Meta-yocto" "OE-Core" "Runtime" "Toaster")
	             ;;
	    "2.2")   COMPONENTS=("ADT" "BitBake" "BSP/QEMU" "Eclipse Plugin" "eSDK" "General Runtime" "Meta-yocto" "OE-Core" "Runtime" "Toaster")
	             ;;
	    "2.3")   COMPONENTS=("ADT" "BitBake" "BSP/QEMU" "CROPS" "Eclipse Plugin" "eSDK" "General Runtime" "Kernel" "Meta-yocto" "OE-Core" "Runtime" "Toaster")
	             ;;
	    "2.4")   COMPONENTS=("ADT" "BitBake" "BSP/QEMU" "CROPS" "Eclipse Plugin" "eSDK" "General Runtime" "Kernel" "Meta-yocto" "OE-Core" "Runtime" "Toaster" "Package Management Issues")
	             ;;
	       \?)
		     echo "ERROR: INAVLID RELEASE VERSION"
		     exit 1
		     ;;
    esac

else
    COMPONENTS=("BSP/QEMU")
fi

#start creting all the test runs for the full release cycle
#per available components

for component in "${COMPONENTS[@]}"
do
  display_bars "START" "${component}"
  create_test_cycle "${component}"
  display_bars "END" "${component}"
done