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.2
Committed: Thu Aug 10 13:40:55 2000 UTC (24 years, 9 months ago) by williamc
Content type: text/plain
Branch: HPWbranch
Changes since 1.1.2.3.2.1: +10 -0 lines
Log Message:
New gettool test

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.1 $self->{testfile}=$self->datadir()."/ToolBoxTool";
15 williamc 1.1.2.3 $self->{reqdoc}=$self->datadir()."/RequirementsDocTest";
16 williamc 1.1.2.3.2.1 $self->{cache}=URL::URLcache->new($self->{testarea}."/cache");
17 williamc 1.1.2.1
18 williamc 1.1.2.3.2.1 # -- make a dummy area
19     $self->{projconfigdir}="config";
20 williamc 1.1.2.1 $ENV{SCRAM_ARCH}="TestArch";
21 williamc 1.1.2.3.2.1 $ENV{dummyvar}=$self->{testarea};
22 williamc 1.1.2.1
23 williamc 1.1.2.3.2.1 AddDir::adddir($self->{testarea}."/".$self->{projconfigdir});
24 williamc 1.1.2.1 use File::Copy;
25     my $depsfile="External_Dependencies";
26     $self->{testdepsfile}=$self->datadir()."/".$depsfile;
27 williamc 1.1.2.3.2.1 copy($self->{testdepsfile},$self->{testarea}."/"
28     .$self->{projconfigdir}."/".$depsfile)
29 williamc 1.1.2.1 or die $!."\n";
30     }
31    
32     sub test {
33     my $self=shift;
34     $self->newtest("Initiation test");
35 williamc 1.1.2.3 $self->newobject($self);
36 williamc 1.1.2.1 $self->testinterface("verbosity","1");
37    
38    
39     $self->newtest("Tool Setup Testing");
40 williamc 1.1.2.3.2.1 $self->testinterface("toolsetup","test","version1",
41     "file:".$self->{testfile});
42 williamc 1.1.2.1
43 williamc 1.1.2.3.2.1 $self->newtest("Second Tool Setup Testing - different version");
44     $self->testinterface("toolsetup","test","version2",
45     "file:".$self->{testfile});
46    
47     $self->newtest("Third Tool Setup Testing - different tool");
48     $self->testinterface("toolsetup","anothertest","version2",
49     "file:".$self->{testfile});
50    
51     # -- check the tool, versions etc are consistent
52     $self->_testtoolmeta();
53 williamc 1.1.2.1
54     $self->newtest("Tool Setup Testing - url from tool object");
55     $self->testinterface("toolsetup","test","version1");
56    
57     $self->newtest("Tool Setup Testing - url from tool object ".
58     "and default version");
59     $self->testinterface("toolsetup","test");
60    
61 williamc 1.1.2.3.2.1 # -- still consistent ?
62     $self->_testtoolmeta();
63    
64     # -- Persistency Testing
65     $self->newtest("New ToolBox restoration test");
66     $self->newobject($self);
67     $self->_testtoolmeta();
68    
69 williamc 1.1.2.1 $self->newtest("gettool test - undefined expected");
70     $self->expect(undef);
71     $self->testinterface("gettool","notool");
72     $self->testinterface("gettool","notool","noversion");
73     $self->clearexpect();
74 williamc 1.1.2.2
75 williamc 1.1.2.3.2.2 $self->newtest("gettool test - tool expected");
76     my $tool=$self->testinterface("gettool","test");
77     if ( (defined $tool ) && (($tool->version() eq "version1" )
78     && ( $tool->name eq "test" )) ) {
79     $self->testpass("Correct tool Returned OK");
80     }
81     else {
82     $self->testfail("Correct tool NOT passed back");
83     }
84    
85 williamc 1.1.2.2 $self->newtest("Setting a Searcher");
86     $self->testinterface("searcher");
87 williamc 1.1.2.1 }
88    
89 williamc 1.1.2.3.2.1 sub _testtoolmeta {
90 williamc 1.1.2.1 my $self=shift;
91 williamc 1.1.2.3.2.1 $self->newtest("Check Tools are registered");
92     $self->expect("test","anothertest");
93     $self->testinterface("tools");
94     $self->clearexpect();
95    
96     $self->newtest("Default Version Test");
97     $self->expect("version1");
98     $self->testinterface("defaultversion","test");
99     $self->clearexpect();
100     $self->expect("version1","version2");
101     $self->testinterface("versions", "test");
102     $self->clearexpect();
103     $self->expect("version2");
104     $self->testinterface("versions", "anothertest");
105     $self->testinterface("defaultversion","anothertest");
106     $self->clearexpect();
107 williamc 1.1.2.3 }
108    
109     # --- stubs
110    
111     sub location {
112     my $self=shift;
113     return $self->{testarea};
114     }
115    
116     sub configurationdir {
117     my $self=shift;
118 williamc 1.1.2.3.2.1 return $self->{testarea}."/".$self->{projconfigdir};
119 williamc 1.1.2.3 }
120    
121     sub requirementsdoc {
122     my $self=shift;
123     return $self->{reqdoc};
124 williamc 1.1.2.3.2.1 }
125    
126     sub cache {
127     my $self=shift;
128     return $self->{cache};
129 williamc 1.1.2.1 }