aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-24 19:43:21 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-04-04 23:38:36 +0530
commit6042e21e25e31d4bb794ab83237beac511a15837 (patch)
tree09934d50be897233b3044ce3fbf995ebd273a164 /run_unittests.py
parent09fee02dd9484e682401469ff890cf99ef5fa56a (diff)
downloadmeson-6042e21e25e31d4bb794ab83237beac511a15837.zip
meson-6042e21e25e31d4bb794ab83237beac511a15837.tar.gz
meson-6042e21e25e31d4bb794ab83237beac511a15837.tar.bz2
Use CPPFLAGS for pre-processor compiler checks
Also don't add CFLAGS twice for links() checks Includes a test for this.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 0656f88..53abef7 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -947,6 +947,21 @@ class AllPlatformTests(BasePlatformTests):
m = re.search('build c-asm.*: c_LINKER', contents)
self.assertIsNotNone(m, msg=contents)
+ def test_preprocessor_checks_CPPFLAGS(self):
+ '''
+ Test that preprocessor compiler checks read CPPFLAGS but not CFLAGS
+ '''
+ testdir = os.path.join(self.common_test_dir, '140 get define')
+ define = 'MESON_TEST_DEFINE_VALUE'
+ # NOTE: this list can't have \n, ' or "
+ # \n is never substituted by the GNU pre-processor via a -D define
+ # ' and " confuse shlex.split() even when they are escaped
+ # % and # confuse the MSVC preprocessor
+ value = 'spaces and fun!@$^&*()-=_+{}[]:;<>?,./~`'
+ os.environ['CPPFLAGS'] = '-D{}="{}"'.format(define, value)
+ os.environ['CFLAGS'] = '-DMESON_FAIL_VALUE=cflags-read'.format(define)
+ self.init(testdir, ['-D{}={}'.format(define, value)])
+
class WindowsTests(BasePlatformTests):
'''