aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-04-13 00:00:59 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-05-10 00:50:52 +0300
commit1456a6eb5b54c0be73207de317d758c6636ba13a (patch)
treebc1803aa9fd9d327d800ebd45e94f0cd60e5b90f
parentd7ee2ec7c0f2e69c4145a5db21aecbf602a344fb (diff)
downloadmeson-1456a6eb5b54c0be73207de317d758c6636ba13a.zip
meson-1456a6eb5b54c0be73207de317d758c6636ba13a.tar.gz
meson-1456a6eb5b54c0be73207de317d758c6636ba13a.tar.bz2
Add tests for std usage. Closes #5097.revertoverride
-rwxr-xr-xrun_unittests.py16
-rw-r--r--test cases/unit/50 std remains/meson.build2
-rw-r--r--test cases/unit/50 std remains/prog.c1
3 files changed, 19 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 37c0e13..375cc49 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -5151,6 +5151,14 @@ endian = 'little'
testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option')
self.init(testdir, extra_args=['-Dpkg_config_path=' + os.path.join(testdir, 'extra_path')])
+ def test_std_remains(self):
+ # C_std defined in project options must be in effect also when cross compiling.
+ testdir = os.path.join(self.unit_test_dir, '50 std remains')
+ self.init(testdir)
+ compdb = self.get_compdb()
+ self.assertRegex(compdb[0]['command'], '-std=c99')
+ self.build()
+
def should_run_cross_arm_tests():
return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm')
@@ -5203,6 +5211,14 @@ class LinuxCrossArmTests(BasePlatformTests):
return
self.assertTrue(False, 'Option libdir not in introspect data.')
+ def test_std_remains(self):
+ # C_std defined in project options must be in effect also when cross compiling.
+ testdir = os.path.join(self.unit_test_dir, '50 std remains')
+ self.init(testdir)
+ compdb = self.get_compdb()
+ self.assertRegex(compdb[0]['command'], '-std=c99')
+ self.build()
+
def should_run_cross_mingw_tests():
return shutil.which('x86_64-w64-mingw32-gcc') and not (is_windows() or is_cygwin())
diff --git a/test cases/unit/50 std remains/meson.build b/test cases/unit/50 std remains/meson.build
new file mode 100644
index 0000000..ac6f9e2
--- /dev/null
+++ b/test cases/unit/50 std remains/meson.build
@@ -0,0 +1,2 @@
+project('std_remains', 'c', default_options: ['c_std=c99'])
+executable('prog', 'prog.c')
diff --git a/test cases/unit/50 std remains/prog.c b/test cases/unit/50 std remains/prog.c
new file mode 100644
index 0000000..0314ff1
--- /dev/null
+++ b/test cases/unit/50 std remains/prog.c
@@ -0,0 +1 @@
+int main(int argc, char **argv) { return 0; }