|
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 the License "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 from raptor_tests import SmokeTest |
|
18 import os |
|
19 import re |
|
20 import sys |
|
21 |
|
22 def run(): |
|
23 # Content for files to be generated. |
|
24 cpp = "longerfilenamethanyoumightnormallyexpecttobepresent" |
|
25 path = "/test/smoke_suite/test_resources/longfilenames/" |
|
26 targetinfo = """TARGET longfilenames.exe |
|
27 TARGETTYPE exe |
|
28 UID 0xE8000047 |
|
29 LIBRARY euser.lib |
|
30 SYSTEMINCLUDE /epoc32/include |
|
31 """ |
|
32 |
|
33 # Some numbers for path and file operations |
|
34 length_limit = 245 # Safety-margin of 10 chars for changing dir structures in Raptor |
|
35 extLen = 8 # eg. _001.o.d |
|
36 numLen = 43 # release directory length (c_0000000000000000/longfilenames_exe/winscw/urel/) (minus a few as a safety-margin) |
|
37 pathmultiplier = 5 # expand cpp to the maximum length |
|
38 mmpStart = 1 |
|
39 mmpStop = 270 |
|
40 cppStart = 1 |
|
41 cppStop = 270 |
|
42 |
|
43 |
|
44 # Find SBS_Home and its length as a string |
|
45 sbsHome = os.environ["SBS_HOME"] |
|
46 sbsLen = len(sbsHome) |
|
47 |
|
48 # Work out path lengths required |
|
49 dirname = sbsHome + path |
|
50 string = cpp * pathmultiplier |
|
51 dirlen = len(dirname) |
|
52 fileLen = length_limit - dirlen - numLen - extLen |
|
53 if fileLen < 0: |
|
54 print "Error: Your test path is too long for the longfilenames test to work" |
|
55 sys.exit() |
|
56 fileName = string[0:fileLen] |
|
57 |
|
58 # Generate the mmp file using the mmp string |
|
59 f = open(dirname + 'longfilenames.mmp', 'w') |
|
60 f.writelines(targetinfo) |
|
61 f.writelines("\nSOURCE " + cpp + ".cpp\n") |
|
62 while mmpStart <= mmpStop: |
|
63 sourceinfo = "SOURCE " + fileName + '_%03d' %mmpStart + ".cpp " + '\n' |
|
64 f.writelines(sourceinfo) |
|
65 mmpStart += 1 |
|
66 f.close() |
|
67 |
|
68 # File generating utility |
|
69 while cppStart <= cppStop: |
|
70 t = str(cppStart) |
|
71 filename = dirname + fileName + '_%03d' %cppStart + '.cpp' |
|
72 content = 'int x' + t + ' = 1;' |
|
73 f = open (filename, 'w') |
|
74 f.write (content) |
|
75 f.close() |
|
76 cppStart += 1 |
|
77 |
|
78 |
|
79 t = SmokeTest() |
|
80 t.id = "79" |
|
81 t.name = "longfilenames" |
|
82 t.command = "sbs -b smoke_suite/test_resources/longfilenames/bld.inf -c winscw" |
|
83 t.description = """Ensure that winscw links with large amounts of object files with long names are buildable. |
|
84 Note that the link in the build of this component should always be greater than 16500 chars, regardless |
|
85 of environment - we know such calls are currently problematic on Windows with GNU Make and Cygwin's |
|
86 Bash unless a linker response file is not used to hold the object files.""" |
|
87 t.targets = [ |
|
88 "$(EPOCROOT)/epoc32/release/winscw/urel/longfilenames.exe", |
|
89 "$(EPOCROOT)/epoc32/release/winscw/urel/longfilenames.exe.map" |
|
90 ] |
|
91 t.addbuildtargets('smoke_suite/test_resources/longfilenames/bld.inf', [ |
|
92 "longfilenames_exe/winscw/urel/longerfilenamethanyoumightnormallyexpecttobepresent.dep", |
|
93 "longfilenames_exe/winscw/urel/longerfilenamethanyoumightnormallyexpecttobepresent.o", |
|
94 "longfilenames_exe/winscw/urel/longerfilenamethanyoumightnormallyexpecttobepresent.o.d", |
|
95 "longfilenames_exe/winscw/urel/longfilenames.UID.CPP", |
|
96 "longfilenames_exe/winscw/urel/longfilenames_UID_.dep", |
|
97 "longfilenames_exe/winscw/urel/longfilenames_UID_.o", |
|
98 "longfilenames_exe/winscw/urel/longfilenames_UID_.o.d", |
|
99 "longfilenames_exe/winscw/urel/longfilenames_urel_objects.lrf"] |
|
100 ) |
|
101 |
|
102 basefilename = "longfilenames_exe/winscw/urel/" + fileName + "_%03d.%s" |
|
103 for i in range(1, 271): |
|
104 t.addbuildtargets('smoke_suite/test_resources/longfilenames/bld.inf', [ |
|
105 basefilename % (i, "dep"), |
|
106 basefilename % (i, "o"), |
|
107 basefilename % (i, "o.d") |
|
108 ] |
|
109 ) |
|
110 |
|
111 t.run() |
|
112 |
|
113 # Remove all created files |
|
114 |
|
115 # Matches longerfilena......_nnn.cpp |
|
116 cpp_regex = re.compile("^.+_\d{3}.cpp$", re.I) |
|
117 for file in os.listdir(dirname): |
|
118 if cpp_regex.match(file) is not None: |
|
119 try: |
|
120 os.remove(dirname + file) |
|
121 except: |
|
122 pass |
|
123 |
|
124 try: |
|
125 os.remove(dirname + 'longfilenames.mmp') |
|
126 except: |
|
127 pass |
|
128 |
|
129 return t |