diff options
-rw-r--r-- | mesonbuild/ast/introspection.py | 3 | ||||
-rw-r--r-- | mesonbuild/environment.py | 11 | ||||
-rwxr-xr-x | run_unittests.py | 31 | ||||
-rw-r--r-- | test cases/unit/53 introspect buildoptions/main.c | 6 | ||||
-rw-r--r-- | test cases/unit/53 introspect buildoptions/meson.build | 5 |
5 files changed, 27 insertions, 29 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index 0917015..f0ff43f 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -142,10 +142,11 @@ class IntrospectionInterpreter(AstInterpreter): }] def build_target(self, node, args, kwargs, targetclass): + args = self.flatten_args(args) if not args: return kwargs = self.flatten_kwargs(kwargs, True) - name = self.flatten_args(args)[0] + name = args[0] srcqueue = [node] if 'sources' in kwargs: srcqueue += kwargs['sources'] diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index b2cc657..bbe82ec 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -101,17 +101,6 @@ known_cpu_families = ( 'x86_64' ) -# Environment variables that each lang uses. -cflags_mapping = {'c': 'CFLAGS', - 'cpp': 'CXXFLAGS', - 'cu': 'CUFLAGS', - 'objc': 'OBJCFLAGS', - 'objcpp': 'OBJCXXFLAGS', - 'fortran': 'FFLAGS', - 'd': 'DFLAGS', - 'vala': 'VALAFLAGS'} - - def detect_gcovr(version='3.1', log=False): gcovr_exe = 'gcovr' try: diff --git a/run_unittests.py b/run_unittests.py index fbd51df..fee8077 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3747,6 +3747,7 @@ class FailureTests(BasePlatformTests): """Subproject "subprojects/not-found-subproject" disabled can't get_variable on it.""") +@unittest.skipUnless(is_windows() or is_cygwin(), "requires Windows (or Windows via Cygwin)") class WindowsTests(BasePlatformTests): ''' Tests that should run on Cygwin, MinGW, and MSVC @@ -3857,6 +3858,7 @@ class WindowsTests(BasePlatformTests): return self.build() +@unittest.skipUnless(is_osx(), "requires Darwin") class DarwinTests(BasePlatformTests): ''' Tests that should run on macOS @@ -3953,6 +3955,7 @@ class DarwinTests(BasePlatformTests): del os.environ["LDFLAGS"] +@unittest.skipUnless(not is_windows(), "requires something Unix-like") class LinuxlikeTests(BasePlatformTests): ''' Tests that should run on Linux, macOS, and *BSD @@ -4931,6 +4934,10 @@ endian = 'little' self.assertEqual(max_count, 1, 'Export dynamic incorrectly deduplicated.') +def should_run_cross_arm_tests(): + return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm') + +@unittest.skipUnless(not is_windows() and should_run_cross_arm_tests(), "requires ability to cross compile to ARM") class LinuxCrossArmTests(BasePlatformTests): ''' Tests that cross-compilation to Linux/ARM works @@ -4979,6 +4986,10 @@ class LinuxCrossArmTests(BasePlatformTests): self.assertTrue(False, 'Option libdir not in introspect data.') +def should_run_cross_mingw_tests(): + return shutil.which('x86_64-w64-mingw32-gcc') and not (is_windows() or is_cygwin()) + +@unittest.skipUnless(not is_windows() and should_run_cross_mingw_tests(), "requires ability to cross compile with MinGW") class LinuxCrossMingwTests(BasePlatformTests): ''' Tests that cross-compilation to Windows/MinGW works @@ -5655,26 +5666,12 @@ def unset_envs(): if v in os.environ: del os.environ[v] -def should_run_cross_arm_tests(): - return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm') - -def should_run_cross_mingw_tests(): - return shutil.which('x86_64-w64-mingw32-gcc') and not (is_windows() or is_cygwin()) - def main(): unset_envs() cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests', - 'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests'] - if not is_windows(): - cases += ['LinuxlikeTests'] - if should_run_cross_arm_tests(): - cases += ['LinuxCrossArmTests'] - if should_run_cross_mingw_tests(): - cases += ['LinuxCrossMingwTests'] - if is_windows() or is_cygwin(): - cases += ['WindowsTests'] - if is_osx(): - cases += ['DarwinTests'] + 'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests', + 'LinuxlikeTests', 'LinuxCrossArmTests', 'LinuxCrossMingwTests', + 'WindowsTests', 'DarwinTests'] return unittest.main(defaultTest=cases, buffer=True) diff --git a/test cases/unit/53 introspect buildoptions/main.c b/test cases/unit/53 introspect buildoptions/main.c new file mode 100644 index 0000000..ef99ae6 --- /dev/null +++ b/test cases/unit/53 introspect buildoptions/main.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("Hello World"); + return 0; +} diff --git a/test cases/unit/53 introspect buildoptions/meson.build b/test cases/unit/53 introspect buildoptions/meson.build index e94ef61..8052b5f 100644 --- a/test cases/unit/53 introspect buildoptions/meson.build +++ b/test cases/unit/53 introspect buildoptions/meson.build @@ -2,6 +2,11 @@ project('introspect buildargs', ['c'], default_options: ['c_std=c11', 'cpp_std=c subA = subproject('projectA') +target_name = 'MAIN' +target_src = ['main.c'] + +executable(target_name, target_src) + r = run_command(find_program('c_compiler.py')) if r.returncode() != 0 error('FAILED') |