From 9009c0912ff8773353195dd463f8b20fff355dfa Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 9 Aug 2021 11:47:34 -0400 Subject: interpreter: Fix missing subsubproject summary when subproject fails In the case main->subp->subsubp, if subsubp succeed to configure but subp subsequentially fails, subsubp is still being built but its summary was missing. --- mesonbuild/interpreter/interpreter.py | 7 ++++--- run_unittests.py | 5 +++++ test cases/unit/72 summary/subprojects/sub2/meson.build | 3 ++- .../72 summary/subprojects/sub2/subprojects/subsub/meson.build | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index a5b2597..8374562 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -923,6 +923,7 @@ external dependencies (including libraries) must go to "dependencies".''') subi.modules = self.modules subi.holder_map = self.holder_map subi.bound_holder_map = self.bound_holder_map + subi.summary = self.summary subi.subproject_stack = self.subproject_stack + [subp_name] current_active = self.active_projectname @@ -952,7 +953,6 @@ external dependencies (including libraries) must go to "dependencies".''') self.build.merge(subi.build) self.build.subprojects[subp_name] = subi.project_version self.coredata.initialized_subprojects.add(subp_name) - self.summary.update(subi.summary) return self.subprojects[subp_name] def _do_subproject_cmake(self, subp_name, subdir, subdir_abs, default_options, kwargs): @@ -1280,8 +1280,9 @@ external dependencies (including libraries) must go to "dependencies".''') # Print all summaries, main project last. mlog.log('') # newline main_summary = self.summary.pop('', None) - for _, summary in sorted(self.summary.items()): - summary.dump() + for subp_name, summary in sorted(self.summary.items()): + if self.subprojects[subp_name].found(): + summary.dump() if main_summary: main_summary.dump() diff --git a/run_unittests.py b/run_unittests.py index 9f853d8..97ca598 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -5310,6 +5310,10 @@ class AllPlatformTests(BasePlatformTests): integer: 1 boolean: True + subsub undefined + + Something: Some value + My Project 1.0 Configuration @@ -5339,6 +5343,7 @@ class AllPlatformTests(BasePlatformTests): Subprojects sub : YES sub2 : NO Problem encountered: This subproject failed + subsub : YES ''') expected_lines = expected.split('\n')[1:] out_start = out.find(expected_lines[0]) diff --git a/test cases/unit/72 summary/subprojects/sub2/meson.build b/test cases/unit/72 summary/subprojects/sub2/meson.build index 86b9cfd..2560bd0 100644 --- a/test cases/unit/72 summary/subprojects/sub2/meson.build +++ b/test cases/unit/72 summary/subprojects/sub2/meson.build @@ -1,5 +1,6 @@ project('sub2') -error('This subproject failed') +subproject('subsub') summary('Section', 'Should not be seen') +error('This subproject failed') diff --git a/test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build b/test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build new file mode 100644 index 0000000..98a5a26 --- /dev/null +++ b/test cases/unit/72 summary/subprojects/sub2/subprojects/subsub/meson.build @@ -0,0 +1,3 @@ +project('subsub') + +summary('Something', 'Some value') -- cgit v1.1