From 3500ddb8bb311bd99d2a76c6cd7bfe0788d5ad23 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 27 Dec 2013 00:25:45 +0200 Subject: [PATCH] Skip extraction test during Unity build because the object file is not generated. --- interpreter.py | 8 +++++++- test cases/common/25 object extraction/meson.build | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/interpreter.py b/interpreter.py index e655697e3..402a18548 100644 --- a/interpreter.py +++ b/interpreter.py @@ -522,13 +522,14 @@ class MesonMain(InterpreterObject): self.methods.update({'get_compiler': self.get_compiler_method, 'is_cross_build' : self.is_cross_build_method, 'has_exe_wrapper' : self.has_exe_wrapper_method, + 'is_unity' : self.is_unity_method, }) def has_exe_wrapper_method(self, args, kwargs): if self.is_cross_build_method(None, None): return 'exe_wrap' in self.build.environment.cross_info return True # This is semantically confusing. - + def is_cross_build_method(self, args, kwargs): return self.build.environment.is_cross_build() @@ -553,6 +554,9 @@ class MesonMain(InterpreterObject): return CompilerHolder(c, self.build.environment) raise InterpreterException('Tried to access compiler for unspecified language "%s".' % cname) + def is_unity_method(self, args, kwargs): + return self.build.environment.coredata.unity + class Interpreter(): def __init__(self, build, subproject=''): @@ -1181,6 +1185,8 @@ class Interpreter(): else: obj = self.evaluate_statement(invokable) method_name = node.method_name.get_value() + if method_name == 'extract_objects' and self.environment.coredata.unity: + raise InterpreterException('Single object files can not be extracted in Unity builds.') args = node.arguments if isinstance(obj, nodes.StringStatement): obj = obj.get_value() diff --git a/test cases/common/25 object extraction/meson.build b/test cases/common/25 object extraction/meson.build index a039a8c35..f93660995 100644 --- a/test cases/common/25 object extraction/meson.build +++ b/test cases/common/25 object extraction/meson.build @@ -1,7 +1,11 @@ project('object extraction', 'c') -lib = shared_library('somelib', 'lib.c') -obj = lib.extract_objects('lib.c') +if meson.is_unity() + message('Skipping extraction test because this is a Unity build.') +else + lib = shared_library('somelib', 'lib.c') + obj = lib.extract_objects('lib.c') -e = executable('main', 'main.c', objects : obj) -test('extraction test', e) + e = executable('main', 'main.c', objects : obj) + test('extraction test', e) +endif