From c4a9f59dc415f40513a281210d9598911b35b723 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Tue, 23 Oct 2018 21:17:37 +0300 Subject: [PATCH] Move VS C++17 test to a unit test since it requires env setup. --- run_unittests.py | 13 +++++++++++++ .../{windows/17 cpp17 => unit/45 vscpp17}/main.cpp | 0 test cases/unit/45 vscpp17/meson.build | 4 ++++ test cases/windows/17 cpp17/meson.build | 9 --------- 4 files changed, 17 insertions(+), 9 deletions(-) rename test cases/{windows/17 cpp17 => unit/45 vscpp17}/main.cpp (100%) create mode 100644 test cases/unit/45 vscpp17/meson.build delete mode 100644 test cases/windows/17 cpp17/meson.build diff --git a/run_unittests.py b/run_unittests.py index 9e9ba040c..ee80a87b6 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3097,6 +3097,19 @@ class WindowsTests(BasePlatformTests): self.utime(os.path.join(testdir, 'res', 'resource.h')) self.assertRebuiltTarget('prog_1') + @unittest.skipIf(shutil.which('cl') is None, 'Test only applies to VS') + def test_msvc_cpp17(self): + testdir = os.path.join(self.unit_test_dir, '45 vscpp17') + try: + self.init(testdir) + except subprocess.CalledProcessError: + # According to Python docs, output is only stored when + # using check_output. We don't use it, so we can't check + # that the output is correct (i.e. that it failed due + # to the right reason). + return + self.build() + class DarwinTests(BasePlatformTests): ''' Tests that should run on macOS diff --git a/test cases/windows/17 cpp17/main.cpp b/test cases/unit/45 vscpp17/main.cpp similarity index 100% rename from test cases/windows/17 cpp17/main.cpp rename to test cases/unit/45 vscpp17/main.cpp diff --git a/test cases/unit/45 vscpp17/meson.build b/test cases/unit/45 vscpp17/meson.build new file mode 100644 index 000000000..afe740bbc --- /dev/null +++ b/test cases/unit/45 vscpp17/meson.build @@ -0,0 +1,4 @@ +project('msvc_cpp17', 'cpp', default_options: ['cpp_std=c++17']) + +exe = executable('msvc_cpp17', 'main.cpp') +test('msvc_cpp17', exe) diff --git a/test cases/windows/17 cpp17/meson.build b/test cases/windows/17 cpp17/meson.build deleted file mode 100644 index 367bfd895..000000000 --- a/test cases/windows/17 cpp17/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('msvc_cpp17', 'cpp', default_options: ['cpp_std=c++17']) - -compiler = meson.get_compiler('cpp') -if compiler.get_id() != 'msvc' or compiler.version().version_compare('<19.11') - error('MESON_SKIP_TEST Visual Studio 2017 (version 15.3) or later is required for C++17 support') -endif - -exe = executable('msvc_cpp17', 'main.cpp') -test('msvc_cpp17', exe)