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.3
Committed: Fri Aug 11 11:08:45 2000 UTC (24 years, 9 months ago) by williamc
Content type: text/plain
Branch: HPWbranch
Changes since 1.1.2.3.2.2: +1 -0 lines
Log Message:
Add url test for tool setting

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 williamc 1.1.2.3.2.3 $self->cmpstring("file:".$self->{testfile},$tool->url());
81 williamc 1.1.2.3.2.2 }
82     else {
83     $self->testfail("Correct tool NOT passed back");
84     }
85    
86 williamc 1.1.2.2 $self->newtest("Setting a Searcher");
87     $self->testinterface("searcher");
88 williamc 1.1.2.1 }
89    
90 williamc 1.1.2.3.2.1 sub _testtoolmeta {
91 williamc 1.1.2.1 my $self=shift;
92 williamc 1.1.2.3.2.1 $self->newtest("Check Tools are registered");
93     $self->expect("test","anothertest");
94     $self->testinterface("tools");
95     $self->clearexpect();
96    
97     $self->newtest("Default Version Test");
98     $self->expect("version1");
99     $self->testinterface("defaultversion","test");
100     $self->clearexpect();
101     $self->expect("version1","version2");
102     $self->testinterface("versions", "test");
103     $self->clearexpect();
104     $self->expect("version2");
105     $self->testinterface("versions", "anothertest");
106     $self->testinterface("defaultversion","anothertest");
107     $self->clearexpect();
108 williamc 1.1.2.3 }
109    
110     # --- stubs
111    
112     sub location {
113     my $self=shift;
114     return $self->{testarea};
115     }
116    
117     sub configurationdir {
118     my $self=shift;
119 williamc 1.1.2.3.2.1 return $self->{testarea}."/".$self->{projconfigdir};
120 williamc 1.1.2.3 }
121    
122     sub requirementsdoc {
123     my $self=shift;
124     return $self->{reqdoc};
125 williamc 1.1.2.3.2.1 }
126    
127     sub cache {
128     my $self=shift;
129     return $self->{cache};
130 williamc 1.1.2.1 }