diff options
author | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2018-03-01 00:26:32 +0200 |
---|---|---|
committer | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2018-03-01 01:06:51 +0200 |
commit | e0d0c0166a5d9ab008de43ad65cedd529e5e16a6 (patch) | |
tree | 81294b16286901dab418bdcbbfc3207a1dc666b9 | |
parent | 7fb8e518b2666aa7eea0cf63b830884f2bfeb269 (diff) | |
download | meson-e0d0c0166a5d9ab008de43ad65cedd529e5e16a6.zip meson-e0d0c0166a5d9ab008de43ad65cedd529e5e16a6.tar.gz meson-e0d0c0166a5d9ab008de43ad65cedd529e5e16a6.tar.bz2 |
Avoid unnecessary unpickling of build data during testing.
-rw-r--r-- | mesonbuild/mtest.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 9380a5e..d36bf28 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -207,9 +207,31 @@ class TestHarness: if self.jsonlogfile: self.jsonlogfile.close() + def merge_suite_options(self, options, test): + if ":" in options.setup: + if options.setup not in self.build_data.test_setups: + sys.exit("Unknown test setup '%s'." % options.setup) + current = self.build_data.test_setups[options.setup] + else: + full_name = test.project_name + ":" + options.setup + if full_name not in self.build_data.test_setups: + sys.exit("Test setup '%s' not found from project '%s'." % (options.setup, test.project_name)) + current = self.build_data.test_setups[full_name] + if not options.gdb: + options.gdb = current.gdb + if options.timeout_multiplier is None: + options.timeout_multiplier = current.timeout_multiplier + # if options.env is None: + # options.env = current.env # FIXME, should probably merge options here. + if options.wrapper is not None and current.exe_wrapper is not None: + sys.exit('Conflict: both test setup and command line specify an exe wrapper.') + if options.wrapper is None: + options.wrapper = current.exe_wrapper + return current.env.get_env(os.environ.copy()) + def get_test_env(self, options, test): if options.setup: - env = merge_suite_options(options, test) + env = self.merge_suite_options(options, test) else: env = os.environ.copy() if isinstance(test.env, build.EnvironmentVariables): @@ -505,6 +527,7 @@ TIMEOUT: %4d startdir = os.getcwd() if self.options.wd: os.chdir(self.options.wd) + self.build_data = build.load(os.getcwd()) try: for _ in range(self.options.repeat): @@ -560,29 +583,6 @@ def list_tests(th): for t in tests: print(th.get_pretty_suite(t)) -def merge_suite_options(options, test): - bld = build.load(options.wd) - if ":" in options.setup: - if options.setup not in bld.test_setups: - sys.exit("Unknown test setup '%s'." % options.setup) - current = bld.test_setups[options.setup] - else: - full_name = test.project_name + ":" + options.setup - if full_name not in bld.test_setups: - sys.exit("Test setup '%s' not found from project '%s'." % (options.setup, test.project_name)) - current = bld.test_setups[full_name] - if not options.gdb: - options.gdb = current.gdb - if options.timeout_multiplier is None: - options.timeout_multiplier = current.timeout_multiplier -# if options.env is None: -# options.env = current.env # FIXME, should probably merge options here. - if options.wrapper is not None and current.exe_wrapper is not None: - sys.exit('Conflict: both test setup and command line specify an exe wrapper.') - if options.wrapper is None: - options.wrapper = current.exe_wrapper - return current.env.get_env(os.environ.copy()) - def rebuild_all(wd): if not os.path.isfile(os.path.join(wd, 'build.ninja')): print("Only ninja backend is supported to rebuild tests before running them.") |