|
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 sys |
|
18 import os |
|
19 import shutil |
|
20 |
|
21 LATEST_GCCE_BIN = os.pardir+os.sep+"tsrc"+os.sep+"bin" |
|
22 LATEST_GCC_BIN = os.pardir+os.sep+"tsrc"+os.sep+"bin" |
|
23 LATEST_RVCT_BIN = os.environ.get('RVCT22BIN') |
|
24 |
|
25 TC_NUM = sys.argv[1] |
|
26 TC_FOLDER = os.getcwd()+os.sep+"TC"+os.sep+TC_NUM |
|
27 SCRIPT_DIR = TC_FOLDER+os.sep+"scripts"+os.sep |
|
28 BBCRESULTS = os.pardir+os.sep+os.pardir+os.sep+"checkbc"+os.sep+"results"+os.sep+"BBCResults.xsl" |
|
29 |
|
30 if len(sys.argv) == 1: |
|
31 print "Usage: latestrun testcase_name" |
|
32 sys.exit() |
|
33 |
|
34 if not os.path.exists(TC_FOLDER): |
|
35 print "Test case directory cannot be found: " + TC_FOLDER |
|
36 sys.exit() |
|
37 |
|
38 if not os.path.exists(SCRIPT_DIR+"prepare.txt"): |
|
39 print "Test case directory cannot be found: " + SCRIPT_DIR + "prepare.txt" |
|
40 sys.exit() |
|
41 |
|
42 file = open( SCRIPT_DIR+"prepare.txt" ) |
|
43 BASENAME = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
44 BASEDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
45 CURRNAME = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
46 CURRDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
47 RESDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
48 TOOLCHAIN = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
49 USELIBS = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
50 BASEDLLDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
51 CURRDLLDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ') |
|
52 file.close() |
|
53 |
|
54 print "Checking test case directories..." |
|
55 basedirlist = BASEDIR.split(';') |
|
56 BASEDIRS = "" |
|
57 for d in basedirlist: |
|
58 if d != "": |
|
59 if not os.path.exists(TC_FOLDER+os.sep+d): |
|
60 print "Cannot find base platform directory: " + TC_FOLDER+os.sep+d |
|
61 sys.exit() |
|
62 if BASEDIRS != "": |
|
63 BASEDIRS = BASEDIRS + ";" |
|
64 BASEDIRS = BASEDIRS+TC_FOLDER+os.sep+d |
|
65 |
|
66 curdirlist = CURRDIR.split(';') |
|
67 CURRDIRS = "" |
|
68 for d in curdirlist: |
|
69 if d != "": |
|
70 if not os.path.exists(TC_FOLDER+os.sep+d): |
|
71 print "Cannot find current platform directory: " + TC_FOLDER+os.sep+d |
|
72 sys.exit() |
|
73 if CURRDIRS != "": |
|
74 CURRDIRS = CURRDIRS + ";" |
|
75 CURRDIRS = CURRDIRS+TC_FOLDER+os.sep+d |
|
76 |
|
77 basedlldirlist = BASEDLLDIR.split(';') |
|
78 BASEDLLDIRS = "" |
|
79 for d in basedlldirlist: |
|
80 if d != "": |
|
81 if not os.path.exists(TC_FOLDER+os.sep+d): |
|
82 BASEDLLDIRS = "" |
|
83 else: |
|
84 if BASEDLLDIRS != "": |
|
85 BASEDLLDIRS = BASEDLLDIRS + ";" |
|
86 BASEDLLDIRS = BASEDLLDIRS+TC_FOLDER+os.sep+d |
|
87 |
|
88 curdlldirlist = CURRDLLDIR.split(';') |
|
89 CURRDLLDIRS = "" |
|
90 for d in curdlldirlist: |
|
91 if d != "": |
|
92 if not os.path.exists(TC_FOLDER+os.sep+d): |
|
93 CURRDLLDIRS = "" |
|
94 else: |
|
95 if CURRDLLDIRS != "": |
|
96 CURRDLLDIRS = CURRDLLDIRS + ";" |
|
97 CURRDLLDIRS = CURRDLLDIRS+TC_FOLDER+os.sep+d |
|
98 |
|
99 if not os.path.exists(TC_FOLDER+os.sep+RESDIR): |
|
100 print "Cannot find result directory: " + TC_FOLDER+os.sep+RESDIR |
|
101 sys.exit() |
|
102 TC_BBCRESULTS = TC_FOLDER+os.sep+RESDIR+os.sep +"BBCResults.xsl" |
|
103 |
|
104 if not os.path.exists( BBCRESULTS): |
|
105 print "Cannot find BBCResults.xsl" |
|
106 else: |
|
107 shutil.copyfile(BBCRESULTS,TC_BBCRESULTS) |
|
108 |
|
109 if TOOLCHAIN == "GCCE": |
|
110 LATEST_TOOLDIR = LATEST_GCCE_BIN |
|
111 elif TOOLCHAIN == "GCC": |
|
112 if os.name == "posix": |
|
113 print "Test case not supported on Linux" |
|
114 sys.exit() |
|
115 LATEST_TOOLDIR = LATEST_GCC_BIN |
|
116 elif TOOLCHAIN == "RVCT": |
|
117 LATEST_TOOLDIR = LATEST_RVCT_BIN |
|
118 else: |
|
119 TOOLCHAIN = "GCCE" |
|
120 LATEST_TOOLDIR ="" |
|
121 |
|
122 print "---- Starting Library Analyser ----" |
|
123 os.chdir(os.pardir+os.sep+"bin") |
|
124 |
|
125 if os.name == "posix": |
|
126 LATEST_CFILT_BIN = os.getcwd()+os.sep+"cfilt" |
|
127 else: |
|
128 LATEST_CFILT_BIN = os.getcwd()+os.sep+"cfilt.exe" |
|
129 |
|
130 lib_command = "" |
|
131 if BASEDIRS != "": |
|
132 lib_command = " -baselinelibdir " + BASEDIRS |
|
133 if CURRDIRS != "": |
|
134 lib_command = lib_command + " -currentlibdir " + CURRDIRS |
|
135 |
|
136 dll_command = "" |
|
137 if BASEDLLDIRS != "": |
|
138 dll_command=" -baselinedlldir " + BASEDLLDIRS; |
|
139 if CURRDLLDIRS != "": |
|
140 dll_command = dll_command + " -currentdlldir " + CURRDLLDIRS |
|
141 |
|
142 RESULTS_DIR = TC_FOLDER + os.sep + RESDIR + os.sep |
|
143 if os.path.exists(RESULTS_DIR+"results.xml"): |
|
144 os.remove(RESULTS_DIR+"results.xml") |
|
145 |
|
146 if LATEST_TOOLDIR == "": |
|
147 cmd=os.getcwd()+os.sep+"la "+TOOLCHAIN+lib_command+dll_command+" -baselineversion \""+BASENAME+"\" -currentversion \""+CURRNAME+"\" -reportfile \""+TC_FOLDER+os.sep+"results"+os.sep+"results.xml\" -temp \""+os.getcwd()+os.sep+"temp\" -set \""+TC_FOLDER+os.sep+"scripts"+os.sep+"config.txt\"" |
|
148 else: |
|
149 cmd=os.getcwd()+os.sep+"la "+TOOLCHAIN+lib_command+dll_command+" -baselineversion \""+BASENAME+"\" -currentversion \""+CURRNAME+"\" -reportfile \""+TC_FOLDER+os.sep+"results"+os.sep+"results.xml\" -tools \""+LATEST_TOOLDIR+"\" -temp \""+os.getcwd()+os.sep+"temp\" -set \""+TC_FOLDER+os.sep+"scripts"+os.sep+"config.txt\"" |
|
150 |
|
151 print cmd |
|
152 if USELIBS == "TRUE": |
|
153 cmd = cmd + " --uselibs" |
|
154 if TOOLCHAIN == "RVCT": |
|
155 cmd = cmd + " -cfilt " + LATEST_CFILT_BIN |
|
156 |
|
157 os.system(cmd) |
|
158 os.chdir(os.pardir+os.sep+"tsrc") |
|
159 sys.exit() |
|
160 |
|
161 |