|
1 # Copyright (c) 2009 Nokia Corporation |
|
2 # |
|
3 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 # you may not use this file except in compliance with the License. |
|
5 # You may obtain a copy of the License at |
|
6 # |
|
7 # http://www.apache.org/licenses/LICENSE-2.0 |
|
8 # |
|
9 # Unless required by applicable law or agreed to in writing, software |
|
10 # distributed under the License is distributed on an "AS IS" BASIS, |
|
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 # See the License for the specific language governing permissions and |
|
13 # limitations under the License. |
|
14 |
|
15 # usage :create_sis.py <number of sis files to be merged in one instance> |
|
16 |
|
17 import sys |
|
18 import os |
|
19 import glob |
|
20 |
|
21 |
|
22 def create_sis_files(): |
|
23 tests = open('tests_list.txt', 'r').read().split('\n') |
|
24 tests_exe_f = open('tests_exe.txt', 'w') |
|
25 uid = 0xe0000000 |
|
26 testcase_dir = "." |
|
27 for test in tests: |
|
28 if test: |
|
29 test = test + '.py' |
|
30 test_file = os.path.join(testcase_dir, test) |
|
31 uid += 1 |
|
32 try: |
|
33 os.system('python ensymble.py py2sis %s --heapsize=100K,16M ' |
|
34 '--sourcecode --profile=console --uid 0x%x' % |
|
35 (test_file, uid)) |
|
36 app = os.path.splitext(os.path.basename(test_file))[0] |
|
37 tests_exe_f.write('%s_0x%x\n' % (app, uid)) |
|
38 except Exception, e: |
|
39 print e |
|
40 |
|
41 |
|
42 def create_merged_sis(): |
|
43 sis_files = glob.glob('*.sis') |
|
44 start = 0 |
|
45 try: |
|
46 sis_count = int(sys.argv[1]) |
|
47 except: |
|
48 sis_count = 10 |
|
49 end = start + sis_count |
|
50 |
|
51 while(start < len(sis_files)): |
|
52 sis_files_list = ' ' |
|
53 for a in range(start, min(end, len(sis_files))): |
|
54 sis_files_list += ' ' + sis_files[a] |
|
55 |
|
56 os.system('python ensymble.py py2sis run_test.py --profile=console') |
|
57 os.system('python ensymble.py mergesis run_test_v1_0_0.sis ' + |
|
58 sis_files_list + ' run_test_' + str(start) + '.sis') |
|
59 start = end |
|
60 end += sis_count |
|
61 |
|
62 |
|
63 if __name__ == "__main__": |
|
64 create_sis_files() |
|
65 create_merged_sis() |