SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
+common_options="-D lwresd-lwresd1 -X lwresd.lock -m record,size,mctx -T clienttest -d 99 -g -U 4 -i lwresd.pid -P 9210 -p 5300"
+
status=0
echo "I:waiting for nameserver to load"
for i in 0 1 2 3 4 5 6 7 8 9
mv lwresd1/lwresd.run lwresd1/lwresd.run.resolv
-$PERL $SYSTEMTESTTOP/start.pl lwresd lwresd1 -- "-X lwresd.lock -m record,size,mctx -c lwresd.conf -d 99 -g"
+$PERL $SYSTEMTESTTOP/start.pl --restart lwresd lwresd1 -- "-c lwresd.conf $common_options"
echo "I:using lwresd.conf"
ret=0
mv lwresd1/lwresd.run lwresd1/lwresd.run.lwresd
-$PERL $SYSTEMTESTTOP/start.pl lwresd lwresd1 -- "-X lwresd.lock -m record,size,mctx -c nosearch.conf -d 99 -g"
+$PERL $SYSTEMTESTTOP/start.pl --restart lwresd lwresd1 -- "-c nosearch.conf $common_options"
echo "I:using nosearch.conf"
ret=0
}
my $NAMED = $ENV{'NAMED'};
+my $LWRESD = $ENV{'LWRESD'};
my $DIG = $ENV{'DIG'};
my $PERL = $ENV{'PERL'};
my $PYTHON = $ENV{'PYTHON'};
my @ns;
my @ans;
+my @lwresd;
if ($server_arg) {
if ($server_arg =~ /^ns/) {
push(@ns, $server_arg);
} elsif ($server_arg =~ /^ans/) {
push(@ans, $server_arg);
+ } elsif ($server_arg =~ /^lwresd/) {
+ push(@lwresd, $server_arg);
} else {
print "$0: ns or ans directory expected";
print "I:$test:failed";
@ns = grep /^ns[0-9]*$/, @files;
@ans = grep /^ans[0-9]*$/, @files;
+ @lwresd = grep /^lwresd[0-9]*$/, @files;
}
# Start the servers we found.
&start_ans_server($name);
}
+foreach my $name(@lwresd) {
+ &start_lwresd_server($name, $options_arg);
+}
+
# Subroutines
sub read_ns_port {
start_server($server, $command, $pid_file);
}
+sub construct_lwresd_command {
+ my ( $server, $options ) = @_;
+
+ my $command;
+
+ if ($ENV{'USE_VALGRIND'}) {
+ $command = "valgrind -q --gen-suppressions=all --num-callers=48 --fullpath-after= --log-file=lwresd-$server-valgrind-%p.log ";
+
+ if ($ENV{'USE_VALGRIND'} eq 'helgrind') {
+ $command .= "--tool=helgrind ";
+ } else {
+ $command .= "--tool=memcheck --track-origins=yes --leak-check=full ";
+ }
+
+ $command .= "$LWRESD -m none -M external ";
+ } else {
+ $command = "$LWRESD ";
+ }
+
+ my $args_file = $testdir . "/" . $server . "/" . "lwresd.args";
+
+ if ($options) {
+ $command .= $options;
+ } elsif (-e $args_file) {
+ open(my $fh, "<", $args_file) or die "unable to read args_file \"$args_file\" ($OS_ERROR)\n";
+
+ while(my $line=<$fh>) {
+ next if ($line =~ /^\s*$/); #discard blank lines
+ next if ($line =~ /^\s*#/); #discard comment lines
+
+ chomp $line;
+
+ $line =~ s/#.*$//;
+
+ $command .= $line;
+
+ last;
+ }
+ } else {
+ $command .= "-C resolv.conf ";
+ $command .= "-D $test-$server ";
+ $command .= "-X lwresd.lock ";
+ $command .= "-m record,size,mctx ";
+ $command .= "-T clienttest ";
+ $command .= "-d 99 -g -U 4 ";
+ $command .= "-i lwresd.pid -P 9210 -p 5300";
+ }
+ if ($restart) {
+ $command .= " >>lwresd.run 2>&1 &";
+ } else {
+ $command .= " >lwresd.run 2>&1 &";
+ }
+
+ # get the shell to report the pid of the server ($!)
+ $command .= " echo \$!";
+
+ return $command;
+}
+
+sub start_lwresd_server {
+ my ( $server, $options ) = @_;
+
+ my $cleanup_files;
+ my $command;
+ my $pid_file;
+
+ $cleanup_files = "{lwresd.run}";
+ $command = construct_lwresd_command($server, $options);
+ $pid_file = "lwresd.pid";
+
+ if ($clean) {
+ unlink glob $cleanup_files;
+ }
+
+ start_server($server, $command, $pid_file);
+}
+
sub verify_ns_server {
my ( $server ) = @_;
my @ns;
my @ans;
+my @lwresd;
if ($server_arg) {
if ($server_arg =~ /^ns/) {
push(@ns, $server_arg);
} elsif ($server_arg =~ /^ans/) {
push(@ans, $server_arg);
+ } elsif ($server_arg =~ /^lwresd/) {
+ push(@lwresd, $server_arg);
} else {
print "$0: ns or ans directory expected";
print "I:$test:failed";
@ns = grep /^ns[0-9]*$/, @files;
@ans = grep /^ans[0-9]*$/, @files;
+ @lwresd = grep /^lwresd[0-9]*$/, @files;
}
# Stop the server(s), pass 1: rndc.
@ans = wait_for_servers(60, @ans);
+foreach my $name(@lwresd) {
+ stop_signal($name, "TERM");
+}
+
+@lwresd = wait_for_servers(60, @lwresd);
+
# Pass 3: SIGABRT
-foreach my $name (@ns, @ans) {
+foreach my $name (@ns, @ans, @lwresd) {
print "I:$test:$name didn't die when sent a SIGTERM\n";
stop_signal($name, "ABRT");
$errors = 1;
return $testdir . "/" . $server . "/named.pid" if ($server =~ /^ns/);
return $testdir . "/" . $server . "/ans.pid" if ($server =~ /^ans/);
+ return $testdir . "/" . $server . "/lwresd.pid" if ($server =~ /^lwresd/);
die "Unknown server type $server\n";
}