Skip to content

Commit

Permalink
Have k5test.py provide 'runenv' to python tests
Browse files Browse the repository at this point in the history
Expose the formerly-internal _runenv module as k5test.runenv, so that
settings we store in the top-level runenv.py will be available to them.

ticket: 7929
  • Loading branch information
nalind authored and greghudson committed Jun 2, 2014
1 parent b52acab commit f78f8b1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/util/k5test.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@
* args: Positional arguments left over after flags are processed.
* runenv: The contents of $srctop/runenv.py, containing a dictionary
'env' which specifies additional variables to be added to the realm
environment, and a variable 'proxy_tls_impl', which indicates which
SSL implementation (if any) is being used by libkrb5's support for
contacting KDCs and kpasswd servers over HTTPS.
* verbose: Whether the script is running verbosely.
* testpass: The command-line test pass argument. The script does not
Expand Down Expand Up @@ -526,9 +532,9 @@ def _match_cmdnum(cmdnum, ind):
# Return an environment suitable for running programs in the build
# tree. It is safe to modify the result.
def _build_env():
global buildtop, _runenv
global buildtop, runenv
env = os.environ.copy()
for (k, v) in _runenv.iteritems():
for (k, v) in runenv.env.iteritems():
if v.find('./') == 0:
env[k] = os.path.join(buildtop, v)
else:
Expand All @@ -544,8 +550,7 @@ def _import_runenv():
runenv_py = os.path.join(buildtop, 'runenv.py')
if not os.path.exists(runenv_py):
fail('You must run "make runenv.py" in %s first.' % buildtop)
module = imp.load_source('runenv', runenv_py)
return module.env
return imp.load_source('runenv', runenv_py)


# Merge the nested dictionaries cfg1 and cfg2 into a new dictionary.
Expand Down Expand Up @@ -1174,7 +1179,7 @@ def cross_realms(num, xtgts=None, args=None, **keywords):
buildtop = _find_buildtop()
srctop = _find_srctop()
plugins = os.path.join(buildtop, 'plugins')
_runenv = _import_runenv()
runenv = _import_runenv()
hostname = _get_hostname()
null_input = open(os.devnull, 'r')

Expand Down

0 comments on commit f78f8b1

Please sign in to comment.