|
1 |
|
2 from raptor_tests import SmokeTest, ReplaceEnvs |
|
3 |
|
4 def generate_files(): |
|
5 import os |
|
6 |
|
7 bldinf_path = ReplaceEnvs("$(SBS_HOME)/test/timing_tests/test_resources/parse_time/bld.inf") |
|
8 bldinf = open(bldinf_path, "w") |
|
9 bldinf_content = """/* |
|
10 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
11 * All rights reserved. |
|
12 * This component and the accompanying materials are made available |
|
13 * under the terms of the License "Eclipse Public License v1.0" |
|
14 * which accompanies this distribution, and is available |
|
15 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
16 * |
|
17 * Initial Contributors: |
|
18 * Nokia Corporation - initial contribution. |
|
19 * |
|
20 * Contributors: |
|
21 * |
|
22 * Description: |
|
23 * Component description file for parse timing |
|
24 * |
|
25 */ |
|
26 |
|
27 prj_mmpfiles |
|
28 """ |
|
29 test_dir = ReplaceEnvs("$(SBS_HOME)/test/timing_tests/test_resources/parse_time") |
|
30 for number in range(0, 500): |
|
31 mmp_path = ("parse_timing_" + str(number).zfill(3) + ".mmp") |
|
32 mmp_file = open((test_dir + "/" + mmp_path), "w") |
|
33 mmp_file.write("""/* |
|
34 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
35 * All rights reserved. |
|
36 * This component and the accompanying materials are made available |
|
37 * under the terms of the License "Eclipse Public License v1.0" |
|
38 * which accompanies this distribution, and is available |
|
39 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
40 * |
|
41 * Initial Contributors: |
|
42 * Nokia Corporation - initial contribution. |
|
43 * |
|
44 * Contributors: |
|
45 * |
|
46 * Description: |
|
47 * Project description file for parse timing |
|
48 * |
|
49 */ |
|
50 |
|
51 targettype none""") |
|
52 mmp_file.close() |
|
53 bldinf_content += (mmp_path + "\n") |
|
54 |
|
55 bldinf_content += "\nprj_exports\n" |
|
56 |
|
57 for number1 in range(0, 10): |
|
58 source_dir = ("export_source_" + str(number1)) |
|
59 try: |
|
60 os.mkdir(test_dir + "/" + source_dir) |
|
61 except: |
|
62 pass |
|
63 |
|
64 for number2 in range (0, 5): |
|
65 source_file = ("/file_" + str(number2) + ".txt ") |
|
66 export_file = open((test_dir + "/" + source_dir + source_file), "w") |
|
67 export_file.write(str(number2)) |
|
68 export_file.close() |
|
69 |
|
70 for number3 in range (0, 10): |
|
71 dest_dir = ("epoc32/include/export_destination_" + \ |
|
72 str(number1) + str(number2) + str(number3)) |
|
73 |
|
74 for number4 in range(0, 10): |
|
75 bldinf_content += source_dir + source_file + dest_dir + \ |
|
76 "/export_destination_" + str(number4) + "\n" |
|
77 bldinf.write(bldinf_content) |
|
78 bldinf.close() |
|
79 |
|
80 |
|
81 def delete_files(): |
|
82 import shutil |
|
83 |
|
84 test_dir = "$(SBS_HOME)/test/timing_tests/test_resources/parse_time" |
|
85 objects = os.listdir(test_dir) |
|
86 for object in objects: |
|
87 if os.path.isfile(object): |
|
88 os.remove(object) |
|
89 else: |
|
90 shutil.rmtree(object) |
|
91 |
|
92 |
|
93 def run(): |
|
94 |
|
95 generate_files() |
|
96 |
|
97 t = SmokeTest() |
|
98 |
|
99 t.id = "1" |
|
100 t.name = "parse_time_exports_mmps" |
|
101 t.description = """Test to measure time taken to parse a large number of |
|
102 exports and mmps""" |
|
103 t.command = "sbs -b timing_tests/test_resources/parse_time/bld.inf " + \ |
|
104 "-c armv5_urel" |
|
105 t.run() |
|
106 |
|
107 delete_files() |
|
108 return t |