diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2024-04-14 20:46:42 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-04-14 22:24:05 +0300 |
commit | 1b9eb6f3134d61c5ea0026ac95d807aab812c414 (patch) | |
tree | 99ce8170be60e4e893020215285873690b135955 | |
parent | 9f02d0a3e5a5ffc82256391c244b1af38e41ef78 (diff) | |
download | meson-1b9eb6f3134d61c5ea0026ac95d807aab812c414.zip meson-1b9eb6f3134d61c5ea0026ac95d807aab812c414.tar.gz meson-1b9eb6f3134d61c5ea0026ac95d807aab812c414.tar.bz2 |
Fix builds with Ninja 12 and remove a 5 year old workaround.
-rwxr-xr-x | run_project_tests.py | 3 | ||||
-rwxr-xr-x | run_tests.py | 35 | ||||
-rw-r--r-- | unittests/baseplatformtests.py | 5 |
3 files changed, 12 insertions, 31 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index e545a8d..23561d9 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -45,7 +45,7 @@ from mesonbuild.coredata import backendlist, version as meson_version from mesonbuild.modules.python import PythonExternalProgram from run_tests import ( get_fake_options, run_configure, get_meson_script, get_backend_commands, - get_backend_args_for_dir, Backend, ensure_backend_detects_changes, + get_backend_args_for_dir, Backend, guess_backend, handle_meson_skip_test, ) @@ -723,7 +723,6 @@ def _run_test(test: TestDef, # Touch the meson.build file to force a regenerate def force_regenerate() -> None: - ensure_backend_detects_changes(backend) os.utime(str(test.path / 'meson.build')) # just test building diff --git a/run_tests.py b/run_tests.py index 186893f..6d33dd9 100755 --- a/run_tests.py +++ b/run_tests.py @@ -39,29 +39,27 @@ from mesonbuild.mesonlib import OptionKey, setup_vsenv if T.TYPE_CHECKING: from mesonbuild.coredata import SharedCMDOptions -NINJA_1_9_OR_NEWER = False +NINJA_1_12_OR_NEWER = False NINJA_CMD = None # If we're on CI, detecting ninja for every subprocess unit test that we run is slow # Optimize this by respecting $NINJA and skipping detection, then exporting it on # first run. try: - NINJA_1_9_OR_NEWER = bool(int(os.environ['NINJA_1_9_OR_NEWER'])) + NINJA_1_12_OR_NEWER = bool(int(os.environ['NINJA_1_12_OR_NEWER'])) NINJA_CMD = [os.environ['NINJA']] except (KeyError, ValueError): - # Look for 1.9 to see if https://github.com/ninja-build/ninja/issues/1219 - # is fixed - NINJA_CMD = detect_ninja('1.9') + # Look for 1.12, which removes -w dupbuild=err + NINJA_CMD = detect_ninja('1.12') if NINJA_CMD is not None: - NINJA_1_9_OR_NEWER = True + NINJA_1_12_OR_NEWER = True else: - mlog.warning('Found ninja <1.9, tests will run slower', once=True) NINJA_CMD = detect_ninja() if NINJA_CMD is not None: - os.environ['NINJA_1_9_OR_NEWER'] = str(int(NINJA_1_9_OR_NEWER)) + os.environ['NINJA_1_12_OR_NEWER'] = str(int(NINJA_1_12_OR_NEWER)) os.environ['NINJA'] = NINJA_CMD[0] else: - raise RuntimeError('Could not find Ninja v1.7 or newer') + raise RuntimeError('Could not find Ninja.') # Emulate running meson with -X utf8 by making sure all open() calls have a # sane encoding. This should be a python default, but PEP 540 considered it not @@ -271,7 +269,9 @@ def get_backend_commands(backend: Backend, debug: bool = False) -> \ test_cmd = cmd + ['-target', 'RUN_TESTS'] elif backend is Backend.ninja: global NINJA_CMD - cmd = NINJA_CMD + ['-w', 'dupbuild=err', '-d', 'explain'] + cmd = NINJA_CMD + ['-d', 'explain'] + if not NINJA_1_12_OR_NEWER: + cmd += ['-w', 'dupbuild=err'] if debug: cmd += ['-v'] clean_cmd = cmd + ['clean'] @@ -282,21 +282,6 @@ def get_backend_commands(backend: Backend, debug: bool = False) -> \ raise AssertionError(f'Unknown backend: {backend!r}') return cmd, clean_cmd, test_cmd, install_cmd, uninstall_cmd -def ensure_backend_detects_changes(backend: Backend) -> None: - global NINJA_1_9_OR_NEWER - if backend is not Backend.ninja: - return - need_workaround = False - # We're using ninja >= 1.9 which has QuLogic's patch for sub-1s resolution - # timestamps - if not NINJA_1_9_OR_NEWER: - mlog.warning('Don\'t have ninja >= 1.9, enabling timestamp resolution workaround', once=True) - need_workaround = True - # Increase the difference between build.ninja's timestamp and the timestamp - # of whatever you changed: https://github.com/ninja-build/ninja/issues/371 - if need_workaround: - time.sleep(1) - def run_mtest_inprocess(commandlist: T.List[str]) -> T.Tuple[int, str, str]: out = StringIO() with mock.patch.object(sys, 'stdout', out), mock.patch.object(sys, 'stderr', out): diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py index 7c8543d..e94a2ba 100644 --- a/unittests/baseplatformtests.py +++ b/unittests/baseplatformtests.py @@ -31,7 +31,7 @@ import mesonbuild.modules.pkgconfig from run_tests import ( - Backend, ensure_backend_detects_changes, get_backend_commands, + Backend, get_backend_commands, get_builddir_target_args, get_meson_script, run_configure_inprocess, run_mtest_inprocess, handle_meson_skip_test, ) @@ -294,8 +294,6 @@ class BasePlatformTests(TestCase): arg = [arg] else: arg = list(arg) - if will_build: - ensure_backend_detects_changes(self.backend) self._run(self.mconf_command + arg + [self.builddir]) def getconf(self, optname: str): @@ -309,7 +307,6 @@ class BasePlatformTests(TestCase): windows_proof_rmtree(self.builddir) def utime(self, f): - ensure_backend_detects_changes(self.backend) os.utime(f) def get_compdb(self): |