Skip to content

Commit 9b1eb8b

Browse files
bonzinijpakkane
authored andcommitted
test cases: do not pass global option on command line
The test covers overriding an option from the dependency() function. If the same option is passed on the command line, it overrides the dependency()'s default_options as well. Tweak the description of the unittests that uses the same sources. The tests pass, but I am not sure they should. For example in the second test the default_library=both setting in the machine file should have the same effect as the -D option (machine files have lower priority than command line, but higher priority than anything in meson.build files). Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e284c0d commit 9b1eb8b

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

test cases/common/223 persubproject options/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('persubproject options', 'c', 'cpp',
2-
default_options : ['werror=true',
2+
default_options : ['werror=true', 'default_library=both',
33
'warning_level=3',
44
'cpp_std=c++11'])
55

test cases/common/223 persubproject options/test.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

unittests/machinefiletests.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ def test_builtin_options_subprojects(self):
550550
# into augments.
551551
self.assertEqual(found, 2, 'Did not find all two sections')
552552

553-
def test_builtin_options_subprojects_overrides_buildfiles(self):
554-
# If the buildfile says subproject(... default_library: shared), ensure that's overwritten
553+
def test_builtin_options_machinefile_overrides_subproject(self):
554+
# The buildfile says subproject(... default_library: static), the machinefile overrides it
555555
testcase = os.path.join(self.common_test_dir, '223 persubproject options')
556556
config = self.helper_create_native_file({'sub2:built-in options': {'default_library': 'shared'}})
557557

@@ -563,8 +563,9 @@ def test_builtin_options_subprojects_overrides_buildfiles(self):
563563
check = cm.exception.stdout
564564
self.assertIn(check, 'Parent should override default_library')
565565

566-
def test_builtin_options_subprojects_dont_inherits_parent_override(self):
567-
# If the buildfile says subproject(... default_library: shared), ensure that's overwritten
566+
def test_builtin_options_machinefile_global_loses_over_subproject(self):
567+
# The buildfile says subproject(... default_library: static), ensure that it overrides the machinefile
568+
# FIXME: Should it??
568569
testcase = os.path.join(self.common_test_dir, '223 persubproject options')
569570
config = self.helper_create_native_file({'built-in options': {'default_library': 'both'}})
570571
self.init(testcase, extra_args=['--native-file', config])

0 commit comments

Comments
 (0)