18 |
use WAIT::Wais; |
use WAIT::Wais; |
19 |
use Cwd; |
use Cwd; |
20 |
use strict; |
use strict; |
21 |
|
use File::Path qw(mkpath rmtree); |
22 |
|
|
23 |
$SIG{__DIE__} = $SIG{INT} = \&cleanup; |
$SIG{__DIE__} = $SIG{INT} = \&cleanup; |
24 |
|
|
25 |
my $pwd = getcwd(); |
my $pwd = getcwd(); |
26 |
print "$^X -Mblib blib/script/bibdb -dir /tmp -database sample\n"; |
mkpath "/tmp/wait-test-$$"; |
27 |
system "$^X -Mblib blib/script/bibdb -dir /tmp -database sample > /dev/null 2>&1"; |
print "$^X -Mblib blib/script/bibdb -dir /tmp/wait-test-$$ -database sample\n"; |
28 |
|
system "$^X -Mblib blib/script/bibdb -dir /tmp/wait-test-$$ -database sample > /dev/null 2>&1"; |
29 |
print "1..7\n"; |
print "1..7\n"; |
30 |
|
|
31 |
use Fcntl; |
use Fcntl; |
32 |
if (1) { |
if (1) { |
33 |
my $db = WAIT::Database->open( |
my $db = WAIT::Database->open( |
34 |
name => 'sample', |
name => 'sample', |
35 |
'directory' => '/tmp', |
'directory' => "/tmp/wait-test-$$", |
36 |
'mode' => O_RDWR, |
'mode' => O_RDWR, |
37 |
); |
); |
38 |
print "not " unless $db; |
print "not " unless $db; |
52 |
} |
} |
53 |
|
|
54 |
|
|
55 |
my $db = '/tmp/sample/bibdb'; |
my $db = "/tmp/wait-test-$$/sample/bibdb"; |
56 |
print "# Testing WAIT searches\n"; |
print "# Testing WAIT searches\n"; |
57 |
my $result = WAIT::Wais::Search({ |
my $result = WAIT::Wais::Search({ |
58 |
'query' => 'pfeifer', |
'query' => 'pfeifer', |
62 |
&headlines($result); |
&headlines($result); |
63 |
my $id = ($result->header)[9]->[6]; |
my $id = ($result->header)[9]->[6]; |
64 |
# no strict order |
# no strict order |
65 |
$$id = 'wait;/tmp/sample/bibdb;13'; |
$$id = "wait;/tmp/wait-test-$$/sample/bibdb;13"; |
66 |
#$length = ($result->header)[9]->[3]; |
#$length = ($result->header)[9]->[3]; |
67 |
my @header = $result->header; |
my @header = $result->header; |
68 |
|
|
113 |
|
|
114 |
sub cleanup |
sub cleanup |
115 |
{ |
{ |
116 |
system 'rm -rf /tmp/sample'; |
rmtree "/tmp/wait-test-$$"; |
117 |
} |
} |
118 |
|
|
119 |
|
|