mirror of
https://github.com/mesonbuild/meson.git
synced 2026-11-06 05:16:42 +00:00
interpreter: fix inconsistent machine between do_subproject() and calls to self.disabled_subproject()
In order to correctly check for failing subprojects inclusion, calls to self.disabled_subproject() need to use the correct machine. Ensure this is the case by making for_machine a non-optional parameter. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
1 parent
d275d164b5
commit
c469bd779c
3 files changed
+14
-6
No files matched your search
@@ -963,9 +963,9 @@ class Interpreter(InterpreterBase, HoldableObject):
|
||||
}
|
||||
return self.do_subproject(args[0], kw)
|
||||
|
||||
def disabled_subproject(self, subp_name: SubProject, disabled_feature: T.Optional[str] = None,
|
||||
exception: T.Optional[Exception] = None,
|
||||
for_machine: MachineChoice = MachineChoice.HOST) -> SubprojectHolder:
|
||||
def disabled_subproject(self, subp_name: SubProject, for_machine: MachineChoice,
|
||||
disabled_feature: T.Optional[str] = None,
|
||||
exception: T.Optional[Exception] = None) -> SubprojectHolder:
|
||||
sub = SubprojectHolder(NullSubprojectInterpreter(), os.path.join(self.subproject_dir, subp_name),
|
||||
disabled_feature=disabled_feature, exception=exception)
|
||||
self.subprojects[for_machine][subp_name] = sub
|
||||
@@ -995,7 +995,7 @@ class Interpreter(InterpreterBase, HoldableObject):
|
||||
|
||||
if disabled:
|
||||
mlog.log('Subproject', mlog.bold(subp_name), ':', 'skipped: feature', mlog.bold(feature), 'disabled')
|
||||
return self.disabled_subproject(subp_name, disabled_feature=feature, for_machine=for_machine)
|
||||
return self.disabled_subproject(subp_name, for_machine, disabled_feature=feature)
|
||||
|
||||
default_options = kwargs['default_options']
|
||||
|
||||
@@ -1047,7 +1047,7 @@ class Interpreter(InterpreterBase, HoldableObject):
|
||||
if not required:
|
||||
mlog.log(e)
|
||||
mlog.log(*msg, '(disabling)')
|
||||
return self.disabled_subproject(subp_name, exception=e)
|
||||
return self.disabled_subproject(subp_name, for_machine, exception=e)
|
||||
mlog.error(*msg)
|
||||
raise e
|
||||
|
||||
@@ -1080,7 +1080,7 @@ class Interpreter(InterpreterBase, HoldableObject):
|
||||
# fatal and VS CI treat any logs with "ERROR:" as fatal.
|
||||
mlog.exception(e, prefix=mlog.yellow('Exception:'))
|
||||
mlog.log('\nSubproject', mlog.bold(subdir), 'is buildable:', mlog.red('NO'), '(disabling)')
|
||||
return self.disabled_subproject(subp_name, exception=e)
|
||||
return self.disabled_subproject(subp_name, for_machine, exception=e)
|
||||
raise e
|
||||
|
||||
def _save_ast(self, subdir: str, ast: mparser.CodeBlockNode) -> None:
|
||||
|
||||
@@ -28,6 +28,10 @@ test('main', e)
|
||||
|
||||
if meson.is_cross_build()
|
||||
subproject('test installs', native : true)
|
||||
|
||||
# A failure for the build machine must not be recorded for the host machine.
|
||||
subproject('flaky', native : true, required : false)
|
||||
subproject('flaky', native : false, required : true)
|
||||
endif
|
||||
|
||||
# Test a subproject configured from the main project, and then called as a nested subproject
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
project('flaky')
|
||||
|
||||
# This fails for the build machine, where the project is not a cross target.
|
||||
assert(meson.is_cross_build(), 'this subproject only works when cross compiling')
|
||||
Reference in new issue
Block a user