summaryrefslogtreecommitdiff
path: root/selftest/selftest.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-04 16:49:30 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-04 18:02:07 +0100
commit8ae7615cf36b449fae39790d43c66f3cdf39f876 (patch)
tree549c461cc74ea147dba8009bae7eaa625aadfc57 /selftest/selftest.py
parentb5d9cd1740dfcd766e5c62c35acfc56265dd7f6a (diff)
downloadsamba-8ae7615cf36b449fae39790d43c66f3cdf39f876.tar.gz
samba-8ae7615cf36b449fae39790d43c66f3cdf39f876.tar.bz2
samba-8ae7615cf36b449fae39790d43c66f3cdf39f876.zip
selftest.py: Remove unused code, reconcile signal handlers.
Diffstat (limited to 'selftest/selftest.py')
-rwxr-xr-xselftest/selftest.py35
1 files changed, 16 insertions, 19 deletions
diff --git a/selftest/selftest.py b/selftest/selftest.py
index ac6d672949..5a1092833e 100755
--- a/selftest/selftest.py
+++ b/selftest/selftest.py
@@ -82,11 +82,12 @@ opts, args = parser.parse_args()
subunit_ops = subunithelper.SubunitOps(sys.stdout)
-def pipe_handler(sig, frame):
- sys.stderr.write("Exiting early because of SIGPIPE.\n")
+def handle_signal(sig, frame):
+ sys.stderr.write("Exiting early because of signal %s.\n" % sig)
sys.exit(1)
-signal.signal(signal.SIGPIPE, pipe_handler)
+for sig in (signal.SIGINT, signal.SIGQUIT, signal.SIGTERm, signal.SIGPIPE):
+ signal.signal(sig, handle_signal)
def skip(name):
return testlist.find_in_list(excludes, name)
@@ -127,7 +128,14 @@ def expand_environment_strings(s):
return s
-def run_testsuite(envname, name, cmd, i, totalsuites):
+def run_testsuite(envname, name, cmd):
+ """Run a single testsuite.
+
+ :param envname: Name of the environment to ru nin
+ :param name: Name of the testsuite
+ :param cmd: Name of the (fully expanded) command to run
+ :return: exitcode of the command
+ """
pcap_file = setup_pcap(name)
subunit_ops.start_testsuite(name)
@@ -172,7 +180,7 @@ if opts.list and opts.testenv:
tests = args
-# quick hack to disable rpc validation when using valgrind - its way too slow
+# quick hack to disable rpc validation when using valgrind - it is way too slow
if not os.environ.get("VALGRIND"):
os.environ["VALIDATE"] = "validate"
os.environ["MALLOC_CHECK_"] = "2"
@@ -201,9 +209,8 @@ if prefix == "":
# Ensure we have the test prefix around.
#
-# We need restrictive
-# permissions on this as some subdirectories in this tree will have
-# wider permissions (ie 0777) and this would allow other users on the
+# We need restrictive permissions on this as some subdirectories in this tree
+# will have wider permissions (ie 0777) and this would allow other users on the
# host to subvert the test process.
if not os.path.isdir(prefix):
os.mkdir(prefix, 0700)
@@ -458,8 +465,6 @@ if not opts.list:
subunit_ops.progress(suitestotal, subunit.PROGRESS_SET)
subunit_ops.time(now())
-i = 0
-
exported_envvars = [
# domain stuff
"DOMAIN",
@@ -510,14 +515,6 @@ exported_envvars = [
"LOCAL_PATH"
]
-def handle_sigdie(signame, frame):
- sys.stderr.write("Received signal %s" % signame)
- sys.exit(1)
-
-signal.signal(signal.SIGINT, handle_sigdie)
-signal.signal(signal.SIGQUIT, handle_sigdie)
-signal.signal(signal.SIGTERM, handle_sigdie)
-
def exported_envvars_str(testenv_vars):
out = ""
@@ -636,7 +633,7 @@ else:
elif supports_idlist:
cmd += " ".join(subtests)
- run_testsuite(envname, name, cmd, i, suitestotal)
+ run_testsuite(envname, name, cmd)
if opts.resetup_environment:
env_manager.teardown_env(envname)