From 6780050cbff88de1943d6297a6169acd57e9ab3a Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 23 Aug 2013 23:52:17 +0300 Subject: [PATCH] Run cross build tests with exe wrapper. --- backends.py | 4 +++- cross/ubuntu-mingw.txt | 2 +- environment.py | 2 +- meson_test.py | 11 ++++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/backends.py b/backends.py index 75b026413..7ac770d88 100644 --- a/backends.py +++ b/backends.py @@ -452,7 +452,9 @@ class NinjaBackend(Backend): for t in self.build.get_tests(): name = t.get_name() fname = os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe())) - arr.append([name, fname]) + is_cross = self.environment.is_cross_build() + exe_wrapper = self.environment.cross_info.get('exe_wrapper', None) + arr.append([name, fname, is_cross, exe_wrapper]) pickle.dump(arr, datafile) def generate_dep_gen_rules(self, outfile): diff --git a/cross/ubuntu-mingw.txt b/cross/ubuntu-mingw.txt index 5b9fe68f7..bb5303f15 100644 --- a/cross/ubuntu-mingw.txt +++ b/cross/ubuntu-mingw.txt @@ -1,5 +1,5 @@ name = 'windows' -exe_wrapper = 'wine' +exe_wrapper = 'wine' # A command used to run generated executables. c = '/usr/bin/i586-mingw32msvc-gcc' cpp = '/usr/bin/i586-mingw32msvc-g++' root = '/usr/i586-mingw32msvc' diff --git a/environment.py b/environment.py index 8183cbe75..c2ff29961 100644 --- a/environment.py +++ b/environment.py @@ -134,7 +134,7 @@ class CCompiler(): pe.wait() if pe.returncode != 0: raise EnvironmentException('Executables created by C compiler %s are not runnable.' % self.name_string()) - + def has_header(self, hname): templ = '''#include<%s> ''' diff --git a/meson_test.py b/meson_test.py index a169f741c..55ce02dca 100755 --- a/meson_test.py +++ b/meson_test.py @@ -44,7 +44,16 @@ def run_tests(options, datafilename): for i, test in enumerate(tests): name = test[0] fname = test[1] - cmd = wrap + [fname] + is_cross = test[2] + exe_wrapper = test[3] + if is_cross: + if exe_wrapper is None: + print('Can not run test on cross compiled executable because there is no execute wrapper.') + sys.exit(1) + cmd = [exe_wrapper, fname] + else: + cmd = [fname] + cmd = wrap + cmd starttime = time.time() p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdo, stde) = p.communicate()