diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-07-31 18:42:15 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-07-31 18:42:15 +0100 |
commit | 6c7f6690a4485c9043cf5f21ea15cac51b5a2273 (patch) | |
tree | e27f4fea6c15482c50d8b132c335f79ece61149d /yarn | |
parent | 3fb60d86c01ef3bc615d39e69ee0011aef906685 (diff) | |
parent | 02fe4bfce7b93c54e7e0e1a68a822dcd7764b30f (diff) | |
download | cmdtest-6c7f6690a4485c9043cf5f21ea15cac51b5a2273.tar.gz |
Merge branch 'liw/yarn-srcdir'
Diffstat (limited to 'yarn')
-rwxr-xr-x | yarn | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -267,6 +267,31 @@ class YarnRunner(cliapp.Application): return ok + def clean_env(self): + '''Return a clean environment for running tests.''' + + whitelisted = [ + 'TERM', + 'USER', + 'USERNAME', + 'PATH', + 'HOME', + 'LOGNAME', + ] + + hardcoded = { + 'SHELL': '/bin/sh', + 'LC_ALL': 'C', + } + + env = {} + for key in whitelisted: + if key in os.environ: + env[key] = os.environ[key] + for key in hardcoded: + env[key] = hardcoded[key] + return env + def run_step(self, datadir, scenario, step, shell_prelude, report_error): self.info('Running step "%s %s"' % (step.what, step.text)) self.ts['step'] = step @@ -274,8 +299,9 @@ class YarnRunner(cliapp.Application): m = re.match(step.implementation.regexp, step.text) assert m is not None - env = os.environ.copy() + env = self.clean_env() env['DATADIR'] = datadir + env['SRCDIR'] = os.getcwd() for i, match in enumerate(m.groups('')): env['MATCH_%d' % (i+1)] = match |