ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/test/test_ToolBox.pm
Revision: 1.1.2.3.2.5
Committed: Mon Aug 14 12:37:30 2000 UTC (24 years, 9 months ago) by williamc
Content type: text/plain
Branch: HPWbranch
CVS Tags: V0_18_0, V0_17_1, V0_17_0, V0_16_4, V0_16_3, V0_16_2, V0_16_1, V0_16_0, V0_15_1, V0_15_0, V0_15_0beta, V0_14_0
Branch point for: V0_17branch, V0_16branch, V0_15branch
Changes since 1.1.2.3.2.4: +6 -0 lines
Log Message:
Eliminate SCRAM_ARCH variable

File Contents

# User Rev Content
1 williamc 1.1.2.1 #
2     # ToolBox.pm test suite
3     #
4    
5     package BuildSystem::test::test_ToolBox;
6     require 5.001;
7     use BuildSystem::ToolBox;
8    
9     @ISA=qw(Utilities::TestClass); #methods both from the test class
10    
11     sub init {
12     my $self=shift;
13     $self->{testarea}=$self->temparea()."/TestArea";
14 williamc 1.1.2.3.2.4 $self->{copytoolfiledir}=$self->temparea()."/TFD";
15     $self->{copydatastore}=$self->temparea()."/Data";
16     $self->{distarea}=$self->temparea()."/CopyArea";
17 williamc 1.1.2.3.2.1 $self->{testfile}=$self->datadir()."/ToolBoxTool";
18 williamc 1.1.2.3 $self->{reqdoc}=$self->datadir()."/RequirementsDocTest";
19 williamc 1.1.2.3.2.1 $self->{cache}=URL::URLcache->new($self->{testarea}."/cache");
20 williamc 1.1.2.3.2.5 $self->{archdir}=$self->temparea();
21 williamc 1.1.2.1
22 williamc 1.1.2.3.2.1 # -- make a dummy area
23     $self->{projconfigdir}="config";
24 williamc 1.1.2.1 $ENV{SCRAM_ARCH}="TestArch";
25 williamc 1.1.2.3.2.1 $ENV{dummyvar}=$self->{testarea};
26 williamc 1.1.2.1
27 williamc 1.1.2.3.2.1 AddDir::adddir($self->{testarea}."/".$self->{projconfigdir});
28 williamc 1.1.2.1 use File::Copy;
29     my $depsfile="External_Dependencies";
30     $self->{testdepsfile}=$self->datadir()."/".$depsfile;
31 williamc 1.1.2.3.2.1 copy($self->{testdepsfile},$self->{testarea}."/"
32     .$self->{projconfigdir}."/".$depsfile)
33 williamc 1.1.2.1 or die $!."\n";
34     }
35    
36     sub test {
37     my $self=shift;
38     $self->newtest("Initiation test");
39 williamc 1.1.2.3 $self->newobject($self);
40 williamc 1.1.2.1 $self->testinterface("verbosity","1");
41    
42    
43     $self->newtest("Tool Setup Testing");
44 williamc 1.1.2.3.2.1 $self->testinterface("toolsetup","test","version1",
45     "file:".$self->{testfile});
46 williamc 1.1.2.1
47 williamc 1.1.2.3.2.1 $self->newtest("Second Tool Setup Testing - different version");
48     $self->testinterface("toolsetup","test","version2",
49     "file:".$self->{testfile});
50    
51     $self->newtest("Third Tool Setup Testing - different tool");
52     $self->testinterface("toolsetup","anothertest","version2",
53     "file:".$self->{testfile});
54    
55     # -- check the tool, versions etc are consistent
56     $self->_testtoolmeta();
57 williamc 1.1.2.1
58     $self->newtest("Tool Setup Testing - url from tool object");
59     $self->testinterface("toolsetup","test","version1");
60    
61     $self->newtest("Tool Setup Testing - url from tool object ".
62     "and default version");
63     $self->testinterface("toolsetup","test");
64    
65 williamc 1.1.2.3.2.1 # -- still consistent ?
66     $self->_testtoolmeta();
67    
68     # -- Persistency Testing
69     $self->newtest("New ToolBox restoration test");
70     $self->newobject($self);
71     $self->_testtoolmeta();
72    
73 williamc 1.1.2.1 $self->newtest("gettool test - undefined expected");
74     $self->expect(undef);
75     $self->testinterface("gettool","notool");
76     $self->testinterface("gettool","notool","noversion");
77     $self->clearexpect();
78 williamc 1.1.2.2
79 williamc 1.1.2.3.2.2 $self->newtest("gettool test - tool expected");
80     my $tool=$self->testinterface("gettool","test");
81     if ( (defined $tool ) && (($tool->version() eq "version1" )
82     && ( $tool->name eq "test" )) ) {
83     $self->testpass("Correct tool Returned OK");
84 williamc 1.1.2.3.2.3 $self->cmpstring("file:".$self->{testfile},$tool->url());
85 williamc 1.1.2.3.2.2 }
86     else {
87     $self->testfail("Correct tool NOT passed back");
88     }
89    
90 williamc 1.1.2.2 $self->newtest("Setting a Searcher");
91     $self->testinterface("searcher");
92 williamc 1.1.2.3.2.4
93     $self->newtest("ToolBox Copy");
94     $self->testinterface("copytools",$self);
95     $self->verify($self->{object}->{tooladmin},$self->datastore()."/admin");
96 williamc 1.1.2.1 }
97    
98 williamc 1.1.2.3.2.1 sub _testtoolmeta {
99 williamc 1.1.2.1 my $self=shift;
100 williamc 1.1.2.3.2.1 $self->newtest("Check Tools are registered");
101     $self->expect("test","anothertest");
102     $self->testinterface("tools");
103     $self->clearexpect();
104    
105     $self->newtest("Default Version Test");
106     $self->expect("version1");
107     $self->testinterface("defaultversion","test");
108     $self->clearexpect();
109     $self->expect("version1","version2");
110     $self->testinterface("versions", "test");
111     $self->clearexpect();
112     $self->expect("version2");
113     $self->testinterface("versions", "anothertest");
114     $self->testinterface("defaultversion","anothertest");
115     $self->clearexpect();
116 williamc 1.1.2.3 }
117    
118     # --- stubs
119    
120     sub location {
121     my $self=shift;
122     return $self->{testarea};
123     }
124    
125     sub configurationdir {
126     my $self=shift;
127 williamc 1.1.2.3.2.1 return $self->{testarea}."/".$self->{projconfigdir};
128 williamc 1.1.2.3 }
129    
130     sub requirementsdoc {
131     my $self=shift;
132     return $self->{reqdoc};
133 williamc 1.1.2.3.2.1 }
134    
135     sub cache {
136     my $self=shift;
137     return $self->{cache};
138 williamc 1.1.2.3.2.4 }
139    
140    
141     # -- stubs for copy
142    
143     sub toolfiledir {
144     my $self=shift;
145     return $self->{copytoolfiledir};
146     }
147    
148     sub datastore {
149     my $self=shift;
150     return $self->{copydatastore};
151 williamc 1.1.2.3.2.5 }
152    
153     sub archdir {
154     my $self=shift;
155     return $self->{archdir};
156 williamc 1.1.2.1 }