]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
allow custom args to named in system tests (RT 26044).
authorScott Mann <smann@isc.org>
Mon, 10 Oct 2011 19:40:50 +0000 (19:40 +0000)
committerScott Mann <smann@isc.org>
Mon, 10 Oct 2011 19:40:50 +0000 (19:40 +0000)
CHANGES
bin/tests/system/start.pl

diff --git a/CHANGES b/CHANGES
index 9bb3daa70d09b392996c31d41241c603f3c814ae..995405762b9299aaf2731d04c06e765d64887d4e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3162.   [test]          start.pl: modified to allow for "named.args" in
+                        ns*/ subdirectory to override stock arguments to
+                        named. Largely from RT#26044, but no separate ticket.
+
 3157.  [tuning]        Reduce the time spent in "rndc reconfig" by parsing
                        the config file before pausing the server. [RT #21373]
 
index 7871ed629aab26cd63649149993d1eb5bdd6c814..63c1d26d7bca977dd2093dba91b5152dddee6cde 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: start.pl,v 1.13.176.8 2011/05/05 23:23:15 smann Exp $
+# $Id: start.pl,v 1.13.176.9 2011/10/10 19:40:50 smann Exp $
 
 # Framework for starting test servers.
 # Based on the type of server specified, check for port availability, remove
@@ -23,6 +23,7 @@
 # If a server is specified, start it. Otherwise, start all servers for test.
 
 use strict;
+use Cwd;
 use Cwd 'abs_path';
 use Getopt::Long;
 
@@ -35,6 +36,12 @@ use Getopt::Long;
 #   options - alternate options for the server
 #             NOTE: options must be specified with '-- "<option list>"',
 #              for instance: start.pl . ns1 -- "-c n.conf -d 43"
+#             ALSO NOTE: this variable will be filled with the
+#              contents of the first non-commented/non-blank line of args
+#              in a file called "named.args" in an ns*/ subdirectory only
+#              the FIRST non-commented/non-blank line is used (everything
+#              else in the file is ignored. If "options" is already set,
+#              then "named.args" is ignored.
 
 my $usage = "usage: $0 [--noclean] test-directory [server-directory [server-options]]";
 my $noclean;
@@ -80,14 +87,15 @@ if ($server) {
        my @ns = grep /^ns[0-9]*$/, @files;
        my @lwresd = grep /^lwresd[0-9]*$/, @files;
        my @ans = grep /^ans[0-9]*$/, @files;
+       my $name;
 
        # Start the servers we found.
        &check_ports();
-       foreach (@ns, @lwresd, @ans) {
-               &start_server($_);
+       foreach $name(@ns, @lwresd, @ans) {
+               &start_server($name);
        }
-       foreach (@ns) {
-               &verify_server($_);
+       foreach $name(@ns) {
+               &verify_server($name);
        }
 }
 
@@ -124,12 +132,27 @@ sub start_server {
        my $cleanup_files;
        my $command;
        my $pid_file;
+        my $cwd = getcwd();
+       my $args_file = $cwd . "/" . $test . "/" . $server . "/" . "named.args";
 
        if ($server =~ /^ns/) {
                $cleanup_files = "{*.jnl,*.bk,*.st,named.run}";
                $command = "$NAMED ";
                if ($options) {
                        $command .= "$options";
+               } elsif (-e $args_file) {
+                       open(FH, "<", $args_file);
+                       while(my $line=<FH>)
+                       {
+                               $line =~ s/\R//g;
+                               next if ($line =~ /^\s*$/); #discard blank lines
+                               next if ($line =~ /^\s*#/); #discard comment lines
+                               $line =~ s/#.*$//g;
+                               $options = $line;
+                               last;
+                       }
+                       close FH;
+                       $command .= "$options";
                } else {
                        $command .= "-m record,size,mctx ";
                        $command .= "-T clienttest ";
@@ -175,7 +198,7 @@ sub start_server {
                exit 1;
        }
 
-       #               print "I:starting server $server\n";
+       # print "I:starting server %s\n",$server;
 
        chdir "$testdir/$server";
 
@@ -204,6 +227,9 @@ sub start_server {
                }
                sleep 1;
        }
+
+        # go back to the top level directory
+       chdir $cwd;
 }
 
 sub verify_server {