618
|
1 |
#============================================================================
|
|
2 |
#Name : pkg2iby.py
|
|
3 |
#Part of : Helium
|
|
4 |
|
|
5 |
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
6 |
#All rights reserved.
|
|
7 |
#This component and the accompanying materials are made available
|
|
8 |
#under the terms of the License "Eclipse Public License v1.0"
|
|
9 |
#which accompanies this distribution, and is available
|
|
10 |
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
11 |
#
|
|
12 |
#Initial Contributors:
|
|
13 |
#Nokia Corporation - initial contribution.
|
|
14 |
#
|
|
15 |
#Contributors:
|
|
16 |
#
|
|
17 |
#Description:
|
|
18 |
#===============================================================================
|
|
19 |
import sys
|
|
20 |
import ats3
|
|
21 |
import os
|
|
22 |
|
|
23 |
def main():
|
|
24 |
if len(sys.argv) < 3:
|
|
25 |
print 'Usage: ' + sys.argv[0] + ' builddrive tef pkg1 pkg2 ..'
|
|
26 |
sys.exit(1)
|
|
27 |
generateromcontent(sys.argv[1], sys.argv[2], sys.argv[3:])
|
|
28 |
|
|
29 |
def generateromcontent(drive, testtype, pkgs):
|
|
30 |
ibyfilename = os.path.join(drive + os.sep, 'epoc32', 'rom', 'include', 'atsauto.iby')
|
|
31 |
execfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'atsautoexec.bat')
|
|
32 |
rtestexecfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'atsrtestexec.bat')
|
|
33 |
dummyexecfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'dummy.bat')
|
|
34 |
pkgfilesnames = []
|
|
35 |
for p in pkgs:
|
|
36 |
pkgfilesnames.append(os.path.join(drive + os.sep, p))
|
|
37 |
pkg_parser = ats3.parsers.PkgFileParser(drive=drive)
|
|
38 |
pkgfiles = pkg_parser.read_pkg_file(pkgfilesnames)
|
|
39 |
|
|
40 |
writeautoexec = False
|
|
41 |
|
|
42 |
myiby = open(ibyfilename, 'w')
|
|
43 |
atsautoexec = open(execfilename, 'w')
|
|
44 |
atsrtestexec = open(rtestexecfilename, 'w')
|
|
45 |
dummyexec = open(dummyexecfilename, 'w')
|
|
46 |
dummyexec.close()
|
|
47 |
|
|
48 |
myiby.write("#ifndef __ATSAUTO_IBY__\n")
|
|
49 |
myiby.write("#define __ATSAUTO_IBY__\n")
|
|
50 |
|
|
51 |
atsautoexec.write(r'md c:\logs' + '\n')
|
|
52 |
atsautoexec.write(r'md c:\logs\testresults' + '\n')
|
|
53 |
atsautoexec.write(r'md c:\logs\testexecute' + '\n')
|
|
54 |
|
|
55 |
for src, dst, filetype, _ in pkgfiles:
|
|
56 |
(_, dst) = os.path.splitdrive(dst)
|
|
57 |
dst_nodrive = 'atsdata' + dst
|
|
58 |
dst = r'z:\atsdata' + dst
|
|
59 |
myiby.write('data=' + src + ' ' + dst_nodrive + '\n')
|
|
60 |
if 'testscript' in filetype and testtype == 'tef':
|
|
61 |
atsautoexec.write('testexecute.exe ' + dst + '\n')
|
|
62 |
atsautoexec.write('thindump -nop c:\\logs\\testexecute\\' + os.path.basename(dst.replace('.script', '.htm')) + '\n')
|
|
63 |
writeautoexec = True
|
|
64 |
if 'testscript' in filetype and testtype == 'mtf':
|
|
65 |
atsautoexec.write('testframework.exe ' + dst + '\n')
|
|
66 |
atsautoexec.write('thindump -nop c:\\logs\\testresults\\' + os.path.basename(dst.replace('.script', '.htm')) + '\n')
|
|
67 |
writeautoexec = True
|
|
68 |
if '.exe' in dst and testtype == 'rtest':
|
|
69 |
atsrtestexec.write(dst + '\n')
|
|
70 |
writeautoexec = True
|
|
71 |
if writeautoexec:
|
|
72 |
myiby.write("#include <thindump.iby>\n")
|
|
73 |
myiby.write(r'data=' + execfilename + ' autoexec.bat' + '\n')
|
|
74 |
if testtype == 'rtest':
|
|
75 |
atsautoexec.write(r'runtests \sys\bin\atsrtestexec.bat' + '\n')
|
|
76 |
myiby.write(r'data=' + rtestexecfilename + r' \sys\bin\atsrtestexec.bat' + '\n')
|
|
77 |
|
|
78 |
myiby.write(r'data=' + dummyexecfilename + r' z:\dummytest.txt' + '\n')
|
|
79 |
atsautoexec.write(r'RUNTESTS z:\dummytest.txt -p')
|
|
80 |
myiby.write("#endif\n")
|
|
81 |
myiby.close()
|
|
82 |
atsautoexec.close()
|
|
83 |
atsrtestexec.close()
|
|
84 |
|
|
85 |
if __name__ == "__main__":
|
|
86 |
main() |