summaryrefslogtreecommitdiff
path: root/selftest/selftest.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-04 14:55:39 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-04 18:02:07 +0100
commit11c7ce35c0d3d645e26177351776d599083dfd9a (patch)
tree7bb0e762c8a76cca9d8956116fb20cad0c60a5ac /selftest/selftest.py
parent48155d189aaf2ac8d4ddabf909fcae44e9321e13 (diff)
downloadsamba-11c7ce35c0d3d645e26177351776d599083dfd9a.tar.gz
samba-11c7ce35c0d3d645e26177351776d599083dfd9a.tar.bz2
samba-11c7ce35c0d3d645e26177351776d599083dfd9a.zip
selftest.testlist: Add RestrictedTestManager.from_path.
Diffstat (limited to 'selftest/selftest.py')
-rwxr-xr-xselftest/selftest.py56
1 files changed, 19 insertions, 37 deletions
diff --git a/selftest/selftest.py b/selftest/selftest.py
index 3c65660c7a..a836835bac 100755
--- a/selftest/selftest.py
+++ b/selftest/selftest.py
@@ -104,24 +104,20 @@ def expand_environment_strings(s):
def run_testsuite(envname, name, cmd, i, totalsuites):
pcap_file = setup_pcap(name)
- Subunit::start_testsuite(name);
- Subunit::progress_push();
- Subunit::report_time(time());
- os.system(cmd)
- Subunit::report_time(time());
- Subunit::progress_pop();
-
- if ($? == -1) {
- Subunit::progress_pop();
- Subunit::end_testsuite(name, "error", "Unable to run $cmd: $!");
- exit(1);
- } elsif ($? & 127) {
- Subunit::end_testsuite(name, "error",
- sprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without'));
- exit(1);
- }
+ Subunit::start_testsuite(name)
+ Subunit::progress_push()
+ Subunit::report_time(time())
+ try:
+ exitcode = subprocess.call(cmd)
+ except Exception, e:
+ Subunit::report_time(time())
+ Subunit::progress_pop()
+ Subunit::progress_pop()
+ Subunit::end_testsuite(name, "error", "Unable to run $cmd: $!")
+ sys.exit(1)
- my $exitcode = $? >> 8;
+ Subunit::report_time(time())
+ Subunit::progress_pop()
envlog = env_manager.getlog_env(envname)
if envlog != "":
@@ -264,14 +260,14 @@ if not opts.list:
if opts.socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "":
die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....")
testenv_default = "dc"
- require target::Samba
- target = new Samba($bindir, binary_mapping, $ldap, $srcdir, $server_maxtime)
+ from selftest.target.samba import Samba
+ target = Samba(bindir, binary_mapping, ldap, srcdir, server_maxtime)
elif opts.target == "samba3":
if opts.socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "":
die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....")
testenv_default = "member"
- require target::Samba3
- $target = new Samba3($bindir, binary_mapping, $srcdir_abs, $server_maxtime)
+ from selftest.target.samba3 import Samba3
+ target = Samba3(bindir, binary_mapping, srcdir_abs, server_maxtime)
interfaces = ",".join([
"127.0.0.11/8",
@@ -377,16 +373,9 @@ for fn in testlists:
available.append(testsuite)
if opts.load_list:
- individual_tests = {}
- restricted = []
- f = open(opts.load_list, 'r')
- try:
- restricted_mgr = RestrictedTestManager(read_restricted_test_list(f))
- finally:
- f.close()
+ restricted_mgr = RestrictedTestManager.from_path(opts.load_list)
else:
restricted_mgr = None
- individual_tests = None
for testsuite in available:
@@ -555,15 +544,8 @@ elif opts.list:
cmd = cmd.replace("$LISTOPT", "--list")
- os.system(cmd)
-
- if ($? == -1) {
- die("Unable to run $cmd: $!");
- } elsif ($? & 127) {
- die(snprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without'));
- }
+ exitcode = subprocess.call(cmd)
- my $exitcode = $? >> 8;
if exitcode != 0:
sys.stderr.write("%s exited with exit code %s\n" % (cmd, exitcode))
sys.exit(1)