|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 import subprocess |
|
18 import os |
|
19 import re |
|
20 import sys |
|
21 import shutil |
|
22 from xml.dom import minidom |
|
23 |
|
24 |
|
25 if os.name == 'nt': |
|
26 path = os.path.dirname(sys.argv[0]) |
|
27 else: |
|
28 path = os.getcwd() |
|
29 |
|
30 TC_DIR = path |
|
31 CHECKBC = "python " + "\""+ TC_DIR + os.sep + os.pardir + os.sep + "CheckBC.py" +"\"" |
|
32 DEFAULT_TEMP = TC_DIR + os.sep + os.pardir + os.sep + "temp" |
|
33 |
|
34 #will create a seperate process for invoking checkbc with given parameters |
|
35 def runTest(args): |
|
36 return subprocess.call(CHECKBC + args, shell=True) |
|
37 |
|
38 def comment(list, updatepairs): |
|
39 ip = open( TC_DIR + os.sep + 'config_template', 'r') |
|
40 op = open( TC_DIR + os.sep + 'temp' + os.sep + 'config', 'w') |
|
41 for line in ip: |
|
42 if line[0] == '#': |
|
43 continue |
|
44 line = line.strip(' \t\n\r') |
|
45 pair = line.split('=') |
|
46 if updatepairs.has_key(pair[0]): |
|
47 line = pair[0] + '=' + updatepairs[pair[0]] |
|
48 if pair[0] not in list: |
|
49 op.write(line) |
|
50 op.write('\n') |
|
51 ip.close() |
|
52 op.close() |
|
53 |
|
54 def failUnless(res, exp_res): |
|
55 if res == exp_res: |
|
56 return True |
|
57 else: |
|
58 return False |
|
59 |
|
60 def checklists(list1,list2): |
|
61 for val in list1: |
|
62 if not val in list2: |
|
63 return False |
|
64 return True |
|
65 |
|
66 def checkreports(tag): |
|
67 expectedreport=TC_DIR + os.sep + 'testdata' + os.sep + 'expected_results' + os.sep + tag + '.xml' |
|
68 actualreport=TC_DIR + os.sep + 'temp' + os.sep + 'results' + os.sep + tag + '.xml' |
|
69 if not os.path.exists(actualreport): |
|
70 return False |
|
71 |
|
72 expdoc=minidom.parse(expectedreport) |
|
73 actdoc=minidom.parse(actualreport) |
|
74 expparent=expdoc.documentElement |
|
75 actparent=actdoc.documentElement |
|
76 |
|
77 expparms=expparent.getElementsByTagName("parm") |
|
78 actparms=actparent.getElementsByTagName("parm") |
|
79 |
|
80 expparmslen=expparms.length |
|
81 actparmslen=actparms.length |
|
82 |
|
83 if expparmslen!=actparmslen: |
|
84 return False |
|
85 |
|
86 for expparm in expparms: |
|
87 exparg=expparm.getElementsByTagName("pname")[0].firstChild.nodeValue |
|
88 expargval="" |
|
89 if expparm.getElementsByTagName("pvalue")[0].firstChild: |
|
90 expargval=expparm.getElementsByTagName("pvalue")[0].firstChild.nodeValue |
|
91 |
|
92 found=False |
|
93 for actparm in actparms: |
|
94 actarg=actparm.getElementsByTagName("pname")[0].firstChild.nodeValue |
|
95 actargval="" |
|
96 if actparm.getElementsByTagName("pvalue")[0].firstChild: |
|
97 actargval=actparm.getElementsByTagName("pvalue")[0].firstChild.nodeValue |
|
98 if exparg==actarg: |
|
99 if exparg in "baselineversion currentversion bundlesize recursive replace excludedirs toolchain".split(): |
|
100 if expargval == actargval: |
|
101 found=True |
|
102 break |
|
103 |
|
104 if exparg in "baseplatformdata currentplatformdata".split(): |
|
105 expargval=expargval[ expargval.index(os.sep+'data') : len(expargval) ] |
|
106 actargval=actargval[ actargval.index(os.sep+'data') : len(actargval) ] |
|
107 if expargval == actargval: |
|
108 found=True |
|
109 break |
|
110 |
|
111 if exparg == 'cfilt': |
|
112 if expargval.rfind(os.sep+'bin') != -1: |
|
113 expargval=expargval[ expargval.index(os.sep+'bin') : len(expargval) ] |
|
114 actargval=actargval[ actargval.index(os.sep+'bin') : len(actargval) ] |
|
115 if expargval == actargval: |
|
116 found=True |
|
117 break |
|
118 |
|
119 if exparg in "forcebaseinclude forcecurrentinclude".split(): |
|
120 list1=expargval.split(';') |
|
121 list2=actargval.split(';') |
|
122 if len(list1) == len(list2): |
|
123 for i in range(0,len(list1)): |
|
124 list1[i]=list1[i][ list1[i].index(os.sep+'bin') : len(list1[i]) ] |
|
125 list2[i]=list2[i][ list2[i].index(os.sep+'bin') : len(list2[i]) ] |
|
126 found=checklists(list1,list2) |
|
127 break |
|
128 |
|
129 if exparg in "baselinedir currentdir baselinelibdir currentlibdir baselinedlldir currentdlldir baseplatformheaders currentplatformheaders reportfile".split(): |
|
130 list1=expargval.split(';') |
|
131 list2=actargval.split(';') |
|
132 if len(list1) == len(list2): |
|
133 for i in range(0,len(list1)): |
|
134 if list1[i].find(os.sep+'tsrc') != -1: |
|
135 list1[i]=list1[i][ list1[i].index(os.sep+'tsrc') : len(list1[i]) ] |
|
136 list2[i]=list2[i][ list2[i].index(os.sep+'tsrc') : len(list2[i]) ] |
|
137 else: |
|
138 list1[i]=list1[i][ list1[i].index(os.sep+'data') : len(list1[i]) ] |
|
139 list2[i]=list2[i][ list2[i].index(os.sep+'data') : len(list2[i]) ] |
|
140 found=checklists(list1,list2) |
|
141 break |
|
142 |
|
143 if exparg in "baselinedlldir currentdlldir reportfile".split(): |
|
144 list1=expargval.split(';') |
|
145 list2=actargval.split(';') |
|
146 if len(list1) == len(list2): |
|
147 if actargval.find('.xml') != -1 and expargval.find('.xml') != -1: |
|
148 found = True |
|
149 break |
|
150 |
|
151 for i in range(0,len(list1)): |
|
152 list1[i]=list1[i][ list1[i].index(os.sep+'tsrc') : len(list1[i]) ] |
|
153 list2[i]=list2[i][ list2[i].index(os.sep+'tsrc') : len(list2[i]) ] |
|
154 found=checklists(list1,list2) |
|
155 |
|
156 break |
|
157 |
|
158 if exparg == 'set': |
|
159 if expparent.getElementsByTagName("haversion").length > 0: |
|
160 if expargval == actargval: |
|
161 found=True |
|
162 break |
|
163 if expparent.getElementsByTagName("laversion").length > 0: |
|
164 if expargval.rfind(os.sep) != -1: |
|
165 expargval=expargval[ expargval.rindex(os.sep) : len(expargval) ] |
|
166 actargval=actargval[ actargval.rindex(os.sep) : len(actargval) ] |
|
167 if expargval == actargval: |
|
168 found=True |
|
169 break |
|
170 |
|
171 if actarg == 'commandfile': |
|
172 if expargval.rfind(os.sep) != -1: |
|
173 expargval=expargval[ expargval.rindex(os.sep) : len(expargval) ] |
|
174 actargval=actargval[ actargval.rindex(os.sep) : len(actargval) ] |
|
175 if expargval == actargval: |
|
176 found=True |
|
177 break |
|
178 |
|
179 if exparg in "tools temp".split(): |
|
180 found=True |
|
181 break |
|
182 |
|
183 if not found: |
|
184 return False |
|
185 |
|
186 return True |
|
187 |
|
188 #print checkreports('headers_test_17') |
|
189 #print child |
|
190 |
|
191 |
|
192 #Test without passing any parameters, procees should return 1 on exit |
|
193 def test_00(): |
|
194 print "Executing test: test_00" |
|
195 str = 'FAILED' |
|
196 args = "" |
|
197 res = repr(runTest(args)) |
|
198 if failUnless(res, '3'): |
|
199 str = 'PASSED' |
|
200 return tuple(['3', res, str]) |
|
201 |
|
202 #Test passing help parameters, procees should return 1 on exit |
|
203 def test_01(): |
|
204 print "Executing test: test_01" |
|
205 str = 'FAILED' |
|
206 args = " -h" |
|
207 res = repr(runTest(args)) |
|
208 if failUnless(res, '8'): |
|
209 str = 'PASSED' |
|
210 return tuple(['8', res, str]) |
|
211 |
|
212 #Test tool version parameter, process should return 1 on exit |
|
213 def test_02(): |
|
214 print "Executing test: test_02" |
|
215 str = 'FAILED' |
|
216 v = re.compile('[1-9]+[.][0-9]+[.][0-9]+[ ][-][ ]([12]?[0-9]+|30|31)(nd|st|th|rd)[ ](January|February|March|April|May|June|July|August|September|October|November|December)[ ](2008|2009|2010)') |
|
217 res = '' |
|
218 args = " -v > test_02.txt" |
|
219 runTest(args) |
|
220 f = open('test_02.txt') |
|
221 for line in f: |
|
222 res = line |
|
223 if re.match( v, line): |
|
224 str = 'PASSED' |
|
225 print line |
|
226 f.close() |
|
227 os.remove('test_02.txt') |
|
228 return tuple(['format : xx.yy.zz - dd month yyyy', res, str]) |
|
229 |
|
230 #Test data version parameter, process should return 1 on exit |
|
231 def test_03(): |
|
232 print "Executing test: test_03" |
|
233 str = 'FAILED' |
|
234 res = '' |
|
235 args = " -dv > test_03.txt" |
|
236 runTest(args) |
|
237 f = open('test_03.txt') |
|
238 for line in f: |
|
239 try: |
|
240 res = int(line) |
|
241 except ValueError: |
|
242 pass |
|
243 else: |
|
244 if ( 0 < res <= 9 ): |
|
245 str = 'PASSED' |
|
246 f.close() |
|
247 os.remove('test_03.txt') |
|
248 return tuple(['integer value 0-9', repr(res), str]) |
|
249 |
|
250 #Test wrong parameters, process should return 3 on exit |
|
251 def test_04(): |
|
252 print "Executing test: test_04" |
|
253 str = 'FAILED' |
|
254 args = " report.xml temp/config -j -d file -b" |
|
255 res = repr(runTest(args)) |
|
256 if failUnless(res, '3'): |
|
257 str = 'PASSED' |
|
258 return tuple(['3', res, str]) |
|
259 |
|
260 #Test passing both header&libary analysis input |
|
261 def test_05(): |
|
262 print "Executing test: test_05" |
|
263 str = 'FAILED' |
|
264 cmt = ['BASELINE_HEADERS', 'CURRENT_HEADERS', 'EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
265 comment(cmt, {}) |
|
266 args = " temp/config -ha -la -f test_05" |
|
267 res = repr(runTest(args)) |
|
268 if failUnless(res, '0'): |
|
269 if checkreports('headers_test_05') and checkreports('libraries_test_05'): |
|
270 str = 'PASSED' |
|
271 return tuple(['0', res, str]) |
|
272 |
|
273 #Test execution for all headers only |
|
274 def test_06(): |
|
275 print "Executing test: test_06" |
|
276 str = 'FAILED' |
|
277 cmt = ['REPLACE_HEADERS' ] |
|
278 comment(cmt, {'EXCLUDE_DIR_HEADERS':''}) |
|
279 args = " temp/config -ha test_06" |
|
280 res = repr(runTest(args)) |
|
281 if failUnless(res, '0'): |
|
282 if checkreports('headers_test_06'): |
|
283 str = 'PASSED' |
|
284 return tuple(['0', res, str]) |
|
285 |
|
286 #Test executiion for all libraries only |
|
287 def test_07(): |
|
288 print "Executing test: test_07" |
|
289 str = 'FAILED' |
|
290 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
291 comment(cmt, {}) |
|
292 args = " temp/config -la test_07" |
|
293 res = repr(runTest(args)) |
|
294 if failUnless(res, '0'): |
|
295 if checkreports('libraries_test_07'): |
|
296 str = 'PASSED' |
|
297 return tuple(['0', res, str]) |
|
298 |
|
299 #Test execution for all headers & filter |
|
300 def test_08(): |
|
301 print "Executing test: test_08" |
|
302 str = 'FAILED' |
|
303 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
304 comment(cmt, {}) |
|
305 args = " temp/config -ha -f test_08" |
|
306 res = repr(runTest(args)) |
|
307 if failUnless(res, '0'): |
|
308 if checkreports('headers_test_08'): |
|
309 str = 'PASSED' |
|
310 return tuple(['0', res, str]) |
|
311 |
|
312 #Test execution for all libraries & filter |
|
313 def test_09(): |
|
314 print "Executing test: test_09" |
|
315 str = 'FAILED' |
|
316 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
317 comment(cmt, {}) |
|
318 args = " temp/config -la -f test_09" |
|
319 res = repr(runTest(args)) |
|
320 if failUnless(res, '0'): |
|
321 if checkreports('libraries_test_09'): |
|
322 str = 'PASSED' |
|
323 return tuple(['0', res, str]) |
|
324 |
|
325 #Test execution for only filtering |
|
326 def test_10(): |
|
327 print "Executing test: test_10" |
|
328 str = 'FAILED' |
|
329 shutil.copy(os.getcwd()+'/testdata/SAReport_test_10.xml',os.getcwd()+'/testdata/SAReport_test_10.xml.bak') |
|
330 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
331 comment(cmt, {}) |
|
332 args = " temp/config -f test_10" |
|
333 res = repr(runTest(args)) |
|
334 shutil.move(os.getcwd()+'/testdata/SAReport_test_10.xml.bak',os.getcwd()+'/testdata/SAReport_test_10.xml') |
|
335 if failUnless(res, '0'): |
|
336 str = 'PASSED' |
|
337 return tuple(['0', res, str]) |
|
338 |
|
339 #Test execution for multiple header analysis followed by filtering |
|
340 def test_11(): |
|
341 print "Executing test: test_11" |
|
342 str = 'FAILED' |
|
343 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
344 comment(cmt, {}) |
|
345 args = " temp/config -hm tsrc/testdata/headers.txt -f test_11" |
|
346 res = repr(runTest(args)) |
|
347 if failUnless(res, '0'): |
|
348 if checkreports('headers_test_11'): |
|
349 str = 'PASSED' |
|
350 return tuple(['0', res, str]) |
|
351 |
|
352 #Test execution for multiple library analysis followed by filtering |
|
353 def test_12(): |
|
354 print "Executing test: test_12" |
|
355 str = 'FAILED' |
|
356 cmt = ['EXCLUDE_DIR_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS' ] |
|
357 comment(cmt, {}) |
|
358 args = " temp/config -lm tsrc/testdata/libraries.txt -f test_12" |
|
359 res = repr(runTest(args)) |
|
360 if failUnless(res, '0'): |
|
361 if checkreports('libraries_test_12'): |
|
362 str = 'PASSED' |
|
363 return tuple(['0', res, str]) |
|
364 |
|
365 #Test execution combining both multiple header and library analysis |
|
366 def test_13(): |
|
367 print "Executing test: test_13" |
|
368 str = 'FAILED' |
|
369 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
370 comment(cmt, {}) |
|
371 args = " temp/config -lm tsrc/testdata/libraries.txt -hm tsrc/testdata/headers.txt -f test_13" |
|
372 res = repr(runTest(args)) |
|
373 if failUnless(res, '0'): |
|
374 if checkreports('libraries_test_13') and checkreports('headers_test_13'): |
|
375 str = 'PASSED' |
|
376 return tuple(['0', res, str]) |
|
377 |
|
378 #Test execution for single header and single library analysis followed by filtering |
|
379 def test_14(): |
|
380 print "Executing test: test_14" |
|
381 str = 'FAILED' |
|
382 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
383 comment(cmt, {}) |
|
384 args = " temp/config -hs e32notif.h -ls agentdialog.dso -f test_14" |
|
385 res = repr(runTest(args)) |
|
386 if failUnless(res, '0'): |
|
387 if checkreports('headers_test_14') and checkreports('libraries_test_14'): |
|
388 str = 'PASSED' |
|
389 return tuple(['0', res, str]) |
|
390 |
|
391 #Test execution for single header analysis followed by filtering |
|
392 def test_15(): |
|
393 print "Executing test: test_15" |
|
394 str = 'FAILED' |
|
395 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
396 comment(cmt, {}) |
|
397 args = " temp/config -hs bitbase.h -f test_15" |
|
398 res = repr(runTest(args)) |
|
399 if failUnless(res, '0'): |
|
400 if checkreports('headers_test_15'): |
|
401 str = 'PASSED' |
|
402 return tuple(['0', res, str]) |
|
403 |
|
404 #Test execution for single library analysis followed by filtering |
|
405 def test_16(): |
|
406 print "Executing test: test_16" |
|
407 str = 'FAILED' |
|
408 cmt = ['REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'EXCLUDE_DIR_HEADERS' ] |
|
409 comment(cmt, {}) |
|
410 args = " temp/config -ls cafutils.dso -f test_16" |
|
411 res = repr(runTest(args)) |
|
412 if failUnless(res, '0'): |
|
413 if checkreports('libraries_test_16'): |
|
414 str = 'PASSED' |
|
415 return tuple(['0', res, str]) |
|
416 |
|
417 #Test replace headers parameters |
|
418 def test_17(): |
|
419 print "Executing test: test_17" |
|
420 str = 'FAILED' |
|
421 cmt = ['EXCLUDE_DIR_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
422 comment(cmt, {'REPLACE_HEADERS':'myheaderbase.h:myheadera.h'}) |
|
423 args = " temp/config -hs myheaderbase.h -f test_17" |
|
424 res = repr(runTest(args)) |
|
425 if failUnless(res, '0'): |
|
426 if checkreports('headers_test_17'): |
|
427 str = 'PASSED' |
|
428 return tuple(['0', res, str]) |
|
429 |
|
430 #Test Exclude directories |
|
431 def test_18(): |
|
432 print "Executing test: test_18" |
|
433 str = 'FAILED' |
|
434 cmt = ['REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
435 comment(cmt, {}) |
|
436 args = " temp/config -hs caf/agent.h -f test_18" |
|
437 res = repr(runTest(args)) |
|
438 if failUnless(res, '0'): |
|
439 if checkreports('headers_test_18'): |
|
440 str = 'PASSED' |
|
441 return tuple(['0', res, str]) |
|
442 |
|
443 #Test default Toolchain |
|
444 def test_19(): |
|
445 print "Executing test: test_19" |
|
446 str = 'FAILED' |
|
447 cmt = ['TOOLCHAIN', 'EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'FILTER_FILE_HEADERS', 'REPORT_FILE_HEADERS' ] |
|
448 comment(cmt, {}) |
|
449 args = " temp/config -ls bitgdi.dso -f test_19" |
|
450 res = repr(runTest(args)) |
|
451 if failUnless(res, '0'): |
|
452 if checkreports('libraries_test_19'): |
|
453 str = 'PASSED' |
|
454 return tuple(['0', res, str]) |
|
455 |
|
456 #Test armv5 toolchain |
|
457 def test_20(): |
|
458 print "Executing test: test_20" |
|
459 str = 'FAILED' |
|
460 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
461 comment(cmt, {'TOOLCHAIN':'rvct', 'TOOLCHAIN_PATH':os.environ.get('RVCT22BIN')}) |
|
462 args = " temp/config -ls audioequalizerutility.dso -f test_20" |
|
463 res = repr(runTest(args)) |
|
464 if failUnless(res, '0'): |
|
465 if checkreports('libraries_test_20'): |
|
466 str = 'PASSED' |
|
467 return tuple(['0', res, str]) |
|
468 |
|
469 #Test without toochain path |
|
470 def test_21(): |
|
471 print "Executing test: test_21" |
|
472 str = 'FAILED' |
|
473 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
474 if os.name == 'nt': |
|
475 comment(cmt, {'TOOLCHAIN_PATH':''}) |
|
476 else: |
|
477 print "Testcase currently not valid for Linux\n" |
|
478 args = " temp/config -ls c32.dso -f test_21" |
|
479 res = repr(runTest(args)) |
|
480 if failUnless(res, '0'): |
|
481 if checkreports('libraries_test_21'): |
|
482 str = 'PASSED' |
|
483 return tuple(['0', res, str]) |
|
484 |
|
485 #Test without platform data |
|
486 def test_22(): |
|
487 print "Executing test: test_22" |
|
488 str = 'FAILED' |
|
489 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
490 comment(cmt, {'USE_PLATFORM_DATA':'false'}) |
|
491 args = " temp/config -hs s32strm.h -f test_22" |
|
492 res = repr(runTest(args)) |
|
493 if failUnless(res, '0'): |
|
494 if checkreports('headers_test_22'): |
|
495 str = 'PASSED' |
|
496 return tuple(['0', res, str]) |
|
497 |
|
498 #Test carbide plugin options |
|
499 def test_23(): |
|
500 print "Executing test: test_23" |
|
501 str = 'FAILED' |
|
502 res = 'PID value in integer' |
|
503 terms = [] |
|
504 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
505 comment(cmt, {}) |
|
506 args = " temp/config -c -hs e32notif.h -ls caleninterimutils.dso -f test_23 > test_23.txt" |
|
507 runTest(args) |
|
508 f = open('test_23.txt') |
|
509 for line in f: |
|
510 print line |
|
511 if line.find('PID:') != -1: |
|
512 terms = line.split(':') |
|
513 try: |
|
514 val = int(terms[1]) |
|
515 except ValueError: |
|
516 res = 'not integer' |
|
517 str = 'FAILED' |
|
518 break |
|
519 else: |
|
520 if (0 < val <= 100000): |
|
521 str = 'PASSED' |
|
522 f.close() |
|
523 os.remove('test_23.txt') |
|
524 return tuple(['integer 1-100000', res, str]) |
|
525 |
|
526 #Test execution without passing config file |
|
527 def test_24(): |
|
528 print "Executing test: test_24" |
|
529 str = 'FAILED' |
|
530 args = " -ha -la -f test_24" |
|
531 res = repr(runTest(args)) |
|
532 if failUnless(res, '3'): |
|
533 str = 'PASSED' |
|
534 return tuple(['3', res, str]) |
|
535 |
|
536 #Test execution without passing report-id |
|
537 def test_25(): |
|
538 print "Executing test: test_25" |
|
539 str = 'FAILED' |
|
540 cmt = ['REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS' ] |
|
541 comment(cmt, {}) |
|
542 args = " temp/config -hs e32notif.h -ls aknnotify.dso -f test_25" |
|
543 res = repr(runTest(args)) |
|
544 if failUnless(res, '0'): |
|
545 if checkreports('headers_test_25') and checkreports('libraries_test_25'): |
|
546 str = 'PASSED' |
|
547 return tuple(['0', res, str]) |
|
548 |
|
549 #Test execution for recursive headers |
|
550 def test_26(): |
|
551 print "Executing test: test_26" |
|
552 str = 'FAILED' |
|
553 cmt = ['RECURSIVE_HEADERS', 'EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
554 comment(cmt, {}) |
|
555 args = " temp/config -hs e32notif.h test_26" |
|
556 res=repr(runTest(args)) |
|
557 if failUnless(res, '0'): |
|
558 if checkreports('headers_test_26'): |
|
559 str = 'PASSED' |
|
560 return tuple(['0', res, str]) |
|
561 |
|
562 #Test execution for only filtering without issue file specified in config |
|
563 def test_27(): |
|
564 print "Executing test: test_27" |
|
565 str = 'FAILED' |
|
566 shutil.copy(os.getcwd()+'/testdata/SAReport_test_10.xml',os.getcwd()+'/testdata/SAReport_test_10.xml.bak') |
|
567 cmt = ['ISSUES_FILE', 'EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_LIBRARIES', 'FILTER_FILE_LIBRARIES' ] |
|
568 comment(cmt, {}) |
|
569 args = " temp/config -f test_10" |
|
570 res = repr(runTest(args)) |
|
571 shutil.move(os.getcwd()+'/testdata/SAReport_test_10.xml.bak',os.getcwd()+'/testdata/SAReport_test_10.xml') |
|
572 if failUnless(res, '0'): |
|
573 str = 'PASSED' |
|
574 return tuple(['0', res, str]) |
|
575 |
|
576 #Test execution without passing the temp parameter |
|
577 def test_28(): |
|
578 print "Executing test: test_28" |
|
579 str = 'FAILED' |
|
580 cmt = ['TEMP', 'EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER' ] |
|
581 comment(cmt, {}) |
|
582 args = " temp/config -hs e32notif.h -ls agentdialog.dso test_28" |
|
583 res = repr(runTest(args)) |
|
584 if failUnless(res, '0'): |
|
585 if checkreports('headers_test_28') and checkreports('libraries_test_28'): |
|
586 str = 'PASSED' |
|
587 shutil.rmtree(DEFAULT_TEMP) |
|
588 return tuple(['0', res, str]) |
|
589 |
|
590 #Test execution to check baseline_sdk_dir and current_sdk_dir mandatory. |
|
591 def test_29(): |
|
592 print "Executing test: test_29" |
|
593 str = 'FAILED' |
|
594 cmt = ['TEMP','BASELINE_SDK_DIR', 'CURRENT_SDK_DIR'] |
|
595 comment(cmt, {}) |
|
596 args = " temp/config -hs e32notif.h -ls agentdialog.dso test_29" |
|
597 res = repr(runTest(args)) |
|
598 if failUnless(res, '6'): |
|
599 str = 'PASSED' |
|
600 shutil.rmtree(DEFAULT_TEMP) |
|
601 return tuple(['0', res, str]) |
|
602 |
|
603 #Test execution for relative path in baseline headers |
|
604 def test_30(): |
|
605 print "Executing test: test_30" |
|
606 str = 'FAILED' |
|
607 cmt = ['REPLACE_HEADERS' ] |
|
608 comment(cmt, {'BASELINE_HEADERS':'ecom'}) |
|
609 args = " temp/config -ha test_30" |
|
610 res = repr(runTest(args)) |
|
611 if failUnless(res, '0'): |
|
612 if checkreports('headers_test_30'): |
|
613 str = 'PASSED' |
|
614 return tuple(['0', res, str]) |
|
615 |
|
616 #Test execution to check for dependency between import library and dll |
|
617 def test_31(): |
|
618 print "Executing test: test_31" |
|
619 str = 'FAILED' |
|
620 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER','BASELINE_IMPORTDLLS' ] |
|
621 comment(cmt, {}) |
|
622 args = " temp/config -la -f test_31" |
|
623 res = repr(runTest(args)) |
|
624 if failUnless(res, '6'): |
|
625 str = 'PASSED' |
|
626 return tuple(['0', res, str]) |
|
627 |
|
628 #Test execution only with default sdk, not import library and dll |
|
629 def test_32(): |
|
630 print "Executing test: test_32" |
|
631 str = 'FAILED' |
|
632 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER','BASELINE_IMPORTLIBRARIES', |
|
633 'CURRENT_IMPORTLIBRARIES','BASELINE_IMPORTDLLS','CURRENT_IMPORTDLLS'] |
|
634 comment(cmt, {}) |
|
635 args = " temp/config -la test_32" |
|
636 res = repr(runTest(args)) |
|
637 if failUnless(res, '0'): |
|
638 if checkreports('libraries_test_32'): |
|
639 str = 'PASSED' |
|
640 return tuple(['0', res, str]) |
|
641 |
|
642 #Test execution with import library and dll |
|
643 def test_33(): |
|
644 print "Executing test: test_33" |
|
645 str = 'FAILED' |
|
646 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER'] |
|
647 comment(cmt, {}) |
|
648 args = " temp/config -la test_33" |
|
649 res = repr(runTest(args)) |
|
650 if failUnless(res, '0'): |
|
651 if checkreports('libraries_test_33'): |
|
652 str = 'PASSED' |
|
653 return tuple(['0', res, str]) |
|
654 |
|
655 #Test execution with multiple build target |
|
656 def test_34(): |
|
657 print "Executing test: test_34" |
|
658 str = 'FAILED' |
|
659 cmt = ['EXCLUDE_DIR_HEADERS', 'REPLACE_HEADERS', 'REPORT_FILE_HEADERS', 'FILTER_FILE_HEADERS', 'REPORT_FILE_FILTER', 'OUTPUT_FILE_FILTER','BASELINE_IMPORTLIBRARIES', |
|
660 'CURRENT_IMPORTLIBRARIES','BASELINE_IMPORTDLLS','CURRENT_IMPORTDLLS'] |
|
661 comment(cmt, {'BASELINE_BUILDTARGET':'ARMv5;ARMv6', 'CURRENT_BUILDTARGET':'ARMv5;ARMv6'}) |
|
662 args = " temp/config -la test_34" |
|
663 res = repr(runTest(args)) |
|
664 if failUnless(res, '0'): |
|
665 if checkreports('libraries_test_34'): |
|
666 str = 'PASSED' |
|
667 return tuple(['0', res, str]) |