-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_JenkinsSGEJobStatusUpdate.sh
executable file
·229 lines (186 loc) · 6.31 KB
/
run_JenkinsSGEJobStatusUpdate.sh
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
#!/bin/bash
#**************************************************************************************
#
# Usage:
# run_JenkinsSGEJobStatusUpdate.sh ${TestProfile}
#
# brief:
# update jobs status.
# if all jobs have been cpmpleted, get test summary and back up test data
#
# date: 2015/06/18
#**************************************************************************************
runUsage()
{
echo ""
echo " Usage: run_JenkinsSGEJobStatusUpdate.sh \${TestProfile}"
echo ""
echo " e.g.: "
echo " run_JenkinsSGEJobStatusUpdate.sh SCC "
echo " run_JenkinsSGEJobStatusUpdate.sh SVC "
echo ""
}
runInital()
{
CurrentDir=`pwd`
SGEJobsTestSpace="${CurrentDir}"
JenkinsHomeDir="/Users/jenkins"
AttachmentsFolder="Openh264-SGETest/Jenkins-Job-Status-Check-Log"
AttachmentsDir="${JenkinsHomeDir}/${AttachmentsFolder}"
CaseConfigureFileDir="CaseConfigure"
CaseConfigureFile="${CaseConfigureFileDir}/case_${TestProfile}.cfg"
#CaseConfigureFile="CaseConfigure/case_for_linux_fast_test.cfg"
FinalTestReportDir="FinalTestReport"
FinalResultDir="FinalResult"
SGEIPInfoFile="${CurrentDir}/Tools/SGE.cfg"
JobFailedFlagFile="FailedJobInfo.txt"
JobFailedFlag="False"
#log file for attachments
SGEJobSubmittedLog="SGEJobsSubmittedInfo.log"
SGEJobsStatusLog="${TestProfile}_SGEJobStatus.txt"
SGEJobsReportLog="${TestProfile}_JobReport.txt"
AllTestSummary="AllTestYUVsSummary.txt"
SGEJobsAllTestSummary="${TestProfile}_AllTestYUVsSummary.txt"
AllCasesAllYUVsResultReportConsole="${TestProfile}_AllCasesAllYUVsResultReportConsole.txt"
AllJobsCompletedFlagFile="AllSGEJobsCompleted.flag"
AllTestResultPassFlag="AllCasesPass.flag"
CodecInfoLog="CodecInfo.log"
SucceedJobsInfo="SucceedJobsDetailInfo.txt"
FailedJobsInfo="FailedJobsDetailInfo.txt"
UnRunCasesJobsInfo="UnRunCasesJobsDetailInfo.txt"
UnknownReasonJobsInfo="UnknownReasonJobsDetailInfo.txt"
}
runOutputBasicInfo()
{
echo ""
echo ""
echo "*****************************************************************************"
echo "*****************************************************************************"
echo " SGE jobs status for ${TestProfile}"
echo "*****************************************************************************"
echo "*****************************************************************************"
echo ""
echo " CurrentDir is ${CurrentDir} "
echo ""
}
runUpdateScript()
{
git branch
git remote -v
git fetch origin
git checkout master
git pull origin master
}
runUpdateJobStatus()
{
./run_SGEJobStatusUpdate.sh ${SGEJobSubmittedLog} ${AllJobsCompletedFlagFile}>${SGEJobsStatusLog}
echo ""
echo "*****************************************************************************"
echo " jobs status ---- ${TestProfile}"
echo "*****************************************************************************"
echo ""
cat ${SGEJobsStatusLog}
echo "*****************************************************************************"
echo ""
}
runGetAllCompletedJobReport()
{
echo ""
echo "*****************************************************************************"
echo " test reports list for completed jobs list as below:---${TestProfile}"
echo "*****************************************************************************"
echo ""
echo >${SGEJobsReportLog}
for file in ${SGEJobsTestSpace}/${FinalResultDir}/TestReport*
do
echo file is $file
if [ -e ${file} ]
then
echo "report file: ${file}">>${SGEJobsReportLog}
cat ${file} >>${SGEJobsReportLog}
fi
done
cat ${SGEJobsReportLog}
echo "*****************************************************************************"
echo ""
}
runGetSummary()
{
#get summary
if [ -e ${AllJobsCompletedFlagFile} ]
then
echo ""
echo "*****************************************************************************"
echo " Final SGE test summary for all jobs(for all YUVs)----${TestProfile}"
echo "*****************************************************************************"
echo ""
./run_GetAllTestResult.sh SGETest ${CaseConfigureFile} ${AllTestResultPassFlag} >${AllCasesAllYUVsResultReportConsole}
cat ${SGEJobsTestSpace}/${FinalTestReportDir}/${AllTestSummary}
cp ${SGEJobsTestSpace}/${FinalTestReportDir}/${AllTestSummary} ${AttachmentsDir}/${SGEJobsAllTestSummary}
fi
}
runCopyFilesToAchiveDir()
{
cd ${CurrentDir}
cp ${SGEJobsStatusLog} ${AttachmentsDir}
cp ${SGEJobsReportLog} ${AttachmentsDir}
echo "****************************************"
echo "AttachmentsDir is ${AttachmentsDir}"
echo "****************************************"
if [ -e ${SGEJobSubmittedLog} ]
then
cp ${SGEJobSubmittedLog} ${AttachmentsDir}/${TestProfile}_${SGEJobSubmittedLog}
fi
if [ -e ${CodecInfoLog} ]
then
cp ${CodecInfoLog} ${AttachmentsDir}/${TestProfile}_${CodecInfoLog}
fi
if [ -e ${CaseConfigureFile} ]
then
cp ${CaseConfigureFile} ${AttachmentsDir}
fi
if [ -e ${SGEIPInfoFile} ]
then
cp ${SGEIPInfoFile} ${AttachmentsDir}/SGEIPInfo.txt
fi
if [ -e ${SucceedJobsInfo} ]
then
cp ${SucceedJobsInfo} ${AttachmentsDir}/${TestProfile}_${SucceedJobsInfo}
fi
if [ -e ${FailedJobsInfo} ]
then
cp ${FailedJobsInfo} ${AttachmentsDir}/${TestProfile}_${FailedJobsInfo}
fi
if [ -e ${UnRunCasesJobsInfo} ]
then
cp ${UnRunCasesJobsInfo} ${AttachmentsDir}/${TestProfile}_${UnRunCasesJobsInfo}
fi
if [ -e ${UnknownReasonJobsInfo} ]
then
cp ${UnknownReasonJobsInfo} ${AttachmentsDir}/${TestProfile}_${UnknownReasonJobsInfo}
fi
}
runMain()
{
runInital
runOutputBasicInfo
#runUpdateScript
runUpdateJobStatus
runGetAllCompletedJobReport
runGetSummary
runCopyFilesToAchiveDir
}
if [ ! $# -eq 1 ]
then
runUsage
exit 1
fi
TestProfile=$1
echo ""
echo "*********************************************************"
echo " call bash file is $0"
echo " input parameters is:"
echo " $0 $@"
echo "*********************************************************"
echo ""
runMain ${TestProfile}