|
12
|
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 |
TC_NUM = sys.argv[1]
|
|
|
22 |
TC_FOLDER = os.getcwd()+os.sep+"TC"+os.sep+TC_NUM
|
|
|
23 |
SCRIPT_DIR = TC_FOLDER+os.sep+"scripts"+os.sep
|
|
|
24 |
RESULTS_DIR = TC_FOLDER+os.sep+"results"+os.sep
|
|
|
25 |
BBCRESULTS = os.pardir+os.sep+os.pardir+os.sep+"checkbc"+os.sep+"results"+os.sep+"BBCResults.xsl"
|
|
|
26 |
|
|
|
27 |
if len(sys.argv) == 1:
|
|
|
28 |
print "Usage: hatestrun testcase_name"
|
|
|
29 |
sys.exit()
|
|
|
30 |
|
|
|
31 |
if not os.path.exists(TC_FOLDER):
|
|
|
32 |
print "Test case directory cannot be found: " + TC_FOLDER
|
|
|
33 |
sys.exit()
|
|
|
34 |
|
|
|
35 |
if not os.path.exists(SCRIPT_DIR+"prepare.txt"):
|
|
|
36 |
print "Cannot find file: " + SCRIPT_DIR + "prepare.txt"
|
|
|
37 |
sys.exit()
|
|
|
38 |
|
|
|
39 |
file = open( SCRIPT_DIR+"prepare.txt" )
|
|
|
40 |
BASEDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ')
|
|
|
41 |
CURRDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ')
|
|
|
42 |
RESDIR = ((file.readline()).replace("\\",os.sep).replace("/",os.sep)).rstrip('\n\r ')
|
|
|
43 |
file.close()
|
|
|
44 |
|
|
|
45 |
print "Checking test case directories..."
|
|
|
46 |
if not os.path.exists(TC_FOLDER+os.sep+BASEDIR):
|
|
|
47 |
print "Cannot find base platform directory: " + TC_FOLDER+os.sep+BASEDIR
|
|
|
48 |
sys.exit()
|
|
|
49 |
|
|
|
50 |
if not os.path.exists(TC_FOLDER+os.sep+CURRDIR):
|
|
|
51 |
print "Cannot find current platform directory: " + TC_FOLDER+os.sep+CURRDIR
|
|
|
52 |
sys.exit()
|
|
|
53 |
|
|
|
54 |
if not os.path.exists(TC_FOLDER+os.sep+RESDIR):
|
|
|
55 |
print "Cannot find result directory: " + TC_FOLDER+os.sep+RESDIR
|
|
|
56 |
sys.exit()
|
|
|
57 |
|
|
|
58 |
TC_BBCRESULTS = TC_FOLDER+os.sep+RESDIR+os.sep +"BBCResults.xsl"
|
|
|
59 |
|
|
|
60 |
if not os.path.exists( BBCRESULTS):
|
|
|
61 |
print "Cannot find BBCResults.xsl"
|
|
|
62 |
else:
|
|
|
63 |
shutil.copyfile(BBCRESULTS,TC_BBCRESULTS)
|
|
|
64 |
|
|
|
65 |
if os.path.exists(RESULTS_DIR+TC_NUM+"_results.xml"):
|
|
|
66 |
os.remove(RESULTS_DIR+TC_NUM+"_results.xml")
|
|
|
67 |
|
|
|
68 |
print "---- Starting HeaderAnalyser ----"
|
|
|
69 |
os.chdir(os.pardir+os.sep+"bin")
|
|
|
70 |
cmd = "ha -commandfile " + SCRIPT_DIR + TC_NUM + "_conf.txt"
|
|
|
71 |
os.system(cmd)
|
|
|
72 |
os.chdir(os.pardir+os.sep+"tsrc")
|
|
|
73 |
sys.exit()
|
|
|
74 |
|
|
|
75 |
|