Make use of get_argument_syntax() in test cases

pull/4250/head
Jon Turney 6 years ago
parent ac17f168ea
commit 198e869162
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 16
      run_unittests.py
  2. 2
      test cases/common/112 spaces backslash/meson.build
  3. 2
      test cases/common/123 llvm ir and assembly/meson.build
  4. 2
      test cases/common/138 c cpp and asm/meson.build
  5. 2
      test cases/common/143 C and CPP link/meson.build
  6. 2
      test cases/common/186 has link arg/meson.build
  7. 5
      test cases/common/91 default options/meson.build

@ -601,7 +601,7 @@ class InternalTests(unittest.TestCase):
elif is_cygwin():
self._test_all_naming(cc, env, patterns, 'cygwin')
elif is_windows():
if cc.get_id() == 'msvc':
if cc.get_argument_syntax() == 'msvc':
self._test_all_naming(cc, env, patterns, 'windows-msvc')
else:
self._test_all_naming(cc, env, patterns, 'windows-mingw')
@ -675,7 +675,7 @@ class InternalTests(unittest.TestCase):
bar_dep = PkgConfigDependency('bar', env, kwargs)
self.assertEqual(bar_dep.get_link_args(), [(p2 / 'libbar.a').as_posix()])
internal_dep = PkgConfigDependency('internal', env, kwargs)
if compiler.get_id() == 'msvc':
if compiler.get_argument_syntax() == 'msvc':
self.assertEqual(internal_dep.get_link_args(), [])
else:
link_args = internal_dep.get_link_args()
@ -1994,7 +1994,7 @@ int main(int argc, char **argv) {
def pbcompile(self, compiler, source, objectfile, extra_args=[]):
cmd = compiler.get_exelist()
if compiler.id == 'msvc':
if compiler.get_argument_syntax() == 'msvc':
cmd += ['/nologo', '/Fo' + objectfile, '/c', source] + extra_args
else:
cmd += ['-c', source, '-o', objectfile] + extra_args
@ -2016,7 +2016,7 @@ int main(int argc, char **argv) {
def build_static_lib(self, compiler, linker, source, objectfile, outfile, extra_args=None):
if extra_args is None:
extra_args = []
if compiler.id == 'msvc':
if compiler.get_argument_syntax() == 'msvc':
link_cmd = ['lib', '/NOLOGO', '/OUT:' + outfile, objectfile]
else:
link_cmd = ['ar', 'csr', outfile, objectfile]
@ -2049,7 +2049,7 @@ int main(int argc, char **argv) {
def build_shared_lib(self, compiler, source, objectfile, outfile, impfile, extra_args=None):
if extra_args is None:
extra_args = []
if compiler.id == 'msvc':
if compiler.get_argument_syntax() == 'msvc':
link_cmd = ['link', '/NOLOGO', '/DLL', '/DEBUG',
'/IMPLIB:' + impfile, '/OUT:' + outfile, objectfile]
else:
@ -2069,7 +2069,7 @@ int main(int argc, char **argv) {
source = os.path.join(tdir, 'alexandria.c')
objectfile = os.path.join(tdir, 'alexandria.' + object_suffix)
impfile = os.path.join(tdir, 'alexandria.lib')
if cc.id == 'msvc':
if cc.get_argument_syntax() == 'msvc':
shlibfile = os.path.join(tdir, 'alexandria.' + shared_suffix)
elif is_cygwin():
shlibfile = os.path.join(tdir, 'cygalexandria.' + shared_suffix)
@ -2107,7 +2107,7 @@ int main(int argc, char **argv) {
objectfile = os.path.join(testdir, 'foo.' + objext)
stlibfile = os.path.join(testdir, 'libfoo.a')
impfile = os.path.join(testdir, 'foo.lib')
if cc.id == 'msvc':
if cc.get_argument_syntax() == 'msvc':
shlibfile = os.path.join(testdir, 'foo.' + shext)
elif is_cygwin():
shlibfile = os.path.join(testdir, 'cygfoo.' + shext)
@ -3058,7 +3058,7 @@ class WindowsTests(BasePlatformTests):
testdir = os.path.join(self.platform_test_dir, '1 basic')
env = get_fake_env(testdir, self.builddir, self.prefix)
cc = env.detect_c_compiler(False)
if cc.id != 'msvc':
if cc.get_argument_syntax() != 'msvc':
raise unittest.SkipTest('Not using MSVC')
# To force people to update this test, and also test
self.assertEqual(set(cc.ignore_libs), {'c', 'm', 'pthread', 'dl', 'rt'})

@ -7,7 +7,7 @@ project('comparer', 'c')
include_dir = meson.current_source_dir() + '/include'
default_c_args = ['-I' + include_dir]
if meson.get_compiler('c').get_id() == 'msvc'
if meson.get_compiler('c').get_argument_syntax() == 'msvc'
default_c_args += ['/Faasm output\\']
# Hack to create the 'asm output' directory in the builddir
subdir('asm output')

@ -28,7 +28,7 @@ foreach lang : ['c', 'cpp']
# MSVC cannot directly compile assembly files, so we pass it through the
# cl.exe pre-processor first and then assemble it with the ml.exe assembler.
# Then we can link it into the executable.
if cc_id == 'msvc'
if cc.get_argument_syntax() == 'msvc'
cl = find_program('cl')
if cpu == 'x86'
ml = find_program('ml')

@ -9,7 +9,7 @@ if not supported_cpus.contains(cpu)
error('MESON_SKIP_TEST unsupported cpu:' + cpu)
endif
if meson.get_compiler('c').get_id() == 'msvc'
if meson.get_compiler('c').get_argument_syntax() == 'msvc'
error('MESON_SKIP_TEST MSVC can\'t compile assembly')
endif

@ -25,7 +25,7 @@ libc = static_library('cfoo', ['foo.c', 'foo.h'])
# ourselves at configure time and then 'find' it with cxx.find_library().
cxx = meson.get_compiler('cpp')
if cxx.get_id() == 'msvc'
if cxx.get_argument_syntax() == 'msvc'
compile_cmd = ['/c', '@INPUT@', '/Fo@OUTPUT@']
stlib_cmd = ['lib', '/OUT:@OUTPUT@', '@INPUT@']
else

@ -3,7 +3,7 @@ project('has link arg', 'c', 'cpp')
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
if cc.get_id() == 'msvc'
if cc.get_argument_syntax() == 'msvc'
is_arg = '/OPT:REF'
useless = '/DEBUG'
isnt_arg = '/iambroken'

@ -6,11 +6,9 @@ project('default options', 'cpp', 'c', default_options : [
'warning_level=3',
])
cpp_id = meson.get_compiler('cpp').get_id()
assert(get_option('buildtype') == 'debugoptimized', 'Build type default value wrong.')
if cpp_id == 'msvc'
if meson.get_compiler('cpp').get_argument_syntax() == 'msvc'
cpp_eh = get_option('cpp_eh')
assert(cpp_eh == 'none', 'MSVC eh value is "' + cpp_eh + '" instead of "none"')
else
@ -33,4 +31,3 @@ assert(w_level == '3', 'warning level "' + w_level + '" instead of "3"')
# assert(not cc.compiles('int foobar;'), 'Default arg not used in test.')
# assert(cc.compiles('int foobar;', no_builtin_args : true), 'No_builtin did not disable builtins.')
# endif

Loading…
Cancel
Save