diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-03-07 00:34:05 +0530 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-03-11 07:11:59 -0400 |
commit | c7aa4c8861eb6c1d3534b3b0e94e901b7b2d0206 (patch) | |
tree | 3979ef7df1f5addad9da44f143c936a2bc31ba02 /run_unittests.py | |
parent | bc135f6c4dd56c925438d9c84f3bb6794f7ecaa3 (diff) | |
download | meson-c7aa4c8861eb6c1d3534b3b0e94e901b7b2d0206.zip meson-c7aa4c8861eb6c1d3534b3b0e94e901b7b2d0206.tar.gz meson-c7aa4c8861eb6c1d3534b3b0e94e901b7b2d0206.tar.bz2 |
coredata: Set default options as cmdline args that override each other
The previous code was assuming that options do not depend on each
other, and that you can set defaults using `dict.setdefault()`. This
is not true for `buildtype` + `optimization`/`debug`, so we add
defaults + overrides in the right order and use the options parsing
code later to compute the values.
Includes a test.
Closes https://github.com/mesonbuild/meson/issues/6752
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index baea70e..5b25b6c 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3825,6 +3825,24 @@ recommended as it is not supported on some platforms''') self.assertEqual(opts['debug'], True) self.assertEqual(opts['optimization'], '0') + # Command-line parsing of buildtype settings should be the same as + # setting with `meson configure`. + # + # Setting buildtype should set optimization/debug + self.new_builddir() + self.init(testdir, extra_args=['-Dbuildtype=debugoptimized']) + opts = self.get_opts_as_dict() + self.assertEqual(opts['debug'], True) + self.assertEqual(opts['optimization'], '2') + self.assertEqual(opts['buildtype'], 'debugoptimized') + # Setting optimization/debug should set buildtype + self.new_builddir() + self.init(testdir, extra_args=['-Doptimization=2', '-Ddebug=true']) + opts = self.get_opts_as_dict() + self.assertEqual(opts['debug'], True) + self.assertEqual(opts['optimization'], '2') + self.assertEqual(opts['buildtype'], 'debugoptimized') + @skipIfNoPkgconfig @unittest.skipIf(is_windows(), 'Help needed with fixing this test on windows') def test_native_dep_pkgconfig(self): |