|
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 "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: This file contains capsmodifier implementation. |
|
15 :: |
|
16 |
|
17 @perl -x createtestmodule.bat %* |
|
18 @goto end |
|
19 |
|
20 #!perl -w |
|
21 use strict; |
|
22 use Term::ReadLine; |
|
23 |
|
24 my $moduletype = ""; |
|
25 my $modulename = ""; |
|
26 my $modulepath = ""; |
|
27 |
|
28 |
|
29 my $hardcoded = "hardcoded"; |
|
30 my $testclass = "testclass"; |
|
31 my $kerneltestclass = "kerneltest"; |
|
32 my $capsmodifier = "capsmodifier"; |
|
33 |
|
34 |
|
35 my $hardcodedi = "h"; |
|
36 my $testclassi = "t"; |
|
37 my $kerneltestclassi = "k"; |
|
38 my $capsmodifieri = "c"; |
|
39 |
|
40 my $term = new Term::ReadLine 'Simple Perl calc'; |
|
41 my $prompttype = "Enter ModuleType (name/short cut): "; |
|
42 my $promptname = "Enter ModuleName (or exit): "; |
|
43 my $promptpath = "Enter path [default is drive root] (or exit): "; |
|
44 my $exit = "exit"; |
|
45 my $exiti = "e"; |
|
46 |
|
47 sub PrintHelp(); |
|
48 |
|
49 if ( $#ARGV >= 0 ) |
|
50 { |
|
51 $moduletype = $ARGV[0]; |
|
52 if( $moduletype eq "help" ) |
|
53 { |
|
54 PrintHelp(); |
|
55 } |
|
56 } |
|
57 else |
|
58 { |
|
59 print "Enter ModuleType :\n"; |
|
60 |
|
61 print "\t($hardcodedi) $hardcoded = creates test module that uses hardcoded test cases.\n"; |
|
62 print "\t($testclassi) $testclass = creates test class which is used with TestScripter.\n"; |
|
63 print "\t($kerneltestclassi) $kerneltestclass = creates kernel test class which is used with TestScripter (only for kernel testing!).\n"; |
|
64 print "\t($capsmodifieri) $capsmodifier = creates capability modification module\n"; |
|
65 print "\t($exiti) $exit = Exit.\n"; |
|
66 |
|
67 |
|
68 $moduletype = $term->readline($prompttype); |
|
69 if( $moduletype eq $exit || $moduletype eq $exiti) |
|
70 { |
|
71 exit; |
|
72 } |
|
73 } |
|
74 if( $moduletype ne $hardcoded && $moduletype ne $testclass && $moduletype ne $kerneltestclass && $moduletype ne $capsmodifier && $moduletype ne $hardcodedi && $moduletype ne $testclassi && $moduletype ne $kerneltestclassi && $moduletype ne $capsmodifieri ) |
|
75 { |
|
76 print "\nInvalid module type\n"; |
|
77 print "See createtestmodule help\n"; |
|
78 exit; |
|
79 } |
|
80 |
|
81 if ( $#ARGV >= 1 ) |
|
82 { |
|
83 $modulename = $ARGV[1]; |
|
84 } |
|
85 else |
|
86 { |
|
87 |
|
88 |
|
89 if( $moduletype eq $hardcoded || $moduletype eq $hardcodedi ) |
|
90 { |
|
91 print "$hardcoded module selected.\n"; |
|
92 } |
|
93 elsif( $moduletype eq $testclass || $moduletype eq $testclassi ) |
|
94 { |
|
95 print "$testclass module selected.\n"; |
|
96 } |
|
97 elsif( $moduletype eq $kerneltestclass || $moduletype eq $kerneltestclassi ) |
|
98 { |
|
99 print "$kerneltestclass module selected.\n"; |
|
100 } |
|
101 elsif( $moduletype eq $capsmodifier || $moduletype eq $capsmodifieri ) |
|
102 { |
|
103 print "$capsmodifier module selected.\n"; |
|
104 } |
|
105 |
|
106 print "Enter ModuleName which has to be a valid C++ variable name.\n"; |
|
107 |
|
108 $modulename = $term->readline($promptname); |
|
109 |
|
110 if( $modulename eq $exit || $modulename eq $exiti) |
|
111 { |
|
112 exit; |
|
113 } |
|
114 } |
|
115 if ( $#ARGV >= 2 ) |
|
116 { |
|
117 $modulepath = $ARGV[2]; |
|
118 } |
|
119 else |
|
120 { |
|
121 $modulepath = $term->readline($promptpath); |
|
122 if( $modulepath eq $exit || $modulepath eq $exiti ) |
|
123 { |
|
124 exit; |
|
125 } |
|
126 } |
|
127 |
|
128 $modulepath.= "\\"; |
|
129 |
|
130 print "Create test module of type $moduletype with name $modulename "; |
|
131 |
|
132 |
|
133 if ( $modulepath eq "" ) |
|
134 { |
|
135 print "to current drive root\n"; |
|
136 } |
|
137 else |
|
138 { |
|
139 print "to $modulepath\n"; |
|
140 } |
|
141 |
|
142 my @args = ("$modulename", "$modulepath"); |
|
143 |
|
144 |
|
145 if( $moduletype eq $hardcoded || $moduletype eq $hardcodedi ) |
|
146 { |
|
147 chdir "HardCodedTestModuleXXX"; |
|
148 system("perl -x createhardcodedmodule.bat @args"); |
|
149 } |
|
150 elsif( $moduletype eq $testclass || $moduletype eq $testclassi ) |
|
151 { |
|
152 chdir "TemplateScriptXXX"; |
|
153 system("perl -x CreateTestClass.bat @args"); |
|
154 } |
|
155 elsif( $moduletype eq $kerneltestclass || $moduletype eq $kerneltestclassi ) |
|
156 { |
|
157 chdir "TemplateKernelScriptXXX"; |
|
158 system("perl -x CreateKernelTestClass.bat @args"); |
|
159 } |
|
160 |
|
161 elsif( $moduletype eq $capsmodifier || $moduletype eq $capsmodifieri ) |
|
162 { |
|
163 chdir "CapsModifierXXX"; |
|
164 system("perl -x CreateCapsModifier.bat @args"); |
|
165 } |
|
166 |
|
167 |
|
168 |
|
169 exit; |
|
170 |
|
171 sub PrintHelp() |
|
172 { |
|
173 print "CreateTestModule [ModuleType] [ModuleName] [path]\n"; |
|
174 print "\n"; |
|
175 print "Creates a new test module\n"; |
|
176 print "ModuleType defines the type of test module:.\n"; |
|
177 print "\thardcoded = creates test module that uses hardcoded test cases.\n"; |
|
178 print "\ttestclass = creates test class which is used with TestScripter.\n"; |
|
179 print "\tkerneltestclass = creates kernel test class which is used with TestScripter (only for kernel testing!).\n"; |
|
180 print "\tcapsmodifier = creates capability modification module\n"; |
|
181 print "If no arguments are given, they are asked from user.\n"; |
|
182 print "If [path] is given, it must contain the final \'\\\' in path name.\n"; |
|
183 print "Command must be executed in STIFTestFramework\\TestModuleTemplates directory\n"; |
|
184 exit; |
|
185 } |
|
186 |
|
187 __END__ |
|
188 :end |