ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Testing/TestSuite.pm
(Generate patch)

Comparing COMP/SCRAM/src/Testing/TestSuite.pm (file contents):
Revision 1.1 by sashby, Wed Aug 17 14:31:41 2005 UTC vs.
Revision 1.2 by sashby, Wed Aug 17 16:00:43 2005 UTC

# Line 44 | Line 44 | require 5.004;
44   use Exporter;
45   use Installation::SCRAM_SITE;
46   use SCRAM::SCRAM;
47 + use Cwd;
48  
49   @ISA=qw(Exporter);
50   @EXPORT_OK=qw( );
# Line 64 | Line 65 | sub new()
65     my $class=ref($proto) || $proto;
66     my $self={};
67     bless $self,$class;
68 <  
68 >   $self->{TESTREPORT}={};
69     $self->{SCRAM} = SCRAM::SCRAM->new();
70     $self->{COMMANDS} = $self->{SCRAM}->commands();
71     $self->{SCRAMMAIN} = $ENV{'SCRAM_HOME'}."/src/main/scram.pl";
# Line 72 | Line 73 | sub new()
73     # Check to make sure that SCRAM installation has already been done:
74     die "SCRAM TestSuite: Unable to find the installed scram script!","\n"
75        if (! -f $self->{SCRAMMAIN});
76 <  
76 >   $self->init_();
77     return $self;
78     }
79  
80 + sub init_()
81 +   {
82 +   my $self=shift;
83 +  
84 +   # Set up parameters needed for the tests:
85 +   my $SANDBOX=cwd()."/SandBoxForTestSuite";
86 +   # Get rid of existing dir:
87 +   if ( -d $SANDBOX )
88 +      {
89 +      system("rm","-rf",$SANDBOX);      
90 +      }
91 +  
92 +   # Create new sandbox:
93 +   mkdir($SANDBOX);
94 +   $self->{WORKDIR} = $SANDBOX;
95 +   chdir($self->{WORKDIR});
96 +   $self->{PROJECTNAME} = "SCRAMTestSuite";
97 +   $self->{PROJECTVERSION} = "1.0";
98 +   $SELF->{PROJECTINSTALLNAME} = "SCRAMtsdev";
99 +  
100 +   }
101 +
102   sub run()
103     {
104     my $self=shift;
105 <   map { print "-> Running test for \"".$_."\" command\n"; $self->$_(); }
105 >   map { print "-> Running test for \"".$_."\" command\n\n"; $self->$_(); }
106     @{$self->{COMMANDS}};
107     }
108  
109   sub statusreport()
110     {
111     my $self=shift;
112 +   print "\n";
113 +   foreach my $cmd (keys %{$self->{TESTREPORT}})
114 +      {
115 +      print "Report for ".uc($cmd)." tests:","\n";
116 +
117 +      foreach my $detail (@{$self->{TESTREPORT}->{$cmd}})
118 +         {
119 +         print "\t".$detail->[0]." (status = ".$detail->[1].")","\n";
120 +         }
121 +      print "\n";
122 +      }
123 +  
124     }
125  
126 < sub version()
126 > sub log()
127     {
128     my $self=shift;
129 +   my ($cmd,$message,$status)=@_;
130 +
131 +   if (exists($self->{TESTREPORT}->{$cmd}))
132 +      {
133 +      push(@{$self->{TESTREPORT}->{$cmd}},[ $message, $status ]);
134 +      }
135 +   else
136 +      {
137 +      $self->{TESTREPORT}->{$cmd} = [ [ $message, $status ] ];
138 +      }
139     }
140  
141 < sub arch()
141 >
142 > #### Command Routines ####
143 > sub version()
144     {
145     my $self=shift;
146 +   my $status = system($self->{SCRAMMAIN},"version","-h");
147 +   $self->log("version","Test of help functionality", $status);
148 +   my $status = system($self->{SCRAMMAIN},"version","-c");
149 +   $self->log("version","Test of \"-c\" argument", $status);
150 +   my $status = system($self->{SCRAMMAIN},"version","-i");
151 +   $self->log("version","Test of \"-i\" argument", $status);
152     }
153  
154 < sub runtime()
154 > sub arch()
155     {
156     my $self=shift;
157 +   my $status = system($self->{SCRAMMAIN},"arch","-h");
158 +   $self->log("arch","Test of help functionality", $status);
159 +   my $status = system($self->{SCRAMMAIN},"-arch","TEST_ARCHITECTURE","arch");
160 +   $self->log("arch","Test of -arch argument", $status);
161     }
162  
163 < sub config()
163 > sub urlget()
164     {
165     my $self=shift;
166 +   my $status = system($self->{SCRAMMAIN},"urlget","-h");
167 +   $self->log("urlget","Test of help functionality", $status);
168     }
169  
170   sub list()
171     {
172     my $self=shift;
173 +   my $status = system($self->{SCRAMMAIN},"list","-h");
174 +   $self->log("list","Test of help functionality", $status);
175 +
176 +      
177 +   $ENV{SCRAM_USERLOOKUPDB} = "";
178     }
179  
180   sub db()
181     {
182     my $self=shift;
183 +   my $status = system($self->{SCRAMMAIN},"db","-h");
184 +   $self->log("db","Test of help functionality", $status);
185 +
186 +  
187 +  
188     }
189  
190 < sub urlget()
190 >
191 >
192 >
193 >
194 > sub project()
195     {
196     my $self=shift;
197 +   my $status = system($self->{SCRAMMAIN},"project","-h");
198 +   $self->log("project","Test of help functionality", $status);
199 +
200 +
201 +   # Create a new project:
202 +
203 +   # Install it:
204 +
205 +   # Create a developer area, rename it, install it in a different directory:
206 +
207 +   # Remove project from database:
208 +  
209 +
210     }
211  
212 < sub project()
212 > sub runtime()
213 >   {
214 >   my $self=shift;
215 >   my $status = system($self->{SCRAMMAIN},"runtime","-h");
216 >   $self->log("runtime","Test of help functionality", $status);
217 >
218 >
219 >   }
220 >
221 > sub config()
222     {
223     my $self=shift;
224 +   my $status = system($self->{SCRAMMAIN},"config","-h");
225 +   $self->log("config","Test of help functionality", $status);
226 +
227 +  
228     }
229  
230   sub setup()
231     {
232     my $self=shift;
233 +   my $status = system($self->{SCRAMMAIN},"setup","-h");
234 +   $self->log("setup","Test of help functionality", $status);  
235     }
236  
237   sub tool()
238     {
239     my $self=shift;
240 +   my $status = system($self->{SCRAMMAIN},"tool","-h");
241 +   $self->log("tool","Test of help functionality", $status);  
242 +
243     }
244  
245   sub ui()
246     {
247     my $self=shift;
248 +   my $status = system($self->{SCRAMMAIN},"ui","-h");
249 +   $self->log("ui","Test of help functionality", $status);  
250     }
251  
252   sub build()
253     {
254     my $self=shift;
255 +   my $status = system($self->{SCRAMMAIN},"build","-h");
256 +   $self->log("build","Test of help functionality", $status);  
257     }
258  
259   sub xmlmigrate()
260     {
261     my $self=shift;
262 +   my $status = system($self->{SCRAMMAIN},"xmlmigrate","-h");
263 +   $self->log("xmlmigrate","Test of help functionality", $status);  
264     }
265  
266   sub install()
267     {
268     my $self=shift;
269 +   my $status = system($self->{SCRAMMAIN},"install","-h");
270 +   $self->log("install","Test of help functionality", $status);
271     }
272  
273   sub remove()
274     {
275 <   my $self=shift;  
275 >   my $self=shift;
276 >   my $status = system($self->{SCRAMMAIN},"remove","-h");
277 >   $self->log("remove","Test of help functionality", $status);
278     }
279  
280  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines