#!/usr/bin/perl -w # Copyright (C) Internet Systems Consortium, Inc. ("ISC") # # SPDX-License-Identifier: MPL-2.0 # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, you can obtain one at https://mozilla.org/MPL/2.0/. # # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. # Framework for starting test servers. # Based on the type of server specified, check for port availability, remove # temporary files, start the server, and verify that the server is running. # If a server is specified, start it. Otherwise, start all servers for test. use strict; use warnings; use Cwd ':DEFAULT', 'abs_path'; use English '-no_match_vars'; use Getopt::Long; use Time::HiRes 'sleep'; # allows sleeping fractional seconds # Usage: # perl start.pl [--noclean] [--restart] [--port port] [--taskset cpus] test [server [options]] # # --noclean Do not cleanup files in server directory. # # --restart Indicate that the server is being restarted, so get the # server to append output to an existing log file instead of # starting a new one. # # --port port Specify the default port being used by the server to answer # queries (default 5300). This script will interrogate the # server on this port to see if it is running. (Note: for # "named" nameservers, this can be overridden by the presence # of the file "named.port" in the server directory containing # the number of the query port.) # # --taskset cpus Use taskset to signal which cpus can be used. For example # cpus=fff0 means all cpus aexcept for 0, 1, 2, and 3 are # eligible. # # test Name of the test directory. # # server Name of the server directory. This will be of the form # "nsN" or "ansN", where "N" is an integer between 1 and 8. # If not given, the script will start all the servers in the # test directory. # # options Alternate options for the server. # # NOTE: options must be specified with '-- "