|
1 # |
|
2 # Copyright (c) 2004-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 # Perl script that creates PKG files and test DumpSIS tools with different ranges |
|
16 # |
|
17 |
|
18 use File::Basename; |
|
19 my $scriptdir= dirname $0; |
|
20 print "Changing dir to $scriptdir\n"; |
|
21 chdir $scriptdir; |
|
22 |
|
23 my $runMode = $ARGV[0]; |
|
24 |
|
25 # Set the log file based on the invocation parameter |
|
26 if($runMode eq "usif") |
|
27 { |
|
28 $logFile = "\\epoc32\\winscw\\c\\dumpsis_test_usif.txt"; |
|
29 } |
|
30 else |
|
31 { |
|
32 $logFile = "\\epoc32\\winscw\\c\\dumpsis_test.txt"; |
|
33 } |
|
34 |
|
35 #Main |
|
36 # Create environment and control test flow to testing DumpSIS.EXE |
|
37 # |
|
38 # |
|
39 |
|
40 unlink($logFile); |
|
41 WriteLog("DUMPSIS test.\n\n"); |
|
42 |
|
43 # |
|
44 # Counters for results |
|
45 # |
|
46 $NumberOfTests = 0; |
|
47 $NUmberOfPassed = 0; |
|
48 $NumberOfFailed = 0; |
|
49 |
|
50 |
|
51 CreateMakeSIS(); |
|
52 |
|
53 # |
|
54 # Array of test data used for each individual test iteration which contains details of the test pkgs and their expected results |
|
55 # |
|
56 # <file name> - Path of the SIS file being used as a parameter to DumpSIS |
|
57 # <expected result> - Expected error code result returned from the DumpSIS tool |
|
58 # <expected log cmdline> - Expected log output to the command line as a result of the test |
|
59 # <expected log pkg> - Expected string to be present within the PKG file dumped by DumpSIS ("-" if not checked) |
|
60 # <title> - Title used to identify the individual test in the Results Log |
|
61 # |
|
62 # Array Format: [<file name>,<expected result>,<expected log cmdline>,<expected log pkg>,<title>] |
|
63 # ------------------------------------------------------------------------------------------------------------------------------------ |
|
64 @TestItems = ( ["simple.sis", 0, "-", "-", "Test for normal sis file"], |
|
65 ["package\\CtlTest.sis", 0, "Dumping Stub SIS Controller", "-", "Test for Stub SIS Controller"], |
|
66 ["StubTest.sis", 0, "-", "-", "Test for Stub SIS file"], |
|
67 ["DepTest.sis", 0, "-", "-", "Test for Dependency file"], |
|
68 ["TestFileNullE.sis", 0, "-", "-", "Test for file null sysbin file"], |
|
69 ["TestFileNullB.sis", 0, "-", "-", "Test for file null private file"], |
|
70 ["TestFileNullC.sis", 0, "-", "-", "Test for file null resource file"], |
|
71 ["TestFileNullD.sis", 0, "-", "-", "Test for file null restore"], |
|
72 ["TestFileNullA.sis", 0, "-", "-", "Test for file null import"], |
|
73 ["Embsis0.sis", 0, "-", "-", "Test for Embedded sis file"], |
|
74 ["Embsis1.sis", 0, "-", "-", "Test for Embedded sis file"], |
|
75 ["EmbTest.sis", 0, "-", "-", "Test for Embedded sis file"], |
|
76 ["MultiLangTest.sis", 0, "-", "-", "Test for multiple language"], |
|
77 ["CondTest.sis", 0, "-", "-", "Test for If Else condition"], |
|
78 ["UnicodeTest.sis", 0, "-", "-", "Test for Unicode sis file"], |
|
79 ["CondTestElseif.sis", 0, "-", "-", "Test for ElseIf condition"], |
|
80 ["OprTest.sis", 0, "-", "-", "Test for operator condition"], |
|
81 ["LogoTest.sis", 0, "-", "-", "Test for MIME sis file"], |
|
82 ["package\\CtlTestROM.sis", 0, "Dumping Stub SIS Controller", "-", "Test for Stub sis controller with package in ROM"], |
|
83 ["package\\TestCtlEmb.sis", 0, "Dumping Stub SIS Controller", "-", "Test for Embedded Stub sis controller "], |
|
84 ["package\\ExeTest.sis", 0, "-", "-", "Test for 1 WINSCW and 2 ARM Executable sis file"], |
|
85 ["test20.sis", 256, "-", "-", "Test for corrupted sis file"], |
|
86 ["test21.sis", 256, "-", "-", "Test for corrupted stub sis controller file"], |
|
87 ["test22.sis", 256, "-", "-", "Test for corrupted stub sis file"], |
|
88 ["package\\appv11.sis", 256, "-", "-", "Test for old sis file format"], |
|
89 ["simple_RBS.sis", 0, "-", "-", "Test for RBS flag"], |
|
90 ["simple_rrrbs.sis", 0, "-", "-", "Test for RR,RBS flag"], |
|
91 ["simple_frra.sis", 0, "-", "\"file0\"-\"!:\\Documents\\InstTest\\file1.txt\", FR, RI, RA", "Test for FR,RA flag"], |
|
92 ["simple_frra_v.sis", 0, "-", "\"file0\"-\"!:\\Documents\\InstTest\\file0.txt\", FR, RI, RA", "Test for FR,RUNAFTERINSTALL flag"], |
|
93 ); |
|
94 |
|
95 |
|
96 # CR1125 - Add Package Versions to SIS File Conditionals Test Cases |
|
97 # Array of test PKG data and expected results for each test case and associated iterations |
|
98 # |
|
99 # <file name> - Path of the SIS file being used as a parameter to DumpSIS |
|
100 # <expected result> - Expected error code result returned from the DumpSIS tool |
|
101 # <expected log cmdline> - Expected log output to the command line as a result of the test |
|
102 # <initial condition> - The condition used to construct the "IF" statement within the PKG File and perform a specific test |
|
103 # on the Tool |
|
104 # <expected condition> - Expected "IF" statement condition string to be present within the PKG file dumped by DumpSIS |
|
105 # <title> - Title used to identify the individual test in the Results Log |
|
106 # |
|
107 # |
|
108 # Array Format: [<file name>,<expected result>,<expected log cmdline>,<initial condition>,<expected condition>,<title>] |
|
109 # ---------------------------------------------------------------------------------------------------------------------------------------- |
|
110 @TestItems1 = ( ["pkgversion_c001_a.sis", 0, "-", "VERSION(0xE1000001,=,1,2,3)", "VERSION(0xE1000001,=,1,2,3)", "SEC-SWI-PKGVER-C001 : A"], |
|
111 |
|
112 ["pkgversion_c001_b.sis", 0, "-", "VERSION(0xE1000001,<>,1,2,3)", "VERSION(0xE1000001,<>,1,2,3)", "SEC-SWI-PKGVER-C001 : B"], |
|
113 |
|
114 ["pkgversion_c001_c.sis", 0, "-", "VERSION(0xE1000001,>,1,2,3)", "VERSION(0xE1000001,>,1,2,3)", "SEC-SWI-PKGVER-C001 : C"], |
|
115 |
|
116 ["pkgversion_c001_d.sis", 0, "-", "VERSION(0xE1000001,>=,1,2,3)", "VERSION(0xE1000001,>=,1,2,3)", "SEC-SWI-PKGVER-C001 : D"], |
|
117 |
|
118 ["pkgversion_c001_e.sis", 0, "-", "VERSION(0xE1000001,<,1,2,3)", "VERSION(0xE1000001,<,1,2,3)", "SEC-SWI-PKGVER-C001 : E"], |
|
119 |
|
120 ["pkgversion_c001_f.sis", 0, "-", "VERSION(0xE1000001,<=,1,2,3)", "VERSION(0xE1000001,<=,1,2,3)", "SEC-SWI-PKGVER-C001 : F"], |
|
121 |
|
122 ["pkgversion_c002_a.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,3\")", "VERSION(0xE1000001,=,1,2,3)", "SEC-SWI-PKGVER-C002 : A"], |
|
123 |
|
124 ["pkgversion_c002_b.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,NE,1,2,3\")", "VERSION(0xE1000001,<>,1,2,3)", "SEC-SWI-PKGVER-C002 : B"], |
|
125 |
|
126 ["pkgversion_c002_c.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,GT,1,2,3\")", "VERSION(0xE1000001,>,1,2,3)", "SEC-SWI-PKGVER-C002 : C"], |
|
127 |
|
128 ["pkgversion_c002_d.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,GE,1,2,3\")", "VERSION(0xE1000001,>=,1,2,3)", "SEC-SWI-PKGVER-C002 : D"], |
|
129 |
|
130 ["pkgversion_c002_e.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,LT,1,2,3\")", "VERSION(0xE1000001,<,1,2,3)", "SEC-SWI-PKGVER-C002 : E"], |
|
131 |
|
132 ["pkgversion_c002_f.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,LE,1,2,3\")", "VERSION(0xE1000001,<=,1,2,3)", "SEC-SWI-PKGVER-C002 : F"], |
|
133 |
|
134 ["pkgversion_c003_a.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?test,ET,1,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?test,ET,1,2,3\")", "SEC-SWI-PKGVER-C003 : A"], |
|
135 |
|
136 ["pkgversion_c003_b.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,test,1,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,test,1,2,3\")", "SEC-SWI-PKGVER-C003 : B"], |
|
137 |
|
138 ["pkgversion_c003_c.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,test,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,test,2,3\")", "SEC-SWI-PKGVER-C003 : C"], |
|
139 |
|
140 ["pkgversion_c003_d.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,test,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,test,3\")", "SEC-SWI-PKGVER-C003 : D"], |
|
141 |
|
142 ["pkgversion_c003_e.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,test\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,test\")", "SEC-SWI-PKGVER-C003 : E"], |
|
143 |
|
144 # Invalid test case. Test case should be moved to makesis. Or test should run on generated sis as this sis should not |
|
145 # have generated. |
|
146 # ["pkgversion_c004_a.sis", 256, "-", "EXISTS(\"\")", "-", "SEC-SWI-PKGVER-C004 : A"], |
|
147 |
|
148 ["pkgversion_c004_b.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?\")", "EXISTS(\"\\sys\\install\\pkgversion\\?\")", "SEC-SWI-PKGVER-C004 : B"], |
|
149 |
|
150 ["pkgversion_c004_c.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,\")", "SEC-SWI-PKGVER-C004 : C"], |
|
151 |
|
152 ["pkgversion_c004_d.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,\")", "SEC-SWI-PKGVER-C004 : D"], |
|
153 |
|
154 ["pkgversion_c004_e.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,\")", "SEC-SWI-PKGVER-C004 : E"], |
|
155 |
|
156 ["pkgversion_c004_f.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,\")", "SEC-SWI-PKGVER-C004 : F"], |
|
157 |
|
158 ["pkgversion_c004_g.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,3,\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE1000001,ET,1,2,3,\")", "SEC-SWI-PKGVER-C004 : G"], |
|
159 |
|
160 ["pkgversion_c005.sis", 0, "-", "VERSION(0xE1000001,=,1,2,3)", "VERSION(0xE1000001,=,1,2,3)", "SEC-SWI-PKGVER-C005"], |
|
161 |
|
162 ["pkgversion_cov1.sis", 0, "-", "EXISTS(\"\\sys\\install\\?0xE1000001,ET,1,2,3\")", "EXISTS(\"\\sys\\install\\?0xE1000001,ET,1,2,3\")", "SEC-SWI-PKGVER Coverage Test 1 - Invalid Version Condition Prefix"], |
|
163 |
|
164 ["pkgversion_cov2.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE100,ET,1,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE100,ET,1,2,3\")", "SEC-SWI-PKGVER Coverage Test 2 - Invalid Uid Format Test 1"], |
|
165 |
|
166 ["pkgversion_cov3.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE01234S6,ET,1,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE01234S6,ET,1,2,3\")", "SEC-SWI-PKGVER Coverage Test 3 - Invalid Uid Format Test 2"], |
|
167 |
|
168 ["pkgversion_cov4.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,-2,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,-2,2,3\")", "SEC-SWI-PKGVER Coverage Test 4 - Negative Major Component"], |
|
169 |
|
170 ["pkgversion_cov5.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,128,2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,128,2,3\")", "SEC-SWI-PKGVER Coverage Test 5 - Major Component > 127"], |
|
171 |
|
172 ["pkgversion_cov6.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,-2,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,-2,3\")", "SEC-SWI-PKGVER Coverage Test 6 - Negative Minor Component"], |
|
173 |
|
174 ["pkgversion_cov7.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,100,3\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,100,3\")", "SEC-SWI-PKGVER Coverage Test 7 - Minor Component > 99"], |
|
175 |
|
176 ["pkgversion_cov8.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,2,-2\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,2,-2\")", "SEC-SWI-PKGVER Coverage Test 8 - Negative Build Component"], |
|
177 |
|
178 ["pkgversion_cov9.sis", 0, "-", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,2,32768\")", "EXISTS(\"\\sys\\install\\pkgversion\\?0xE0123456,ET,1,2,32768\")", "SEC-SWI-PKGVER Coverage Test 9 - Build Component > 32767"], |
|
179 |
|
180 ["pkgversion_cov10.sis", 0, "-", "((EXISTS(\"OddString\"))or(language=1))", "(exists(\"OddString\"))OR((LANGUAGE)=(1))", "SEC-SWI-PKGVER Odd String with exists() test"], |
|
181 |
|
182 |
|
183 ); |
|
184 |
|
185 # PREQ2525 - Added SUPPORTED_LANGUAGE token to .pkg File format for supporting device supported language installation |
|
186 # Array of test PKG data and expected results for each test case and associated itterations |
|
187 # |
|
188 # File name, Supported language, Package header , Vendor name , Default vendor name ,Language block , Supported language block , Option list , Test case ID , Expected error code , Expected log commandLine , Expected value in dumped PKG file |
|
189 # ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
190 @TestItems2 = ( ["test01.sis", "EN , FR " , " \"Supported Language EN\" , \"Supported Language FR\" " , "\"Symbian Software Ltd. EN \" , \"Symbian Software Ltd. FR\"" , " " , " " , "IF SUPPORTED_LANGUAGE = 01 \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 02 \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF " , " " , "API-Inst-PREQ2525-DumpSIS-01", 0 ,"-", "IF Supported_Language = 2" ], |
|
191 ["test02.sis", "EN , FR , GE " , " \"Supported Language EN\" , \"Supported Language FR\" , \"Supported Language GE\" " , "\"Symbian Software Ltd. EN \" , \"Symbian Software Ltd. FR\" , \"Symbian Software Ltd. GE\"" , ": \"Symbian Software Ltd.\"", " " , "IF LANGUAGE = 01 AND SUPPORTED_LANGUAGE = 01 \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 02 \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF " , " " , "API-Inst-PREQ2525-DumpSIS-02", 0 ,"-", "IF ((LANGUAGE)=(1))AND(Supported_Language = 1)" ], |
|
192 ["test03.sis", "EN , FR , GE " , " \"Supported Language EN\" , \"Supported Language FR\" , \"Supported Language GE\" " , "\"Symbian Software Ltd. EN \" , \"Symbian Software Ltd. FR\" , \"Symbian Software Ltd. GE\"" , ": \"Symbian Software Ltd.\"", " " , "IF exists(\"\\sys\\install\\supportedlanguage\\?01\") \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 02 \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 03 \n\n\"SupportedLanguageGE.txt\"-\"!:\\sys\\bin\\SupportedLanguageGE.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 157 \n\n\"SupportedLanguageYW.txt\"-\"!:\\sys\\bin\\SupportedLanguageYW.txt\" \n\nENDIF" , " " , "API-Inst-PREQ2525-DumpSIS-03", 0 ,"-", "IF Supported_Language = 1" ], |
|
193 ["test04.sis", "EN , FR" , " \"Supported Language EN\" , \"Supported Language FR\" " , "\"Symbian Software Ltd. EN \" , \"Symbian Software Ltd. FR\"" , ": \"Symbian Software Ltd.\"", "IF (LANGUAGE=01) \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nELSEIF (LANGUAGE=02) \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF " , "IF SUPPORTED_LANGUAGE = 01 AND LANGUAGE = 02 \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 02 \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF" , "!({\"Option1 EN\",\"Option2 EN\" },{\"Option1 FR\" , \"Option2 FR\"}) \n\nif option1 = 1 \n\n\"Option1.txt\"-\"!:\\sys\\bin\\Option1.txt\"; \n\nendif \n\nif option2 = 1 \n\n\"Option1.txt\"-\"!:\\sys\\bin\\Option1.txt\"; \n\nendif \n ", "API-Inst-PREQ2525-DumpSIS-04", 0 ,"-", "IF (Supported_Language = 1)AND((LANGUAGE)=(2))" ], |
|
194 ["test05.sis", "EN , FR" , " \"Supported Language EN\" , \"Supported Language FR\" " , "\"Symbian Software Ltd. EN \" , \"Symbian Software Ltd. FR\"" , ": \"Symbian Software Ltd.\"", "IF (LANGUAGE=01) \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nELSEIF (LANGUAGE=02) \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF " , "IF SUPPORTED_LANGUAGE = 01 OR SUPPORTED_LANGUAGE = 02 \n\n\"SupportedLanguageEN.txt\"-\"!:\\sys\\bin\\SupportedLanguageEN.txt\" \n\nENDIF \n\nIF SUPPORTED_LANGUAGE = 8754 \n\n\"SupportedLanguageFR.txt\"-\"!:\\sys\\bin\\SupportedLanguageFR.txt\" \n\nENDIF" , "!({\"Option1 EN\",\"Option2 EN\" },{\"Option1 FR\" , \"Option2 FR\"}) \n\nif option1 = 1 \n\n\"Option1.txt\"-\"!:\\sys\\bin\\Option1.txt\"; \n\nendif \n\nif option2 = 1 \n\n\"Option2.txt\"-\"!:\\sys\\bin\\Option2.txt\"; \n\nendif \n ", "API-Inst-PREQ2525-DumpSIS-05", 0 ,"-", "IF (Supported_Language = 1)OR(Supported_Language = 2)" ], |
|
195 |
|
196 ); |
|
197 |
|
198 # |
|
199 # Template string to generate PKG file |
|
200 # |
|
201 $PkgFileTemp = " |
|
202 ; File to check DEF092185 |
|
203 ; |
|
204 ;Languages |
|
205 &EN |
|
206 ; |
|
207 ;Header |
|
208 #{\"logo\"}, (0x80000003), 1, 2, 3, TYPE=SA |
|
209 ; |
|
210 %{\"Vendor\"} |
|
211 :\"Vendor\" |
|
212 ; |
|
213 =\"data\\logotest\\symbianos.mbm\", \"image/x-mbm\", \"c:\\target.mbm\" |
|
214 ; |
|
215 "; |
|
216 |
|
217 # |
|
218 # Template string to generate PKG file for DEF100220. |
|
219 # |
|
220 $PkgFileTemplate = " |
|
221 ; File to check DEF100220. |
|
222 ; |
|
223 ;Languages |
|
224 &EN |
|
225 ; |
|
226 #{\"TestDEF100220\"}, (0x20000129), 3, 2, 49, TYPE=PA |
|
227 ; |
|
228 %{\"Vendor\"} |
|
229 :\"Vendor\" |
|
230 ; |
|
231 [0x101f7961],0, 0, 0 ,{\"Series60ProductID\"} |
|
232 ; |
|
233 "; |
|
234 |
|
235 # |
|
236 # Template string to generate PKG file for DEF105590. |
|
237 # |
|
238 $PkgFileDEF105590= "&EN |
|
239 ; |
|
240 #{\"TestDEF105590\"}, (0x20000130), 1, 2, 3, TYPE=SA |
|
241 ; |
|
242 %{\"Vendor\"} |
|
243 :\"Vendor\" |
|
244 ; |
|
245 \"\\epoc32\\release\\winscw\\udeb\\console_app_forpackage.exe\"-\"!:\\sys\\bin\\console_app.exe\", FR, RR |
|
246 "; |
|
247 |
|
248 # |
|
249 # Template string to generate Expected PKG file after dumpsis for DEF105590. |
|
250 # |
|
251 $ExpectedPkgFileDEF105590= "&EN |
|
252 |
|
253 #{\"TestDEF105590\"}, (0x20000130), 1, 2, 3, TYPE=SA |
|
254 %{\"Vendor\"} |
|
255 :\"Vendor\" |
|
256 |
|
257 ;!:\\sys\\bin\\console_app.exe |
|
258 ; File length 57961 (180176) |
|
259 |
|
260 \"file0\"-\"!:\\sys\\bin\\console_app.exe\", FR, RR |
|
261 "; |
|
262 |
|
263 # |
|
264 # Template string to generate PKG file for Hidden flag test. |
|
265 # |
|
266 $PkgFileHidden= "&EN |
|
267 ; |
|
268 #{\"Hidden SA\"}, (0x802730D7), 1, 1, 1, TYPE=SA, H |
|
269 ; |
|
270 %{\"Crypto Services\"} |
|
271 :\"Crypto Services\" |
|
272 "; |
|
273 |
|
274 # |
|
275 # Template string to generate Expected PKG file after dumpsis for Hidden package. |
|
276 # |
|
277 $ExpectedPkgFileHidden= "&EN |
|
278 |
|
279 #{\"Hidden SA\"}, (0x802730D7), 1, 1, 1, TYPE=SA, H |
|
280 |
|
281 %{\"Crypto Services\"} |
|
282 :\"Crypto Services\" |
|
283 "; |
|
284 |
|
285 # |
|
286 # CR1125 VERSION Condition Package template string to generate PKG files |
|
287 # |
|
288 $PkgFileCR1125VersionTemplate = " |
|
289 ; |
|
290 ; Auto Generated Template PKG File |
|
291 ; VERSION Conditional Testing |
|
292 ; |
|
293 &EN |
|
294 ; |
|
295 #{\"CR1125 SEC-SWI-PKGVER\"}, (0xEC001000), 1, 0, 2, TYPE=SA |
|
296 %{\"Symbian Software Ltd.\"} |
|
297 : \"Symbian Software Ltd.\" |
|
298 ; |
|
299 ; Version Conditional Block |
|
300 IF %s |
|
301 { |
|
302 \"data\\CondTest\\file0\" |
|
303 }-\"C:\\tswi\\tpkgver\\test_result_etrue.txt\" |
|
304 ENDIF |
|
305 ; |
|
306 "; |
|
307 |
|
308 |
|
309 # |
|
310 # PREQ2525 SUPPORTED_LANGUAGE Package template string to generate PKG files |
|
311 # |
|
312 $PkgFilePREQ2525SupportedLanguageTemplate = " |
|
313 ; |
|
314 ; Auto Generated Template PKG File |
|
315 ; Supported Language token testing |
|
316 ; |
|
317 ;Language |
|
318 |
|
319 &%s |
|
320 |
|
321 ; |
|
322 ;Package Header |
|
323 |
|
324 \#{ %s }, (0xEA001000), 1, 0, 2, TYPE=SA |
|
325 |
|
326 ;Vendor name |
|
327 |
|
328 \%{ %s} |
|
329 |
|
330 ;Default vendor name |
|
331 |
|
332 %s |
|
333 |
|
334 ; |
|
335 ; Language Conditional Block |
|
336 |
|
337 %s |
|
338 ; |
|
339 ; Supported Language Conditional Block |
|
340 |
|
341 %s |
|
342 ; |
|
343 ; Option List |
|
344 |
|
345 %s |
|
346 ; |
|
347 "; |
|
348 # |
|
349 # Do test for each elements of TestItems array |
|
350 # |
|
351 sub CreateMakeSIS |
|
352 { |
|
353 $packageDir = "package"; |
|
354 opendir(DIR,".\\package"); |
|
355 my @files = readdir DIR; |
|
356 foreach my $pkgfile (@files) |
|
357 { |
|
358 $pkgfile =~ s/\.pkg//; |
|
359 $packagePath = "$packageDir"."\\"."$pkgfile".".pkg"; |
|
360 if(-e "$packagePath") |
|
361 { |
|
362 if("$pkgfile.pkg" eq "StubTest.pkg") |
|
363 { |
|
364 @retval = system("makesis -s $packagePath $pkgfile.sis > $pkgfile.log"); |
|
365 } |
|
366 else |
|
367 { |
|
368 @retval = system("makesis -v $packagePath $pkgfile.sis > $pkgfile.log"); |
|
369 } |
|
370 if( $? != 0) |
|
371 { |
|
372 WriteLog("\n\nProblem While Creating makesis for $pkgfile.pkg\n"); |
|
373 } |
|
374 else |
|
375 { |
|
376 WriteLog("\n\nCreated $pkgfile.sis file for the package $pkgfile.pkg\n"); |
|
377 } |
|
378 unlink("$pkgfile.log"); |
|
379 } |
|
380 } |
|
381 close(DIR); |
|
382 } |
|
383 |
|
384 for my $Test ( @TestItems ) |
|
385 { |
|
386 $testid = sprintf "SEC-SWI-I-DUMPSIS-000%d\n",$NumberOfTests+1; |
|
387 $NumberOfTests++; |
|
388 |
|
389 WriteLog($testid); |
|
390 $logMsg = sprintf "%s", $Test->[4]; |
|
391 WriteLog($logMsg ); |
|
392 WriteLog("\t$Test->[0]\n"); |
|
393 DumpSISFile($Test->[0], $Test->[1], $Test->[2], $Test->[3]); |
|
394 } |
|
395 |
|
396 # |
|
397 # Run CR1125 DumpSIS Tests (TestItems1 array) |
|
398 # |
|
399 for my $Test ( @TestItems1 ) |
|
400 { |
|
401 $NumberOfTests++; |
|
402 |
|
403 $logMsg = sprintf "%s - %s\n", $Test->[5], $Test->[3]; |
|
404 WriteLog($logMsg); |
|
405 |
|
406 # Generating PKG file contents String |
|
407 my($pkgfile_name) = $Test->[0]; |
|
408 $pkgfile_name =~ s/\.sis//; |
|
409 |
|
410 my($pkgfile_contents) = sprintf($PkgFileCR1125VersionTemplate, $Test->[3]); |
|
411 |
|
412 # Create PKG file |
|
413 CreateFile("$pkgfile_name.pkg", $pkgfile_contents); |
|
414 |
|
415 if(not -e "$pkgfile_name.pkg") |
|
416 { |
|
417 WriteLog("** Problem creating PKG file for $Test->[5] **\n"); |
|
418 $NumberOfFailed++; |
|
419 WriteLog("Failed\n\n"); |
|
420 next; |
|
421 } |
|
422 |
|
423 # Create SIS Install File |
|
424 @retval = system("makesis -v $pkgfile_name.pkg $pkgfile_name.sis > $pkgfile_name.log"); |
|
425 |
|
426 if( $? != 0) |
|
427 { |
|
428 WriteLog("** Problem While Creating SIS file for $Test->[5] **\n"); |
|
429 $NumberOfFailed++; |
|
430 WriteLog("Failed\n\n"); |
|
431 next; |
|
432 } |
|
433 else |
|
434 { |
|
435 WriteLog("Created $Test->[0] file for $Test->[5]\n"); |
|
436 } |
|
437 |
|
438 # Run DumpSIS Test |
|
439 DumpSISFile($Test->[0], $Test->[1], $Test->[2], $Test->[4]); |
|
440 |
|
441 unlink("$pkgfile_name.pkg"); |
|
442 } |
|
443 |
|
444 # |
|
445 # Generate files used in .pkg for PREQ2525 test |
|
446 # |
|
447 $contents = "This is a dummy file for testing."; |
|
448 CreateFile('SupportedLanguageEN.r01', $contents); |
|
449 CreateFile('SupportedLanguageEN.txt', $contents); |
|
450 CreateFile('SupportedLanguageFR.txt', $contents); |
|
451 CreateFile('SupportedLanguageGE.txt', $contents); |
|
452 CreateFile('SupportedLanguageYW.txt', $contents); |
|
453 CreateFile('Option1.txt', $contents); |
|
454 CreateFile('Option2.txt', $contents); |
|
455 # |
|
456 # Run PREQ2525 DumpSIS Tests (TestItems2 array) |
|
457 # |
|
458 for my $Test ( @TestItems2 ) |
|
459 { |
|
460 $NumberOfTests++; |
|
461 |
|
462 $logMsg = sprintf "%s - %s\n", $Test->[8], $Test->[10]; |
|
463 WriteLog($logMsg); |
|
464 |
|
465 |
|
466 # Generating PKG file contents String |
|
467 my($pkgfile_name) = $Test->[0]; |
|
468 $pkgfile_name =~ s/\.sis//; |
|
469 |
|
470 my($pkgfile_contents) = sprintf( $PkgFilePREQ2525SupportedLanguageTemplate , $Test->[1],$Test->[2],$Test->[3],$Test->[4],$Test->[5],$Test->[6],,$Test->[7]); |
|
471 |
|
472 |
|
473 # Create PKG file |
|
474 CreateFile("$pkgfile_name.pkg", $pkgfile_contents); |
|
475 |
|
476 if(not -e "$pkgfile_name.pkg") |
|
477 { |
|
478 WriteLog("** Problem creating PKG file for $Test->[8] **\n"); |
|
479 $NumberOfFailed++; |
|
480 WriteLog("Failed\n\n"); |
|
481 next; |
|
482 } |
|
483 |
|
484 # Create SIS Install File |
|
485 @retval = system("makesis -v $pkgfile_name.pkg $pkgfile_name.sis > $pkgfile_name.log"); |
|
486 |
|
487 |
|
488 if( $? != 0) |
|
489 { |
|
490 WriteLog("** Problem While Creating SIS file for $Test->[8] **\n"); |
|
491 $NumberOfFailed++; |
|
492 WriteLog("Failed\n\n"); |
|
493 next; |
|
494 } |
|
495 else |
|
496 { |
|
497 WriteLog("Created $Test->[0] file for $Test->[8]\n"); |
|
498 } |
|
499 |
|
500 # Run DumpSIS Test |
|
501 DumpSISFile($Test->[0], $Test->[9], $Test->[10] , $Test->[11] ); |
|
502 |
|
503 unlink("$pkgfile_name.pkg"); |
|
504 } |
|
505 unlink("SupportedLanguageEN.r01"); |
|
506 unlink("SupportedLanguageEN.txt"); |
|
507 unlink("SupportedLanguageFR.txt"); |
|
508 unlink("SupportedLanguageGE.txt"); |
|
509 unlink("SupportedLanguageYW.txt"); |
|
510 unlink("Option1.txt"); |
|
511 unlink("Option2.txt"); |
|
512 |
|
513 DeleteFiles("pkg"); |
|
514 DeleteFolder(); |
|
515 |
|
516 TestDEF092185(); |
|
517 |
|
518 TestPDEF095820(); |
|
519 |
|
520 TestDEF100220(); |
|
521 |
|
522 TestRecursiveDirCreation(); |
|
523 CheckCertExtraction(); |
|
524 |
|
525 TestUnicode(); |
|
526 |
|
527 TestDEF105590(); |
|
528 |
|
529 # Run this test only for USIF |
|
530 if($runMode eq "usif") |
|
531 { |
|
532 TestHiddenFlag(); |
|
533 } |
|
534 |
|
535 SatisfyCoverage(); |
|
536 |
|
537 VerifyErroneousCommandLineArg(); |
|
538 # |
|
539 # Display the result |
|
540 # |
|
541 WriteLog("\n\nTests completed OK\n"); |
|
542 WriteLog(sprintf "Run: %d\n", $NumberOfTests ); |
|
543 WriteLog(sprintf "Passed: %d\n", $NumberOfPassed ); |
|
544 WriteLog(sprintf "%d tests failed out of %d\n", $NumberOfFailed, $NumberOfTests ); |
|
545 |
|
546 sub DeleteFiles |
|
547 { |
|
548 my ($ext) = @_; |
|
549 opendir(DIR3, "."); |
|
550 while (defined($file3=readdir(DIR3))) |
|
551 { |
|
552 $file3 =~ s/\.$ext//; |
|
553 if(-e "$file3.sis") |
|
554 { |
|
555 rmdir $file3; |
|
556 unlink ("$file3.sis"); |
|
557 unlink ("$file3.log"); |
|
558 } |
|
559 } |
|
560 close(DIR3); |
|
561 } |
|
562 |
|
563 sub DeleteFolder |
|
564 { |
|
565 opendir(DIR,".\\package"); |
|
566 my @files = readdir DIR; |
|
567 foreach my $f (@files) |
|
568 { |
|
569 $f =~ s/\.sis//; |
|
570 if(-e "package\\$f.sis") |
|
571 { |
|
572 opendir(DIR1,"$f"); |
|
573 my @sisfiles = readdir DIR1; |
|
574 foreach my $sis (@sisfiles) |
|
575 { |
|
576 unlink("$f\\$sis"); |
|
577 } |
|
578 close (DIR1); |
|
579 } |
|
580 rmdir $f; |
|
581 } |
|
582 close(DIR); |
|
583 } |
|
584 # |
|
585 #Function to write log into file |
|
586 # |
|
587 sub WriteLog |
|
588 { |
|
589 my ($log) = @_; |
|
590 unless( open($fh, ">> $logFile")) |
|
591 { |
|
592 printf STDERR "Can\'t open $logfile:$!\n"; |
|
593 return; |
|
594 } |
|
595 printf $fh $log; |
|
596 printf $log; |
|
597 close $fh; |
|
598 } |
|
599 # |
|
600 # Run DumpSIS with prepared sis file, log and administrate its result |
|
601 # |
|
602 sub DumpSISFile |
|
603 { |
|
604 my ($pkgfile) = @_[0]; |
|
605 my ($expectedResult) = @_[1]; |
|
606 my ($expectedlog_cmdline) = @_[2]; |
|
607 my ($expectedlog_pkg) = @_[3]; |
|
608 $pkgfile =~ s/\.sis//; |
|
609 my ($dumpfolder) =""; |
|
610 my ($dumppkg) =""; |
|
611 |
|
612 @retval = system("dumpsis -x $pkgfile.sis > $pkgfile.log"); |
|
613 |
|
614 $logMsg = sprintf "Expected code:%5d result Code:%5d\n", $expectedResult, $?; |
|
615 WriteLog( $logMsg); |
|
616 |
|
617 $pkgname = $pkgfile; |
|
618 $pkgname =~ s/.*\\//; |
|
619 $dumpfolder = $pkgname; |
|
620 $dumppkg = "$dumpfolder"."/". "$pkgname.pkg"; |
|
621 |
|
622 if( $? == $expectedResult && -e $dumppkg && -s $dumppkg ) |
|
623 { |
|
624 if(CheckLogs($pkgfile,$expectedlog_cmdline,$expectedlog_pkg)) |
|
625 { |
|
626 if("$pkgfile.sis" eq "EmbTest.sis") |
|
627 { |
|
628 $dumpembedded0 = "$dumpfolder"."/sis0/". "sis0.pkg"; |
|
629 $dumpembedded1 = "$dumpfolder"."/sis1/". "sis1.pkg"; |
|
630 if(-e $dumpembedded0 && -s $dumpembedded0 && -e $dumpembedded1 && -s $dumpembedded1) |
|
631 { |
|
632 $NumberOfPassed++; |
|
633 WriteLog("Passed\n\n"); |
|
634 } |
|
635 else |
|
636 { |
|
637 $NumberOfFailed++; |
|
638 WriteLog("Failed\n\n"); |
|
639 } |
|
640 } |
|
641 |
|
642 elsif("$pkgfile.sis" eq "Embsis1.sis") |
|
643 { |
|
644 $dumpembedded0 = "$dumpfolder"."/sis0/". "sis0.pkg"; |
|
645 if(-e $dumpembedded0 && -s $dumpembedded0) |
|
646 { |
|
647 $NumberOfPassed++; |
|
648 WriteLog("Passed\n\n"); |
|
649 } |
|
650 else |
|
651 { |
|
652 $NumberOfFailed++; |
|
653 WriteLog("Failed\n\n"); |
|
654 } |
|
655 } |
|
656 |
|
657 else |
|
658 { |
|
659 if("$pkgfile.sis" eq "pkgversion_c005.sis") |
|
660 { |
|
661 use Cwd; |
|
662 $rootdir = Cwd::abs_path; |
|
663 chdir("$rootdir/$dumpfolder"); |
|
664 |
|
665 # Create SIS Install File from the Dumped PKG File |
|
666 @retval = system("makesis $pkgname.pkg $pkgname.sis"); |
|
667 |
|
668 if($? == 0 && -e "$pkgname.sis") |
|
669 { |
|
670 WriteLog("Successfully created $pkgname.sis from dumped PKG file\n"); |
|
671 $NumberOfPassed++; |
|
672 WriteLog("Passed\n\n"); |
|
673 } |
|
674 else |
|
675 { |
|
676 WriteLog("Error: Failed to create $pkgname.sis from dumped PKG file\n"); |
|
677 $NumberOfFailed++; |
|
678 WriteLog("Failed\n\n"); |
|
679 } |
|
680 |
|
681 chdir($rootdir); |
|
682 } |
|
683 else |
|
684 { |
|
685 $NumberOfPassed++; |
|
686 WriteLog("Passed\n\n"); |
|
687 } |
|
688 } |
|
689 } |
|
690 else |
|
691 { |
|
692 $NumberOfFailed++; |
|
693 WriteLog("Failed\n\n"); |
|
694 } |
|
695 |
|
696 opendir(DIR, $dumpfolder); |
|
697 while (defined($files=readdir(DIR))) |
|
698 { |
|
699 unlink("$dumpfolder"."/"."$files"); |
|
700 } |
|
701 close(DIR); |
|
702 } |
|
703 else |
|
704 { |
|
705 if( $? == $expectedResult) |
|
706 { |
|
707 if(CheckLogs($pkgfile,$expectedlog_cmdline,$expectedlog_pkg)) |
|
708 { |
|
709 $NumberOfPassed++; |
|
710 WriteLog("Passed\n\n"); |
|
711 } |
|
712 else |
|
713 { |
|
714 $NumberOfFailed++; |
|
715 WriteLog("Failed\n\n"); |
|
716 } |
|
717 } |
|
718 else |
|
719 { |
|
720 $NumberOfFailed++; |
|
721 WriteLog("Failed\n\n"); |
|
722 } |
|
723 |
|
724 opendir(DIR, $dumpfolder); |
|
725 while (defined($file=readdir(DIR))) |
|
726 { |
|
727 unlink("$dumpfolder"."/"."$file"); |
|
728 } |
|
729 close(DIR); |
|
730 } |
|
731 |
|
732 if("$pkgfile" eq "package\\ExeTest") |
|
733 { |
|
734 $NumberOfTests++; |
|
735 $testid = sprintf "SEC-SWI-I-DUMPSIS-000%d",$NumberOfTests; |
|
736 WriteLog($testid); |
|
737 |
|
738 @retval = system("dumpsis -l $pkgfile.sis > $pkgfile.log"); |
|
739 WriteLog("\nTest for exe -l option for 1 WINSCW and 2 ARM Executable sis file\n"); |
|
740 $logMsg = sprintf "Expected code:%5d result Code:%5d\n", $expectedResult, $?; |
|
741 WriteLog( $logMsg); |
|
742 |
|
743 if( $? == $expectedResult) |
|
744 { |
|
745 if(CheckLogs($pkgfile,"$pkgfile.out",$expectedlog_pkg)) |
|
746 { |
|
747 $NumberOfPassed++; |
|
748 WriteLog("Passed\n\n"); |
|
749 } |
|
750 else |
|
751 { |
|
752 $NumberOfFailed++; |
|
753 WriteLog("Failed\n\n"); |
|
754 } |
|
755 } |
|
756 else |
|
757 { |
|
758 $NumberOfFailed++; |
|
759 WriteLog("Failed\n\n"); |
|
760 } |
|
761 } |
|
762 |
|
763 unlink("$pkgfile.log"); |
|
764 |
|
765 opendir(DIR, $dumpfolder); |
|
766 while (defined($files=readdir(DIR))) |
|
767 { |
|
768 unlink("$dumpfolder"."/"."$files"); |
|
769 } |
|
770 close(DIR); |
|
771 } |
|
772 |
|
773 sub TestDEF092185 |
|
774 { |
|
775 $DEF092185sis = "DEF092185.sis"; |
|
776 $DEF092185Log = "DEF092185.Log"; |
|
777 $DEF092185pkg = "DEF092185.pkg"; |
|
778 $DumpsisGenPkgPath = "\/DEF092185"; |
|
779 WriteLog("Test for DEF092185 - Test for verifying that makesis creates sis file successfully when pkg file generated from Dumpsis is used.\n"); |
|
780 |
|
781 CreateFile('DEF092185.pkg', $PkgFileTemp); |
|
782 # Create a sis file |
|
783 my $result = system("/epoc32/tools/MAKESIS -v $DEF092185pkg $DEF092185sis > $DEF092185Log "); |
|
784 |
|
785 # Execute DumpSIS on the created DEF091285.sis. |
|
786 my $result1 = system("/epoc32/tools/DUMPSIS $DEF092185sis > $DEF092185Log"); |
|
787 |
|
788 use Cwd; |
|
789 $dir = cwd; |
|
790 chdir $dir.$DumpsisGenPkgPath; |
|
791 |
|
792 #Regenerate DEF091860.sis from the dumpsis generated pkg file. |
|
793 use File::Copy; |
|
794 copy("/epoc32/tools/makesis.exe" , "$dir$DumpsisGenPkgPath"); |
|
795 $result2 = system("makesis.exe -v $DEF092185pkg $DEF092185sis > $DEF092185Log"); |
|
796 chdir $dir; |
|
797 |
|
798 $NumberOfTests++; |
|
799 if ($result == 0 && $result1 == 0 && $result2 == 0) |
|
800 { |
|
801 $NumberOfPassed++; |
|
802 WriteLog("Passed\n\n"); |
|
803 } |
|
804 else |
|
805 { |
|
806 $NumberOfFailed++; |
|
807 WriteLog("Failed\n\n"); |
|
808 } |
|
809 |
|
810 unlink $DEF092185pkg; |
|
811 unlink $DEF092185sis; |
|
812 unlink $DEF092185Log; |
|
813 use File::Path; |
|
814 rmtree "$dir$DumpsisGenPkgPath"; |
|
815 } |
|
816 |
|
817 sub CheckFiles($$) |
|
818 { |
|
819 my ($path, $Files)=@_; |
|
820 my $matches = 0; |
|
821 |
|
822 foreach (@{$Files}) |
|
823 { |
|
824 my $File = $_; |
|
825 if ( -e "$path\\$File" && -s "$path\\$File" ) |
|
826 { |
|
827 return 0; |
|
828 } |
|
829 $matches++; |
|
830 } |
|
831 if ( $matches > 0 ) |
|
832 { |
|
833 return 1; |
|
834 } |
|
835 else |
|
836 { |
|
837 return 0; |
|
838 } |
|
839 } |
|
840 |
|
841 # |
|
842 # Function to check the Command Line log and PKG files generated by DumpSIS |
|
843 # |
|
844 # Parameters: |
|
845 # ARG 0 - Name of the SIS file without an Extension |
|
846 # ARG 1 - Expected log string output by DumpSIS to the Command Line |
|
847 # ARG 2 - Expected string to appear in the contents of the PKG file generated by DumpSIS |
|
848 # |
|
849 # Command Line Log Checking: |
|
850 # The function firstly examines $expectedLog_cmdline (ARG 1) to determine what type of command line log check |
|
851 # is required by the test. |
|
852 # |
|
853 # * If the argument contains "-", the .log file is checked to make sure it is empty and no log information |
|
854 # has been output by DumpSIS |
|
855 # * Else if the argument contains the name of the SIS file (ARG 0) suffixed by ".out", the function compares the |
|
856 # contents of the command line log file to that of the .out file to see whether the output from DumpSIS |
|
857 # matches the expected file |
|
858 # * Otherwise, the command line output for the particular SIS is examined to check whether the |
|
859 # string value within $expectedLog_cmdline appears within the log file. |
|
860 # |
|
861 # If either check is successful, the $cmdlineResult flag is set to 1 |
|
862 # |
|
863 # |
|
864 # PKG File Content Checking: |
|
865 # The function also examines $expectedLog_pkg (ARG 2) to determine whether a PKG fike content check |
|
866 # is required by the test. |
|
867 # |
|
868 # * If the argument contains "-", the PKG file content check is skipped and deemed successful |
|
869 # * Otherwise, the PKG file content generated by the DumpSIS tool is examined to check whether the |
|
870 # $expectedLog_pkg string value appears within the PKG file. |
|
871 # |
|
872 # If either check is successful, the $pkglineResult flag is set to 1 |
|
873 # |
|
874 # |
|
875 # If both flags ($cmdlineResult & $pkglineResult) have been successfully set to 1, the function returns a |
|
876 # 1 to signal the checks have been successful, otherwise 0 is returned to indicate test failure. |
|
877 # |
|
878 sub CheckLogs |
|
879 { |
|
880 my ($filename) = @_[0]; |
|
881 my ($expectedLog_cmdline) = @_[1]; |
|
882 my ($expectedLog_pkg) = @_[2]; |
|
883 |
|
884 my ($cmdlineResult) = 0; |
|
885 my ($pkglineResult) = 0; |
|
886 |
|
887 # ------------------------- |
|
888 # Command Line log Checking |
|
889 # ------------------------- |
|
890 if($expectedLog_cmdline eq "-") |
|
891 { |
|
892 $logMsg = "Expected CmdLine Log: LOG EMPTY\n"; |
|
893 } |
|
894 elsif($expectedLog_cmdline eq "$filename.out") |
|
895 { |
|
896 $logMsg = sprintf "Expected CmdLine Log: Compare Log against .OUT file - %s\n", $expectedLog_cmdline; |
|
897 } |
|
898 else |
|
899 { |
|
900 $logMsg = sprintf "Expected CmdLine Log: %s\n", $expectedLog_cmdline; |
|
901 } |
|
902 WriteLog($logMsg); |
|
903 |
|
904 |
|
905 # Open the contents of the Log File |
|
906 unless (open($logcontent, "$filename.log")) |
|
907 { |
|
908 printf STDERR "Can't open $filename.log: $!\n"; |
|
909 return 0; |
|
910 } |
|
911 |
|
912 if($expectedLog_cmdline eq "-") |
|
913 { |
|
914 # File has zero bytes in size (is empty) |
|
915 if (-z $logcontent) |
|
916 { |
|
917 $cmdlineResult = 1; |
|
918 } |
|
919 else |
|
920 { |
|
921 $logMsg = "Error: Log File Not Empty\n"; |
|
922 WriteLog($logMsg); |
|
923 } |
|
924 } |
|
925 elsif($expectedLog_cmdline eq "$filename.out") |
|
926 { |
|
927 # Compare the contents of the Log against a multiline output file |
|
928 if(compare("$filename.out","$filename.log") == 0) |
|
929 { |
|
930 $cmdlineResult = 1; |
|
931 } |
|
932 else |
|
933 { |
|
934 $logMsg = sprintf "Error: Log file does not match %s\n", $expectedLog_cmdline; |
|
935 WriteLog($logMsg); |
|
936 } |
|
937 } |
|
938 else |
|
939 { |
|
940 foreach $logline (<$logcontent>) |
|
941 { |
|
942 if ($logline =~ m/\Q$expectedLog_cmdline\E/i) |
|
943 { |
|
944 $cmdlineResult = 1; |
|
945 } |
|
946 } |
|
947 |
|
948 if($cmdlineResult == 0) |
|
949 { |
|
950 $logMsg = "Error: Expected Logging Not Found\n"; |
|
951 WriteLog($logMsg); |
|
952 } |
|
953 } |
|
954 |
|
955 close($logcontent); |
|
956 |
|
957 |
|
958 # ------------------------- |
|
959 # PKG File Content Checking |
|
960 # ------------------------- |
|
961 |
|
962 # Define the dumped PKG path |
|
963 $filename =~ s/.*\\//; |
|
964 $dumppkg = $filename."\\$filename.pkg"; |
|
965 |
|
966 if($expectedLog_pkg eq "-") |
|
967 { |
|
968 $logMsg = sprintf "Expected PKG Content: NO CHECK\n"; |
|
969 WriteLog($logMsg); |
|
970 $pkglineResult = 1; |
|
971 } |
|
972 else |
|
973 { |
|
974 $logMsg = sprintf "Expected PKG Content: %s\n", $expectedLog_pkg; |
|
975 WriteLog($logMsg); |
|
976 |
|
977 # Open the contents of the PKG File |
|
978 unless (open($pkgcontent,"$dumppkg")) |
|
979 { |
|
980 printf STDERR "Can't open $filename.pkg: $!\n"; |
|
981 return 0; |
|
982 } |
|
983 |
|
984 foreach $pkgline (<$pkgcontent>) |
|
985 { |
|
986 $pkgline =~ tr/\000//d; |
|
987 if ($pkgline =~ m/\Q$expectedLog_pkg\E/i) |
|
988 { |
|
989 $pkglineResult = 1; |
|
990 } |
|
991 } |
|
992 |
|
993 if($pkglineResult == 0) |
|
994 { |
|
995 $logMsg = "Error: Expected PKG Content Not Found\n"; |
|
996 WriteLog($logMsg); |
|
997 } |
|
998 |
|
999 close($pkgcontent); |
|
1000 } |
|
1001 |
|
1002 if($cmdlineResult == 1 && $pkglineResult == 1) |
|
1003 { |
|
1004 return 1; |
|
1005 } |
|
1006 |
|
1007 return 0; |
|
1008 } |
|
1009 |
|
1010 sub TestPDEF095820 |
|
1011 { |
|
1012 WriteLog("Test for PDEF095820 - Dumpsis doesn't work correctly with embedded sis files.\n"); |
|
1013 |
|
1014 $path = "\\epoc32\\winscw\\c\\tswi\\tsis\\data"; |
|
1015 $embed2lvl = "testembed2lvl"; |
|
1016 $PDEF095820Log = "PDEF095820.Log"; |
|
1017 $DumpsisGenPkgPath = "\/$embed2lvl"; |
|
1018 |
|
1019 # Execute DumpSIS |
|
1020 my $sisfile = "$path\\$embed2lvl.sis"; |
|
1021 if (! -e $sisfile ) |
|
1022 { |
|
1023 $NumberOfTests++; |
|
1024 $NumberOfFailed++; |
|
1025 WriteLog("Failed\n\n"); |
|
1026 exit; |
|
1027 } |
|
1028 my $result = system("/epoc32/tools/DUMPSIS -x $path\\$embed2lvl.sis > $PDEF095820Log"); |
|
1029 if ( $result != 0 ) |
|
1030 { |
|
1031 $NumberOfTests++; |
|
1032 $NumberOfFailed++; |
|
1033 WriteLog("Failed\n\n"); |
|
1034 exit; |
|
1035 } |
|
1036 |
|
1037 use Cwd; |
|
1038 $dir = cwd; |
|
1039 #chdir $dir.$DumpsisGenPkgPath; |
|
1040 |
|
1041 my $filesLvl = 0; |
|
1042 |
|
1043 # Check that all required file are generated and have non-zero sizes |
|
1044 my @main = ("$embed2lvl.pkg", "sis0.sis", "sis1.sis", "sis2.sis", "file0", "certChain0.der"); |
|
1045 my @sis0 = ("sis0.pkg", "file0", "certChain1.der"); |
|
1046 my @sis1 = ("sis1.pkg", "file0", "certChain2.der"); |
|
1047 my @sis2 = ("sis2.pkg", "file0", "file1", "file2", "file3", "certChain3.der"); |
|
1048 $filesLvl += CheckFiles("$dir$DumpsisGenPkgPath\n",\@main); |
|
1049 $filesLvl += CheckFiles("$dir$DumpsisGenPkgPath/sis0\n",\@sis0); |
|
1050 $filesLvl += CheckFiles("$dir$DumpsisGenPkgPath/sis1\n",\@sis1); |
|
1051 $filesLvl += CheckFiles("$dir$DumpsisGenPkgPath/sis2\n",\@sis2); |
|
1052 |
|
1053 $NumberOfTests++; |
|
1054 if ( $filesLvl == 4 ) |
|
1055 { |
|
1056 $NumberOfPassed++; |
|
1057 WriteLog("Passed\n\n"); |
|
1058 } |
|
1059 else |
|
1060 { |
|
1061 $NumberOfFailed++; |
|
1062 WriteLog("Failed\n\n"); |
|
1063 } |
|
1064 |
|
1065 #chdir $dir; |
|
1066 unlink $PDEF095820Log; |
|
1067 use File::Path; |
|
1068 rmtree "$dir$DumpsisGenPkgPath"; |
|
1069 } |
|
1070 |
|
1071 sub TestDEF100220 |
|
1072 { |
|
1073 $DEF100220sis = "DEF100220.sis"; |
|
1074 $DEF100220Log = "DEF100220.Log"; |
|
1075 $DEF100220pkg = "DEF100220.pkg"; |
|
1076 $DumpsisGenPkgPath = "\/DEF100220"; |
|
1077 WriteLog("Test for DEF100220 - Test for verifying that makesis creates sis file successfully when pkg file generated from Dumpsis is used.\n"); |
|
1078 |
|
1079 CreateFile('DEF100220.pkg', $PkgFileTemplate); |
|
1080 # Create a sis file |
|
1081 my $result = system("/epoc32/tools/MAKESIS -v $DEF100220pkg $DEF100220sis > $DEF100220Log "); |
|
1082 |
|
1083 # Execute DumpSIS on the created DEF100220.sis. |
|
1084 my $result1 = system("/epoc32/tools/DUMPSIS $DEF100220sis > $DEF100220Log"); |
|
1085 |
|
1086 use Cwd; |
|
1087 $dir = cwd; |
|
1088 chdir $dir.$DumpsisGenPkgPath; |
|
1089 |
|
1090 #Regenerate DEF100220.sis from the dumpsis generated pkg file. |
|
1091 use File::Copy; |
|
1092 copy("/epoc32/tools/makesis.exe" , "$dir$DumpsisGenPkgPath"); |
|
1093 $result2 = system("makesis.exe -v $DEF100220pkg $DEF100220sis > $DEF100220Log"); |
|
1094 chdir $dir; |
|
1095 |
|
1096 $NumberOfTests++; |
|
1097 if ($result == 0 && $result1 == 0 && $result2 == 0) |
|
1098 { |
|
1099 $NumberOfPassed++; |
|
1100 WriteLog("Passed\n\n"); |
|
1101 } |
|
1102 else |
|
1103 { |
|
1104 $NumberOfFailed++; |
|
1105 WriteLog("Failed\n\n"); |
|
1106 } |
|
1107 |
|
1108 unlink $DEF100220pkg; |
|
1109 unlink $DEF100220sis; |
|
1110 unlink $DEF100220Log; |
|
1111 use File::Path; |
|
1112 rmtree "$dir$DumpsisGenPkgPath"; |
|
1113 } |
|
1114 |
|
1115 |
|
1116 sub TestRecursiveDirCreation |
|
1117 { |
|
1118 $TestSisFile = "DumpsisTest.sis"; |
|
1119 $TestLogFile = "DumpsisTest.Log"; |
|
1120 $TestPkgFile = "DumpsisTest.pkg"; |
|
1121 $DumpsisExtractPath = "\/TestDumpsis\/dir\/creation"; |
|
1122 WriteLog("Test for verifying the ability of dumpsis to create recursive directories if the extraction path is not created.\n"); |
|
1123 |
|
1124 CreateFile($TestPkgFile, $PkgFileTemplate); |
|
1125 # Create a sis file |
|
1126 my $result = system("/epoc32/tools/MAKESIS -v $TestPkgFile $TestSisFile > $TestLogFile "); |
|
1127 |
|
1128 # Execute DumpSIS on the created DumpsisTest.sis. |
|
1129 my $result1 = system("/epoc32/tools/DUMPSIS -d $DumpsisExtractPath $TestSisFile > $TestLogFile"); |
|
1130 my $result2 = 0; |
|
1131 |
|
1132 if(-e "$DumpsisExtractPath\\$TestPkgFile") |
|
1133 { |
|
1134 $result2 = 1; |
|
1135 } |
|
1136 |
|
1137 $NumberOfTests++; |
|
1138 if ($result == 0 && $result1 == 0 && $result2 == 1) |
|
1139 { |
|
1140 $NumberOfPassed++; |
|
1141 WriteLog("Passed\n\n"); |
|
1142 } |
|
1143 else |
|
1144 { |
|
1145 $NumberOfFailed++; |
|
1146 WriteLog("Failed\n\n"); |
|
1147 } |
|
1148 |
|
1149 unlink $TestPkgFile; |
|
1150 unlink $TestLogFile; |
|
1151 unlink $TestSisFile; |
|
1152 use File::Path; |
|
1153 rmtree "\/TestDumpsis"; |
|
1154 } |
|
1155 |
|
1156 # |
|
1157 # Function to create a file (test.txt or any PKG) |
|
1158 # |
|
1159 sub CreateFile { |
|
1160 my ($filename, $contents) = @_; |
|
1161 |
|
1162 unless (open($fh, "> $filename")) { |
|
1163 printf STDERR "Can't open $filename: $!\n"; |
|
1164 return; |
|
1165 } |
|
1166 |
|
1167 print $fh $contents; |
|
1168 close $fh; |
|
1169 } |
|
1170 |
|
1171 sub TestUnicode { |
|
1172 |
|
1173 my $scriptpath = "\\epoc32\\winscw\\c\\tswi\\tdumpsis\\data\\unicodetest"; |
|
1174 |
|
1175 WriteLog("Test for DEF099325 - Unicode named sis files\n"); |
|
1176 |
|
1177 $NumberOfTests++; |
|
1178 # Generate Japanese pkg |
|
1179 system("WScript.exe //B //Nologo $scriptpath\\jpn_filename.vbs"); |
|
1180 |
|
1181 if ( -f "passed.txt") { |
|
1182 $NumberOfPassed++; |
|
1183 WriteLog("Passed\n\n"); |
|
1184 } else { |
|
1185 $NumberOfFailed++; |
|
1186 WriteLog("Failed\n\n"); |
|
1187 } |
|
1188 system("WScript.exe //B //Nologo $scriptpath\\jpn_filename_cleanup.vbs"); |
|
1189 |
|
1190 WriteLog("Test for DEF099325 - UCS2 encoding format.\n"); |
|
1191 |
|
1192 $NumberOfTests++; |
|
1193 # Generate Japanese pkg |
|
1194 system("WScript.exe //B //Nologo $scriptpath\\ucs2jpn.vbs"); |
|
1195 |
|
1196 if ( -f "passed.txt") { |
|
1197 $NumberOfPassed++; |
|
1198 WriteLog("Passed\n\n"); |
|
1199 } else { |
|
1200 $NumberOfFailed++; |
|
1201 WriteLog("Failed\n\n"); |
|
1202 } |
|
1203 system("WScript.exe //B //Nologo $scriptpath\\ucs2jpn_cleanup.vbs"); |
|
1204 |
|
1205 |
|
1206 WriteLog("Test for DEF099325 - Test for Katakana characters and embedded sis file.\n"); |
|
1207 |
|
1208 $NumberOfTests++; |
|
1209 # Generate Japanese pkg |
|
1210 system("WScript.exe //B //Nologo $scriptpath\\embed.vbs"); |
|
1211 |
|
1212 if ( -f "passed.txt") { |
|
1213 $NumberOfPassed++; |
|
1214 WriteLog("Passed\n\n"); |
|
1215 } else { |
|
1216 $NumberOfFailed++; |
|
1217 WriteLog("Failed\n\n"); |
|
1218 } |
|
1219 system("WScript.exe //B //Nologo $scriptpath\\embed_cleanup.vbs"); |
|
1220 |
|
1221 } |
|
1222 |
|
1223 sub TestDEF105590 |
|
1224 { |
|
1225 $DEF105590sis = "DEF105590.sis"; |
|
1226 $DEF105590Log = "DEF105590.Log"; |
|
1227 $DEF105590pkg = "DEF105590.pkg"; |
|
1228 $DEF105590Expectedpkg = "DEF105590Expected.pkg"; |
|
1229 $DumpsisGenPkgPath = "\/DEF105590"; |
|
1230 WriteLog("Test for DEF105590 - Test for verifying that RW is not appended to the generated pkg file from Dumpsis from sis file having FR,RR option.\n"); |
|
1231 |
|
1232 CreateFile('DEF105590.pkg', $PkgFileDEF105590); |
|
1233 CreateFile('DEF105590Expected.pkg', $ExpectedPkgFileDEF105590); |
|
1234 |
|
1235 # Create a sis file |
|
1236 my $result = system("/epoc32/tools/MAKESIS -v $DEF105590pkg $DEF105590sis > $DEF105590Log "); |
|
1237 |
|
1238 # Execute DumpSIS on the created DEF105590.sis. |
|
1239 my $result1 = system("/epoc32/tools/DUMPSIS $DEF105590sis > $DEF105590Log"); |
|
1240 use Cwd; |
|
1241 $dir = cwd; |
|
1242 chdir $dir; |
|
1243 use File::Compare; |
|
1244 my $result3; |
|
1245 my $file1 = $dir."/".$DEF105590Expectedpkg; |
|
1246 my $file2 = $dir.$DumpsisGenPkgPath."/".$DEF105590pkg; |
|
1247 if(compare($file1,$file2)) |
|
1248 { |
|
1249 $result3 = 0; |
|
1250 } |
|
1251 else |
|
1252 { |
|
1253 $result3 = 1; |
|
1254 } |
|
1255 $NumberOfTests++; |
|
1256 |
|
1257 if ($result == 0 && $result1 == 0 && $result3 == 0) |
|
1258 { |
|
1259 $NumberOfPassed++; |
|
1260 WriteLog("Passed\n\n"); |
|
1261 } |
|
1262 else |
|
1263 { |
|
1264 $NumberOfFailed++; |
|
1265 WriteLog("Failed\n\n"); |
|
1266 } |
|
1267 chdir $dir; |
|
1268 unlink $DEF105590Expectedpkg; |
|
1269 unlink $DEF105590pkg; |
|
1270 unlink $DEF105590sis; |
|
1271 unlink $DEF105590Log; |
|
1272 use File::Path; |
|
1273 rmtree "$dir$DumpsisGenPkgPath"; |
|
1274 } |
|
1275 # |
|
1276 # SEC-DumpSIS-Hide-001 |
|
1277 # Tests the MakeSIS and DumpSIS for the support of a new installtion flag HIDE / H (to represent Hidden component) in the package file. |
|
1278 # |
|
1279 sub TestHiddenFlag |
|
1280 { |
|
1281 $Hiddensis = "Hidden.sis"; |
|
1282 $HiddenLog = "Hidden.Log"; |
|
1283 $Hiddenpkg = "Hidden.pkg"; |
|
1284 $ExpectedHiddenpkg = "ExpectedHidden.pkg"; |
|
1285 $DumpsisGenPkgPath = "\/Hidden"; |
|
1286 WriteLog("Test for Hidden package - Test for verifying that the installation flag HIDE is properly processed by DumpSis.\n"); |
|
1287 |
|
1288 CreateFile('Hidden.pkg', $PkgFileHidden); |
|
1289 CreateFile('ExpectedHidden.pkg', $ExpectedPkgFileHidden); |
|
1290 |
|
1291 # Create a sis file |
|
1292 my $result = system("/epoc32/tools/MAKESIS -v $Hiddenpkg $Hiddensis > $HiddenLog "); |
|
1293 |
|
1294 # Execute DumpSIS on the created Hidden.sis. |
|
1295 my $result1 = system("/epoc32/tools/DUMPSIS $Hiddensis > $HiddenLog"); |
|
1296 use Cwd; |
|
1297 $dir = cwd; |
|
1298 chdir $dir; |
|
1299 use File::Compare; |
|
1300 my $result3; |
|
1301 my $file1 = $dir."/".$ExpectedHiddenpkg; |
|
1302 my $file2 = $dir.$DumpsisGenPkgPath."/".$Hiddenpkg; |
|
1303 if(compare($file1,$file2)) |
|
1304 { |
|
1305 $result3 = 0; |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 $result3 = 1; |
|
1310 } |
|
1311 $NumberOfTests++; |
|
1312 |
|
1313 if ($result == 0 && $result1 == 0 && $result3 == 0) |
|
1314 { |
|
1315 $NumberOfPassed++; |
|
1316 WriteLog("Passed\n\n"); |
|
1317 } |
|
1318 else |
|
1319 { |
|
1320 $NumberOfFailed++; |
|
1321 WriteLog("Failed\n\n"); |
|
1322 } |
|
1323 chdir $dir; |
|
1324 unlink $ExpectedHiddenpkg; |
|
1325 unlink $Hiddenpkg; |
|
1326 unlink $Hiddensis; |
|
1327 unlink $HiddenLog; |
|
1328 use File::Path; |
|
1329 rmtree "$dir$DumpsisGenPkgPath"; |
|
1330 } |
|
1331 |
|
1332 sub CheckCertExtraction |
|
1333 { |
|
1334 my $TestLogFile = "DumpsisTest.Log"; |
|
1335 my $TestPkgFile = "DumpsisTest.pkg"; |
|
1336 my $TestSisFile = "DumpsisTest.sis"; |
|
1337 my $TestSignedSisFile = "DumpsisSigned.sis"; |
|
1338 my $outputDir = "ExtractedFiles"; |
|
1339 my $certFileName = "$outputDir\\certChain01.der"; |
|
1340 |
|
1341 WriteLog("Testing certificate extraction\n"); |
|
1342 |
|
1343 CreateFile($TestPkgFile, $PkgFileTemplate); |
|
1344 |
|
1345 my $result = system("/epoc32/tools/makeSIS $TestPkgFile $TestSisFile > $TestLogFile"); |
|
1346 |
|
1347 if(0 == $result) |
|
1348 { |
|
1349 $result = system("/epoc32/tools/signsis -s $TestSisFile $TestSignedSisFile \\epoc32\\winscw\\c\\tswi\\tsignsis\\default.cer \\epoc32\\winscw\\c\\tswi\\tsignsis\\default.key > $TestLogFile"); |
|
1350 } |
|
1351 |
|
1352 if(0 == $result) |
|
1353 { |
|
1354 $result = system("/epoc32/tools/DUMPSIS -x -i -d $outputDir $TestSignedSisFile > $TestLogFile"); |
|
1355 } |
|
1356 |
|
1357 $NumberOfTests++; |
|
1358 |
|
1359 if ($result == 0 && -e $certFileName) |
|
1360 { |
|
1361 $NumberOfPassed++; |
|
1362 WriteLog("Passed\n\n"); |
|
1363 } |
|
1364 else |
|
1365 { |
|
1366 $NumberOfFailed++; |
|
1367 WriteLog("Failed\n\n"); |
|
1368 } |
|
1369 |
|
1370 $NumberOfTests++; |
|
1371 |
|
1372 WriteLog("Testing version message display\n"); |
|
1373 $result = system("/epoc32/tools/DUMPSIS -v > $TestLogFile"); |
|
1374 if ($result == 0) |
|
1375 { |
|
1376 $NumberOfPassed++; |
|
1377 WriteLog("Passed\n\n"); |
|
1378 } |
|
1379 else |
|
1380 { |
|
1381 $NumberOfFailed++; |
|
1382 WriteLog("Failed\n\n"); |
|
1383 } |
|
1384 |
|
1385 unlink $certFileName; |
|
1386 unlink $TestSignedSisFile; |
|
1387 unlink $TestSisFile; |
|
1388 unlink $TestPkgFile; |
|
1389 unlink $TestLogFile; |
|
1390 use File::Path; |
|
1391 rmtree "$outputDir"; |
|
1392 } |
|
1393 |
|
1394 sub SatisfyCoverage |
|
1395 { |
|
1396 my $TestLogFile = "DumpsisTest.Log"; |
|
1397 |
|
1398 WriteLog("Testing help message display\n"); |
|
1399 my $result = system("/epoc32/tools/DUMPSIS -h > $TestLogFile"); |
|
1400 |
|
1401 $NumberOfTests++; |
|
1402 |
|
1403 if ($result == 0) |
|
1404 { |
|
1405 $NumberOfPassed++; |
|
1406 WriteLog("Passed\n\n"); |
|
1407 } |
|
1408 else |
|
1409 { |
|
1410 $NumberOfFailed++; |
|
1411 WriteLog("Failed\n\n"); |
|
1412 } |
|
1413 |
|
1414 $NumberOfTests++; |
|
1415 |
|
1416 WriteLog("Testing version message display\n"); |
|
1417 $result = system("/epoc32/tools/DUMPSIS -v > $TestLogFile"); |
|
1418 if ($result == 0) |
|
1419 { |
|
1420 $NumberOfPassed++; |
|
1421 WriteLog("Passed\n\n"); |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 $NumberOfFailed++; |
|
1426 WriteLog("Failed\n\n"); |
|
1427 } |
|
1428 |
|
1429 unlink $TestLogFile; |
|
1430 } |
|
1431 |
|
1432 sub VerifyErroneousCommandLineArg |
|
1433 { |
|
1434 my $TestLogFile = "DumpsisTest.Log"; |
|
1435 my $ErrOutputFile = "DumpsisErr.out"; |
|
1436 my $ErrFile = "DumpsisTest.err"; |
|
1437 my $errMsg1 = "DumpSIS: Error in command: no SIS file specified\n"; |
|
1438 my $errMsg2 = "DumpSIS: Error in command: too many SIS files specified\n"; |
|
1439 my $errMsg3 = "DumpSIS: Error in command: No argument supplied with the -d flag\n"; |
|
1440 |
|
1441 WriteLog("Testing invalid command line arguments\n"); |
|
1442 CreateFile($ErrFile, $errMsg1); |
|
1443 my $result1 = system("/epoc32/tools/DUMPSIS 2> $ErrOutputFile > $TestLogFile"); |
|
1444 my $result = 1; |
|
1445 |
|
1446 if( !((compare($ErrFile,$ErrOutputFile) == 0) && $result1 == 256)) |
|
1447 { |
|
1448 $result = 0; |
|
1449 } |
|
1450 |
|
1451 CreateFile($ErrFile, $errMsg2); |
|
1452 $result1 = system("/epoc32/tools/DUMPSIS sis1.sis sis2.sis sis3.sis 2> $ErrOutputFile > $TestLogFile"); |
|
1453 |
|
1454 if( !((compare($ErrFile,$ErrOutputFile) == 0) && $result1 == 256)) |
|
1455 { |
|
1456 $result = 0; |
|
1457 } |
|
1458 |
|
1459 CreateFile($ErrFile, $errMsg3); |
|
1460 $result1 = system("/epoc32/tools/DUMPSIS -d 2> $ErrOutputFile > $TestLogFile"); |
|
1461 |
|
1462 if( !((compare($ErrFile,$ErrOutputFile) == 0) && $result1 == 256)) |
|
1463 { |
|
1464 $result = 0; |
|
1465 } |
|
1466 |
|
1467 $NumberOfTests++; |
|
1468 if ($result == 1) |
|
1469 { |
|
1470 $NumberOfPassed++; |
|
1471 WriteLog("Passed\n\n"); |
|
1472 } |
|
1473 else |
|
1474 { |
|
1475 $NumberOfFailed++; |
|
1476 WriteLog("Failed\n\n"); |
|
1477 } |
|
1478 |
|
1479 unlink $ErrFile; |
|
1480 unlink $ErrOutputFile; |
|
1481 unlink $TestLogFile; |
|
1482 } |
|
1483 |