krb5 commit: Add "which" function to k5test
Greg Hudson
ghudson at MIT.EDU
Sat Sep 28 15:14:55 EDT 2013
https://github.com/krb5/krb5/commit/1f1b76ab8937c2cb0273cc5d8a7ee806240e1879
commit 1f1b76ab8937c2cb0273cc5d8a7ee806240e1879
Author: Greg Hudson <ghudson at mit.edu>
Date: Sat Sep 28 14:56:22 2013 -0400
Add "which" function to k5test
Add a utility function in k5test.py to look for a command in the
executable path, and remove it from t_kdb.py.
src/tests/t_kdb.py | 9 ---------
src/util/k5test.py | 13 +++++++++++++
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py
index 70fe58a..64ce682 100644
--- a/src/tests/t_kdb.py
+++ b/src/tests/t_kdb.py
@@ -2,15 +2,6 @@
from k5test import *
import time
-# Return the location of progname in tht executable path, or None if
-# it is not found.
-def which(progname):
- for dir in os.environ["PATH"].split(os.pathsep):
- path = os.path.join(dir, progname)
- if os.access(path, os.X_OK):
- return path
- return None
-
# Run kdbtest against the BDB module.
realm = K5Realm(create_kdb=False)
realm.run(['./kdbtest'])
diff --git a/src/util/k5test.py b/src/util/k5test.py
index 017aa0c..aead832 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -133,6 +133,9 @@ Scripts may use the following functions and variables:
added newline) in testlog, and write it to stdout if running
verbosely.
+* which(progname): Return the location of progname in the executable
+ path, or None if it is not found.
+
* password(name): Return a weakly random password based on name. The
password will be consistent across calls with the same name.
@@ -371,6 +374,16 @@ def output(msg, force_verbose=False):
sys.stdout.write(msg)
+# Return the location of progname in the executable path, or None if
+# it is not found.
+def which(progname):
+ for dir in os.environ["PATH"].split(os.pathsep):
+ path = os.path.join(dir, progname)
+ if os.access(path, os.X_OK):
+ return path
+ return None
+
+
def password(name):
"""Choose a weakly random password from name, consistent across calls."""
return name + str(os.getpid())
More information about the cvs-krb5
mailing list