tests: Detect ninja v1.9 and disable timestamp hack

The high-res timestamp PR by QuLogic was merged in v1.9, so we can
switch back to upstream ninja.
pull/5835/head
Nirbheek Chauhan 6 years ago committed by Jussi Pakkanen
parent 2048bd41ec
commit 96088d3e51
  1. 1
      azure-pipelines.yml
  2. 23
      run_tests.py

@ -8,7 +8,6 @@ trigger:
- '0.*'
variables:
MESON_FIXED_NINJA: 1
CI: 1
jobs:

@ -34,6 +34,8 @@ from mesonbuild import mlog
from mesonbuild.environment import Environment, detect_ninja
from mesonbuild.coredata import backendlist
NINJA_1_9_OR_NEWER = False
def guess_backend(backend, msbuild_exe: str):
# Auto-detect backend if unspecified
backend_flags = []
@ -201,8 +203,18 @@ def get_backend_commands(backend, debug=False):
clean_cmd = cmd + ['-alltargets', 'clean', '-UseNewBuildSystem=FALSE']
test_cmd = cmd + ['-target', 'RUN_TESTS']
elif backend is Backend.ninja:
# We need at least 1.6 because of -w dupbuild=err
cmd = [detect_ninja('1.6'), '-w', 'dupbuild=err', '-d', 'explain']
global NINJA_1_9_OR_NEWER
# Look for 1.9 to see if https://github.com/ninja-build/ninja/issues/1219
# is fixed, else require 1.6 for -w dupbuild=err
for v in ('1.9', '1.6'):
ninja_cmd = detect_ninja(v)
if ninja_cmd is not None:
if v == '1.9':
NINJA_1_9_OR_NEWER = True
else:
print('Found ninja <1.9, tests will run slower')
break
cmd = [ninja_cmd, '-w', 'dupbuild=err', '-d', 'explain']
if cmd[0] is None:
raise RuntimeError('Could not find Ninja v1.6 or newer')
if debug:
@ -216,11 +228,12 @@ def get_backend_commands(backend, debug=False):
return cmd, clean_cmd, test_cmd, install_cmd, uninstall_cmd
def ensure_backend_detects_changes(backend):
# We're using a ninja with QuLogic's patch for sub-1s resolution timestamps
# and not running on HFS+ which only stores dates in seconds:
global NINJA_1_9_OR_NEWER
# We're using ninja >= 1.9 which has QuLogic's patch for sub-1s resolution
# timestamps and not running on HFS+ which only stores dates in seconds:
# https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates
# FIXME: Upgrade Travis image to Apple FS when that becomes available
if 'MESON_FIXED_NINJA' in os.environ and not mesonlib.is_osx():
if (NINJA_1_9_OR_NEWER or ('MESON_FIXED_NINJA' in os.environ)) and not mesonlib.is_osx():
return
# This is needed to increase the difference between build.ninja's
# timestamp and the timestamp of whatever you changed due to a Ninja

Loading…
Cancel
Save