aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-07-28 00:09:37 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-07-28 00:09:37 +0300
commitb7e391ead41528b3473d069fefb3bbc6741a36d2 (patch)
tree46a9e4fb5213e38694680dd6a55c2b1fb6373898
parentd2fa9301ac7ec3e1a74748ae17e1c310a2b8cdd6 (diff)
downloadmeson-b7e391ead41528b3473d069fefb3bbc6741a36d2.zip
meson-b7e391ead41528b3473d069fefb3bbc6741a36d2.tar.gz
meson-b7e391ead41528b3473d069fefb3bbc6741a36d2.tar.bz2
Simulate rpath on windows by adding dll subdirectories to global path in tests.
-rw-r--r--backends.py20
-rwxr-xr-xmeson_test.py2
2 files changed, 20 insertions, 2 deletions
diff --git a/backends.py b/backends.py
index 1fe98b5..19ec9aa 100644
--- a/backends.py
+++ b/backends.py
@@ -20,7 +20,7 @@ from coredata import MesonException
class TestSerialisation:
def __init__(self, name, fname, is_cross, exe_wrapper, is_parallel, cmd_args, env,
- should_fail, valgrind_args, timeout):
+ should_fail, valgrind_args, timeout, extra_paths):
self.name = name
self.fname = fname
self.is_cross = is_cross
@@ -31,6 +31,7 @@ class TestSerialisation:
self.should_fail = should_fail
self.valgrind_args = valgrind_args
self.timeout = timeout
+ self.extra_paths = extra_paths
# This class contains the basic functionality that is needed by all backends.
# Feel free to move stuff in and out of it as you see fit.
@@ -238,6 +239,17 @@ class Backend():
args += self.build_target_link_arguments(compiler, d.get_dependencies())
return args
+ def determine_windows_extra_paths(self, target):
+ '''On Windows there is no such thing as an rpath.
+ We must determine all locations of DLLs that this exe
+ links to and return them so they can be used in unit
+ tests.'''
+ if not isinstance(target, build.Executable):
+ print(target)
+ return []
+ prospectives = target.get_transitive_rpaths()
+ return [os.path.join(self.environment.get_build_dir(), i) for i in prospectives if len(i) > 0]
+
def write_test_file(self, datafile):
arr = []
for t in self.build.get_tests():
@@ -251,9 +263,13 @@ class Backend():
exe_wrapper = self.environment.cross_info.get('exe_wrapper', None)
else:
exe_wrapper = None
+ if mesonlib.is_windows():
+ extra_paths = self.determine_windows_extra_paths(exe)
+ else:
+ extra_paths = []
ts = TestSerialisation(t.get_name(), fname, is_cross, exe_wrapper,
t.is_parallel, t.cmd_args, t.env, t.should_fail, t.valgrind_args,
- t.timeout)
+ t.timeout, extra_paths)
arr.append(ts)
pickle.dump(arr, datafile)
diff --git a/meson_test.py b/meson_test.py
index 5dedd01..025571d 100755
--- a/meson_test.py
+++ b/meson_test.py
@@ -95,6 +95,8 @@ def run_single_test(wrap, test):
starttime = time.time()
child_env = os.environ.copy()
child_env.update(test.env)
+ if len(test.extra_paths) > 0:
+ child_env['PATH'] = child_env['PATH'] + ';'.join([''] + test.extra_paths)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=child_env)
timed_out = False