aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-06-04 14:07:27 +0300
committerGitHub <noreply@github.com>2017-06-04 14:07:27 +0300
commit62051626a5784e371ad63042425bb2444143ed7f (patch)
tree1a9b05413478e440a34269520a49ff067a544220 /run_unittests.py
parent53e47d42f07e53f040ae68437f893032af3fea27 (diff)
parent4b428053f496720ec437eb5d455c86ada2de7977 (diff)
downloadmeson-62051626a5784e371ad63042425bb2444143ed7f.zip
meson-62051626a5784e371ad63042425bb2444143ed7f.tar.gz
meson-62051626a5784e371ad63042425bb2444143ed7f.tar.bz2
Merge pull request #1545 from centricular/dont-link-recursively
Don't add dependencies recursively while linking
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/run_unittests.py b/run_unittests.py
index e3b7c5c..a610e6b 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -139,7 +139,7 @@ class InternalTests(unittest.TestCase):
self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-O3', '-O2', '-Wall'])
## Test that reflected addition works
- # Test that adding to a list with just one old arg works and DOES NOT yield the same array
+ # Test that adding to a list with just one old arg works and yields the same array
a = ['-Ifoo'] + a
self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-O3', '-O2', '-Wall'])
# Test that adding to a list with just one new arg that is not pre-pended works
@@ -148,6 +148,19 @@ class InternalTests(unittest.TestCase):
# Test that adding to a list with two new args preserves the order
a = ['-Ldir', '-Lbah'] + a
self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Ldir', '-Lbah', '-Werror', '-O3', '-O2', '-Wall'])
+ # Test that adding to a list with old args does nothing
+ a = ['-Ibar', '-Ibaz', '-Ifoo'] + a
+ self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Ldir', '-Lbah', '-Werror', '-O3', '-O2', '-Wall'])
+
+ ## Test that adding libraries works
+ l = cargsfunc(c, ['-Lfoodir', '-lfoo'])
+ self.assertEqual(l, ['-Lfoodir', '-lfoo'])
+ # Adding a library and a libpath appends both correctly
+ l += ['-Lbardir', '-lbar']
+ self.assertEqual(l, ['-Lbardir', '-Lfoodir', '-lfoo', '-lbar'])
+ # Adding the same library again does nothing
+ l += ['-lbar']
+ self.assertEqual(l, ['-Lbardir', '-Lfoodir', '-lfoo', '-lbar'])
def test_commonpath(self):
from os.path import sep
@@ -1253,15 +1266,15 @@ class LinuxlikeTests(BasePlatformTests):
self.assertIsNotNone(vala_command)
self.assertIsNotNone(c_command)
# -w suppresses all warnings, should be there in Vala but not in C
- self.assertIn("'-w'", vala_command)
- self.assertNotIn("'-w'", c_command)
+ self.assertIn(" -w ", vala_command)
+ self.assertNotIn(" -w ", c_command)
# -Wall enables all warnings, should be there in C but not in Vala
- self.assertNotIn("'-Wall'", vala_command)
- self.assertIn("'-Wall'", c_command)
+ self.assertNotIn(" -Wall ", vala_command)
+ self.assertIn(" -Wall ", c_command)
# -Werror converts warnings to errors, should always be there since it's
# injected by an unrelated piece of code and the project has werror=true
- self.assertIn("'-Werror'", vala_command)
- self.assertIn("'-Werror'", c_command)
+ self.assertIn(" -Werror ", vala_command)
+ self.assertIn(" -Werror ", c_command)
def test_qt5dependency_pkgconfig_detection(self):
'''
@@ -1392,7 +1405,7 @@ class LinuxlikeTests(BasePlatformTests):
self.init(testdir, ['-D' + std_opt])
cmd = self.get_compdb()[0]['command']
if v != 'none':
- cmd_std = "'-std={}'".format(v)
+ cmd_std = " -std={} ".format(v)
self.assertIn(cmd_std, cmd)
try:
self.build()
@@ -1407,7 +1420,7 @@ class LinuxlikeTests(BasePlatformTests):
os.environ[env_flags] = cmd_std
self.init(testdir)
cmd = self.get_compdb()[0]['command']
- qcmd_std = "'{}'".format(cmd_std)
+ qcmd_std = " {} ".format(cmd_std)
self.assertIn(qcmd_std, cmd)
with self.assertRaises(subprocess.CalledProcessError,
msg='{} should have failed'.format(qcmd_std)):