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.4.1
Committed: Thu Nov 2 17:37:07 2000 UTC (24 years, 6 months ago) by williamc
Content type: text/plain
Branch: V0_16branch
CVS Tags: BuildSystemProto1, V0_18_0model, V0_18_0alpha
Changes since 1.1.2.3.2.5: +3 -0 lines
Log Message:
Import BuildSystem from dev + extra dependency checking

File Contents

# Content
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 $self->{copytoolfiledir}=$self->temparea()."/TFD";
15 $self->{copydatastore}=$self->temparea()."/Data";
16 $self->{distarea}=$self->temparea()."/CopyArea";
17 $self->{testfile}=$self->datadir()."/ToolBoxTool";
18 $self->{reqdoc}=$self->datadir()."/RequirementsDocTest";
19 $self->{cache}=URL::URLcache->new($self->{testarea}."/cache");
20 $self->{archdir}=$self->temparea();
21
22 # -- make a dummy area
23 $self->{projconfigdir}="config";
24 $ENV{SCRAM_ARCH}="TestArch";
25 $ENV{dummyvar}=$self->{testarea};
26
27 AddDir::adddir($self->{testarea}."/".$self->{projconfigdir});
28 use File::Copy;
29 my $depsfile="External_Dependencies";
30 $self->{testdepsfile}=$self->datadir()."/".$depsfile;
31 copy($self->{testdepsfile},$self->{testarea}."/"
32 .$self->{projconfigdir}."/".$depsfile)
33 or die $!."\n";
34 }
35
36 sub test {
37 my $self=shift;
38 $self->newtest("Initiation test");
39 $self->newobject($self);
40 $self->testinterface("verbosity","1");
41
42
43 $self->newtest("Tool Setup Testing");
44 $self->testinterface("toolsetup","test","version1",
45 "file:".$self->{testfile});
46
47 $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
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 # -- 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 $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
79 $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 $self->cmpstring("file:".$self->{testfile},$tool->url());
85 }
86 else {
87 $self->testfail("Correct tool NOT passed back");
88 }
89
90 $self->newtest("Setting a Searcher");
91 $self->testinterface("searcher");
92
93 $self->newtest("ToolBox Copy");
94 $self->testinterface("copytools",$self);
95 $self->verify($self->{object}->{tooladmin},$self->datastore()."/admin");
96 }
97
98 sub _testtoolmeta {
99 my $self=shift;
100 $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 }
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 return $self->{testarea}."/".$self->{projconfigdir};
128 }
129
130 sub requirementsdoc {
131 my $self=shift;
132 return $self->{reqdoc};
133 }
134
135 sub cache {
136 my $self=shift;
137 return $self->{cache};
138 }
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 }
152
153 sub archdir {
154 my $self=shift;
155 return $self->{archdir};
156 }
157
158 sub _restore {
159 }