test setups: Inherit env when using a test setup

Closes https://github.com/mesonbuild/meson/issues/3525
pull/3460/head
Nirbheek Chauhan 7 years ago committed by Nirbheek Chauhan
parent 0dd4635842
commit 9565293f16
  1. 2
      mesonbuild/build.py
  2. 5
      test cases/unit/2 testsetups/envcheck.py
  3. 3
      test cases/unit/2 testsetups/meson.build

@ -290,7 +290,7 @@ class EnvironmentVariables:
return value
def get_env(self, full_env):
env = {}
env = full_env.copy()
for method, name, values, kwargs in self.envvars:
env[name] = method(full_env, name, values, kwargs)
return env

@ -0,0 +1,5 @@
#!/usr/bin/env python3
import os
assert('PATH' in os.environ)

@ -14,6 +14,9 @@ add_test_setup('valgrind',
buggy = executable('buggy', 'buggy.c', 'impl.c')
test('Test buggy', buggy)
envcheck = find_program('envcheck.py')
test('test-env', envcheck)
add_test_setup('empty')
add_test_setup('onlyenv', env : env)
add_test_setup('onlyenv2', env : 'TEST_ENV=1')

Loading…
Cancel
Save