---
The tests can be run individually using the following command:
- sh run.sh [flags] <test-name> [<test-arguments>]
+ sh legacy.run.sh [flags] <test-name> [<test-arguments>]
e.g.
- sh run.sh [flags] notify
+ sh legacy.run.sh [flags] notify
Optional flags are:
---
If there is a requirement to re-run a test (or the entire test suite), the
files produced by the tests should be deleted first. Normally, these files are
-deleted if the test succeeds but are retained on error. The run.sh script
-automatically calls a given test's clean.sh script before invoking its setup.sh
-script.
+deleted if the test succeeds but are retained on error. The legacy.run.sh
+script automatically calls a given test's clean.sh script before invoking its
+setup.sh script.
Deletion of the files produced by the set of tests (e.g. after the execution of
make) can be carried out using the command:
clean.sh Run at the end to clean up temporary files, but only if the test
was completed successfully and its running was not inhibited by the
- "-n" switch being passed to "run.sh". Otherwise the temporary
- files are left in place for inspection.
+ "-n" switch being passed to "legacy.run.sh". Otherwise the
+ temporary files are left in place for inspection.
ns<N> These subdirectories contain test name servers that can be queried
or can interact with each other. The value of N indicates the
Port Usage
---
In order for the tests to run in parallel, each test requires a unique set of
-ports. These are specified by the "-p" option passed to "run.sh", which sets
-environment variables that the scripts listed above can reference.
+ports. These are specified by the "-p" option passed to "legacy.run.sh", which
+sets environment variables that the scripts listed above can reference.
The convention used in the system tests is that the number passed is the start
of a range of 100 ports. The test is free to use the ports as required,
directory.
2. Arguments can be only passed to the script if the test is being run as a
-one-off with "run.sh". In this case, everything on the command line after the
-name of the test is passed to each script. For example, the command:
+one-off with "legacy.run.sh". In this case, everything on the command line
+after the name of the test is passed to each script. For example, the command:
- sh run.sh -p 12300 mytest -D xyz
+ sh legacy.run.sh -p 12300 mytest -D xyz
... will run "mytest" with a port range of 12300 to 12399. Each of the
framework scripts provided by the test will be invoked using the remaining
When running a test, the servers are started using "start.sh" (which is nothing
more than a wrapper for start.pl). The options for "start.pl" are documented
in the header for that file, so will not be repeated here. In summary, when
-invoked by "run.sh", start.pl looks for directories named "nsN" or "ansN" in
-the test directory and starts the servers it finds there.
+invoked by "legacy.run.sh", start.pl looks for directories named "nsN" or
+"ansN" in the test directory and starts the servers it finds there.
"named" Command-Line Options
here.
In summary though, the nameservers for a given test, if left running by
-specifying the "-k" flag to "run.sh" when the test is started, can be stopped
-by the command:
+specifying the "-k" flag to "legacy.run.sh" when the test is started, can be
+stopped by the command:
sh stop.sh <test-name> [server]
Notes on Parallel Execution
---
-Although execution of an individual test is controlled by "run.sh", which
-executes the above shell scripts (and starts the relevant servers) for each
-test, the running of all tests in the test suite is controlled by the Makefile.
+Although execution of an individual test is controlled by "legacy.run.sh",
+which executes the above shell scripts (and starts the relevant servers) for
+each test, the running of all tests in the test suite is controlled by the
+Makefile.
All system tests are capable of being run in parallel. For this to work, each
test needs to use a unique set of ports. To avoid the need to define which
they are cleaned up at different times:
1. Files generated by the test itself are cleaned up by the test's own
-"clean.sh", which is called from "run.sh".
+"clean.sh", which is called from "legacy.run.sh".
2. Files that may not be cleaned up if named exits abnormally can be removed
using the "cleanall.sh" script.
--- /dev/null
+#!/usr/bin/python3
+#
+# 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.
+
+#
+# Run system test using the pytest runner. This is a simple wrapper around
+# pytest for convenience.
+#
+
+import argparse
+import sys
+import time
+
+import pytest
+
+
+def into_pytest_args(in_args):
+ args = []
+ if in_args.expression is None:
+ # running all tests - execute in parallel
+ args.extend(["-n", "auto"])
+ args.extend(["--dist", "loadscope"])
+ else:
+ args.extend(["-k", in_args.expression])
+ if in_args.noclean:
+ args.append("--noclean")
+ if in_args.keep:
+ print(
+ "ERROR -k / --keep option not implemented.\n"
+ "Please contact QA with your use-case and use ./legacy.run.sh in the meantime."
+ )
+ sys.exit(1)
+ return args
+
+
+def main():
+ print(
+ "----- WARNING -----\n"
+ "Using pytest system test runner\n\n"
+ 'Please consider invoking "pytest" directly for more control:\n'
+ " single test: pytest -k dns64\n"
+ " parallel tests: pytest -n auto --dist loadscope\n\n"
+ "Alternately, use ./legacy.run.sh for the legacy system test runner.\n"
+ )
+
+ parser = argparse.ArgumentParser(
+ description="Wrapper script for launching system tests"
+ )
+ parser.add_argument(
+ "--noclean",
+ action="store_true",
+ help="don't clean tmpdir after test run",
+ )
+ parser.add_argument(
+ "-k",
+ "--keep",
+ action="store_true",
+ help="unused - not implemented",
+ )
+ parser.add_argument(
+ "expression",
+ type=str,
+ nargs="?",
+ help="select which test(s) to run",
+ )
+
+ args = into_pytest_args(parser.parse_args())
+ print(f"$ pytest {' '.join(args)}\n" "---------------------------\n")
+
+ time.sleep(2) # force the user to stare at the warning message
+
+ sys.exit(pytest.main(args))
+
+
+if __name__ == "__main__":
+ main()
+
+# vim: set filetype=python :