unittests: Pass the exact backend name

CI runs with vs2019 and we were passing --backend=vs. This fix
reconfigure tests because we can't reconfigure with --backend=vs when
initial configuration determined the backend is actually vs2019.
pull/11613/head
Xavier Claessens 2 years ago committed by Jussi Pakkanen
parent 567d1fec9b
commit 42c4058304
  1. 4
      run_tests.py
  2. 2
      unittests/allplatformstests.py
  3. 6
      unittests/baseplatformtests.py

@ -358,7 +358,7 @@ def main():
parser.add_argument('--no-unittests', action='store_true', default=False) parser.add_argument('--no-unittests', action='store_true', default=False)
(options, _) = parser.parse_known_args() (options, _) = parser.parse_known_args()
returncode = 0 returncode = 0
backend, _ = guess_backend(options.backend, shutil.which('msbuild')) _, backend_flags = guess_backend(options.backend, shutil.which('msbuild'))
no_unittests = options.no_unittests no_unittests = options.no_unittests
# Running on a developer machine? Be nice! # Running on a developer machine? Be nice!
if not mesonlib.is_windows() and not mesonlib.is_haiku() and 'CI' not in os.environ: if not mesonlib.is_windows() and not mesonlib.is_haiku() and 'CI' not in os.environ:
@ -394,7 +394,7 @@ def main():
else: else:
print(mlog.bold('Running unittests.')) print(mlog.bold('Running unittests.'))
print(flush=True) print(flush=True)
cmd = mesonlib.python_command + ['run_unittests.py', '--backend=' + backend.name, '-v'] cmd = mesonlib.python_command + ['run_unittests.py', '-v'] + backend_flags
if options.failfast: if options.failfast:
cmd += ['--failfast'] cmd += ['--failfast']
returncode += subprocess_call(cmd, env=env) returncode += subprocess_call(cmd, env=env)

@ -3460,7 +3460,7 @@ class AllPlatformTests(BasePlatformTests):
subsub : YES subsub : YES
User defined options User defined options
backend : ''' + self.backend.name + ''' backend : ''' + self.backend_name + '''
libdir : lib libdir : lib
prefix : /usr prefix : /usr
enabled_opt : enabled enabled_opt : enabled

@ -55,8 +55,10 @@ class BasePlatformTests(TestCase):
src_root = str(PurePath(__file__).parents[1]) src_root = str(PurePath(__file__).parents[1])
self.src_root = src_root self.src_root = src_root
# Get the backend # Get the backend
self.backend = getattr(Backend, os.environ['MESON_UNIT_TEST_BACKEND']) self.backend_name = os.environ['MESON_UNIT_TEST_BACKEND']
self.meson_args = ['--backend=' + self.backend.name] backend_type = 'vs' if self.backend_name.startswith('vs') else self.backend_name
self.backend = getattr(Backend, backend_type)
self.meson_args = ['--backend=' + self.backend_name]
self.meson_native_files = [] self.meson_native_files = []
self.meson_cross_files = [] self.meson_cross_files = []
self.meson_command = python_command + [get_meson_script()] self.meson_command = python_command + [get_meson_script()]

Loading…
Cancel
Save