| |
@@ -35,8 +35,7 @@
|
| |
'''
|
| |
|
| |
def run_cmd(testdir, env, conf, name, socket, cmd, keytab, expected_failure):
|
| |
-
|
| |
- logfile = conf['logfile']
|
| |
+ conf['prefix'] = str(cmd_index)
|
| |
testenv = env.copy()
|
| |
testenv.update({'KRB5CCNAME': os.path.join(testdir, 't' + conf['prefix'] +
|
| |
'_impersonate.ccache'),
|
| |
@@ -47,19 +46,7 @@
|
| |
'GSSPROXY_SOCKET': socket,
|
| |
'GSSPROXY_BEHAVIOR': 'REMOTE_FIRST'})
|
| |
|
| |
- print("\nTesting: [%s]" % (name,), file=logfile)
|
| |
- print("[COMMAND]\n%s\n[ENVIRONMENT]\n%s\n" % (cmd, testenv), file=logfile)
|
| |
- logfile.flush()
|
| |
-
|
| |
- p1 = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=logfile,
|
| |
- env=testenv, preexec_fn=os.setsid)
|
| |
- try:
|
| |
- p1.wait(10)
|
| |
- except subprocess.TimeoutExpired:
|
| |
- # p1.returncode is set to None here
|
| |
- pass
|
| |
- print_return(p1.returncode, name, expected_failure)
|
| |
- return p1.returncode if not expected_failure else int(not p1.returncode)
|
| |
+ return run_testcase_cmd(testenv, conf, cmd, name, expected_failure)
|
| |
|
| |
def run(testdir, env, conf):
|
| |
print("Testing impersonate creds...", file=sys.stderr)
|
| |
@@ -77,56 +64,56 @@
|
| |
# Test all permitted
|
| |
msg = "Impersonate"
|
| |
socket = os.path.join(testdir, 'impersonate.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
- path_prefix + 'impersonate.cache']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
+ path_prefix + 'impersonate.cache'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, PROXY_KTNAME, False)
|
| |
rets.append(r)
|
| |
|
| |
#Test self fail
|
| |
msg = "Impersonate fail self"
|
| |
socket = os.path.join(testdir, 'impersonate-proxyonly.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
- path_prefix + 'impersonate.cache']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
+ path_prefix + 'impersonate.cache'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, PROXY_KTNAME, True)
|
| |
rets.append(r)
|
| |
|
| |
#Test proxy fail
|
| |
msg = "Impersonate fail proxy"
|
| |
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
- path_prefix + 'impersonate.cache']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
+ path_prefix + 'impersonate.cache'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, PROXY_KTNAME, True)
|
| |
rets.append(r)
|
| |
|
| |
#Test s4u2self half succeed
|
| |
msg = "s4u2self delegation"
|
| |
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
- path_prefix + 'impersonate.cache', 's4u2self']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
+ path_prefix + 'impersonate.cache', 's4u2self'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, PROXY_KTNAME, False)
|
| |
rets.append(r)
|
| |
|
| |
#Test proxy to self succeed
|
| |
msg = "Impersonate to self"
|
| |
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, HOST_GSS,
|
| |
- path_prefix + 'impersonate.cache', 's4u2proxy']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, HOST_GSS,
|
| |
+ path_prefix + 'impersonate.cache', 's4u2proxy'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, SVC_KTNAME, False)
|
| |
rets.append(r)
|
| |
|
| |
#Test s4u2proxy half fail
|
| |
msg = "s4u2proxy fail"
|
| |
socket = os.path.join(testdir, 'impersonate-selfonly.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
- path_prefix + 'impersonate.cache', 's4u2proxy']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
+ path_prefix + 'impersonate.cache', 's4u2proxy'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, PROXY_KTNAME, True)
|
| |
rets.append(r)
|
| |
|
| |
#Test s4u2proxy half succeed
|
| |
msg = "s4u2proxy"
|
| |
socket = os.path.join(testdir, 'impersonate-proxyonly.socket')
|
| |
- cmd = ["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
- path_prefix + 'impersonate.cache', 's4u2proxy']
|
| |
+ cmd = " ".join(["./tests/t_impersonate", USR_NAME, HOST_GSS, PROXY_GSS,
|
| |
+ path_prefix + 'impersonate.cache', 's4u2proxy'])
|
| |
r = run_cmd(testdir, env, conf, msg, socket, cmd, PROXY_KTNAME, False)
|
| |
rets.append(r)
|
| |
|
| |
@@ -139,3 +126,7 @@
|
| |
if len(e) > 0:
|
| |
return e[0]
|
| |
return 0
|
| |
+
|
| |
+ if __name__ == "__main__":
|
| |
+ from runtests import runtests_main
|
| |
+ runtests_main(["t_impersonate.py"])
|
| |
PR for enabling debugging of test cases + centralized timeout limits.
Note that t_basic.py requires a pipe between two processes: launching
the test cases as part of run_testcase_cmd is possible, but debugging
either would require creating two named pipes accessible from GDB,
and would prevent re-running of the program without also restarting
the other.
Named pipes could be avoided by using loopback ports, but this doesn't
solve the issue of ease of restarting debugging. I'd probably suggest
that we break t_basic.py out into a stand-alone programs, perhaps
which doesn't rely on sockets/network access, for ease of debugging,
or emulate it with flat-file reading. (The latter might cause issue
with timestamp/ticket validity, but could be worked around by having
a pre-test program create the test case input/output before the test
program is ran...).