]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
added ability to set named params through "named.args" file
authorScott Mann <smann@isc.org>
Sun, 9 Oct 2011 22:47:15 +0000 (22:47 +0000)
committerScott Mann <smann@isc.org>
Sun, 9 Oct 2011 22:47:15 +0000 (22:47 +0000)
bin/tests/system/start.pl

index 1f7456520c00bb11624190fbb1d9371c4c0f33d2..f7a061b429ec9448ccc6e801be3eae7b28870e5f 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.24 2011/05/05 23:15:56 smann Exp $
+# $Id: start.pl,v 1.25 2011/10/09 22:47:15 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] [--restart] test-directory [server-directory [server-options]]";
 my $noclean = '';
@@ -81,14 +88,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);
        }
 }
 
@@ -125,12 +133,26 @@ sub start_server {
        my $cleanup_files;
        my $command;
        my $pid_file;
+       my $args_file = getcwd() . "/" . $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 ";
@@ -188,7 +210,7 @@ sub start_server {
                exit 1;
        }
 
-       #               print "I:starting server $server\n";
+       # print "I:starting server %s\n",$server;
 
        chdir "$testdir/$server";