aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-04-23 10:10:44 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2018-04-25 20:59:27 +0300
commit185ae3d42096b07ebcc0adc98b6c6c7811807f16 (patch)
tree0f832a17f0e78ac05d2e8d5cb3699b9a640b0102 /run_unittests.py
parentb8f1b84733e1a217eb3f94146b668ded4dadef08 (diff)
downloadmeson-185ae3d42096b07ebcc0adc98b6c6c7811807f16.zip
meson-185ae3d42096b07ebcc0adc98b6c6c7811807f16.tar.gz
meson-185ae3d42096b07ebcc0adc98b6c6c7811807f16.tar.bz2
tests: Add the same kind of tests for configure.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py
index be48f11..ce18a1a 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -642,9 +642,11 @@ class BasePlatformTests(unittest.TestCase):
return self.build(target=target)
def setconf(self, arg, will_build=True):
+ if not isinstance(arg, list):
+ arg = [arg]
if will_build:
ensure_backend_detects_changes(self.backend)
- self._run(self.mconf_command + [arg, self.builddir])
+ self._run(self.mconf_command + arg + [self.builddir])
def wipe(self):
windows_proof_rmtree(self.builddir)
@@ -2046,6 +2048,32 @@ recommended as it can lead to undefined behaviour on some platforms''')
def test_same_project_d_option_twice(self):
self._test_same_option_twice('one', ['-Done=foo', '-Done=bar'])
+ def _test_same_option_twice_configure(self, arg, args):
+ testdir = os.path.join(self.unit_test_dir, '30 mixed command line args')
+ self.init(testdir)
+ self.setconf(args)
+ opts = self.introspect('--buildoptions')
+ for item in opts:
+ if item['name'] == arg:
+ self.assertEqual(item['value'], 'bar')
+ return
+ raise Exception('Missing {} value?'.format(arg))
+
+ def test_same_dash_option_twice_configure(self):
+ with self.assertRaises(subprocess.CalledProcessError) as e:
+ self._test_same_option_twice_configure(
+ 'bindir', ['--bindir=foo', '--bindir=bar'])
+ self.assertIn('Pick one.', e.stderr)
+
+ def test_same_d_option_twice_configure(self):
+ self._test_same_option_twice_configure(
+ 'bindir', ['-Dbindir=foo', '-Dbindir=bar'])
+
+ def test_same_project_d_option_twice_configure(self):
+ self._test_same_option_twice_configure(
+ 'one', ['-Done=foo', '-Done=bar'])
+
+
class FailureTests(BasePlatformTests):
'''