Fix tests for 0.51.2.

0.51
Jussi Pakkanen 5 years ago committed by Nirbheek Chauhan
parent 550a03ee24
commit 0a4609031c
  1. 43
      run_unittests.py
  2. 2
      test cases/unit/50 std remains/meson.build
  3. 14
      test cases/unit/51 noncross options/meson.build
  4. 0
      test cases/unit/51 noncross options/prog.c
  5. 13
      test cases/unit/51 noncross options/ylib.pc
  6. 11
      test cases/unit/55 introspection/staticlib/static.h

@ -3604,20 +3604,19 @@ recommended as it is not supported on some platforms''')
self.setconf('-Dcpp_std=c++14')
self.setconf('-Dbuildtype=release')
for idx, i in enumerate(res1):
with open(introfile, 'r') as fp:
res2 = json.load(fp)
for idx, i in enumerate(res2):
if i['name'] == 'cpp_std':
res1[idx]['value'] = 'c++14'
self.assertEqual(res2[idx]['value'], 'c++14')
if i['name'] == 'buildtype':
res1[idx]['value'] = 'release'
self.assertEqual(res2[idx]['value'], 'release')
if i['name'] == 'optimization':
res1[idx]['value'] = '3'
self.assertEqual(res2[idx]['value'], '3')
if i['name'] == 'debug':
res1[idx]['value'] = False
with open(introfile, 'r') as fp:
res2 = json.load(fp)
self.assertEqual(res2[idx]['value'], False)
self.assertListEqual(res1, res2)
def test_introspect_targets_from_source(self):
testdir = os.path.join(self.unit_test_dir, '55 introspection')
@ -5215,20 +5214,14 @@ endian = 'little'
# Assert that
self.assertEqual(len(line.split(lib)), 2, msg=(lib, line))
@skipIfNoPkgconfig
def test_pkg_config_option(self):
testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option')
self.init(testdir, extra_args=[
'-Dbuild.pkg_config_path=' + os.path.join(testdir, 'build_extra_path'),
'-Dpkg_config_path=' + os.path.join(testdir, 'host_extra_path'),
])
def test_std_remains(self):
def test_std_noncross_options(self):
# C_std defined in project options must be in effect also when native compiling.
testdir = os.path.join(self.unit_test_dir, '50 std remains')
self.init(testdir)
testdir = os.path.join(self.unit_test_dir, '51 noncross options')
self.init(testdir, extra_args=['-Dpkg_config_path=' + testdir])
compdb = self.get_compdb()
self.assertEqual(len(compdb), 2)
self.assertRegex(compdb[0]['command'], '-std=c99')
self.assertRegex(compdb[1]['command'], '-std=c99')
self.build()
def test_identity_cross(self):
@ -5296,12 +5289,20 @@ class LinuxCrossArmTests(BasePlatformTests):
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')
testdir = os.path.join(self.unit_test_dir, '51 noncross options')
self.init(testdir)
compdb = self.get_compdb()
self.assertRegex(compdb[0]['command'], '-std=c99')
self.build()
@skipIfNoPkgconfig
def test_pkg_config_option(self):
testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option')
self.init(testdir, extra_args=[
'-Dbuild.pkg_config_path=' + os.path.join(testdir, 'build_extra_path'),
'-Dpkg_config_path=' + os.path.join(testdir, 'host_extra_path'),
])
def should_run_cross_mingw_tests():
return shutil.which('x86_64-w64-mingw32-gcc') and not (is_windows() or is_cygwin())

@ -1,2 +0,0 @@
project('std_remains', 'c', default_options: ['c_std=c99'])
executable('prog', 'prog.c')

@ -0,0 +1,14 @@
project('std_remains', 'c', default_options: ['c_std=c99'])
executable('prog', 'prog.c')
# Check that native: true does not affect the use of c_std in
# non-cross builds
if not meson.is_cross_build()
executable('prog2', 'prog.c', native: true)
# Check that even deps marked as native are found
# by default when not cross compiling.
dependency('ylib', method: 'pkg-config')
endif

@ -0,0 +1,13 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
sharedlibdir=${libdir}
includedir=${prefix}/include
Name: ylib
Description: ylib compression library
Version: 1.2.3
Requires:
Libs: -L${libdir} -L${sharedlibdir} -ly
Cflags: -I${includedir}

@ -1,3 +1,12 @@
#pragma once
int add_numbers(int a, int b);
#ifdef __cplusplus
extern "C" {
#endif
int add_numbers(int a, int b);
/* End Extern "C" and Include Guard */
#ifdef __cplusplus
}
#endif

Loading…
Cancel
Save