From e3265d1d8c8c77ba18f01457cdaa4cb67ac80be5 Mon Sep 17 00:00:00 2001 From: Frederich Munch Date: Fri, 8 Jul 2016 22:28:17 -0400 Subject: [PATCH] Add %built_cling substitution for lit so tests can be run from either the build or installations directories. --- test/Extensions/Lookup/Arrays.C | 2 +- test/Extensions/Lookup/ControlFlow.C | 2 +- test/Extensions/Lookup/LifetimeHandler.C | 2 +- test/Extensions/Lookup/Simple.C | 2 +- test/Extensions/Lookup/SimpleDynamicExprs.C | 2 +- test/Extensions/Lookup/StillError.C | 2 +- test/Interfaces/address.C | 2 +- test/Interfaces/transactionReuse.C | 2 +- test/Lookup/args.C | 2 +- test/Lookup/data.C | 2 +- test/Lookup/func.C | 2 +- test/Lookup/scope.C | 2 +- test/Lookup/template.C | 2 +- test/Lookup/type.C | 2 +- test/Utils/Transform.C | 2 +- test/lit.cfg | 11 +++++++++++ 16 files changed, 26 insertions(+), 15 deletions(-) diff --git a/test/Extensions/Lookup/Arrays.C b/test/Extensions/Lookup/Arrays.C index 096b515b..4325e333 100644 --- a/test/Extensions/Lookup/Arrays.C +++ b/test/Extensions/Lookup/Arrays.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %built_cling -I%p | FileCheck %s #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/InterpreterCallbacks.h" diff --git a/test/Extensions/Lookup/ControlFlow.C b/test/Extensions/Lookup/ControlFlow.C index a2ba0899..f8105927 100644 --- a/test/Extensions/Lookup/ControlFlow.C +++ b/test/Extensions/Lookup/ControlFlow.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %built_cling -I%p | FileCheck %s // The tests shows the basic control flow structures that contain dynamic // expressions. There are several cases that could be distinguished. diff --git a/test/Extensions/Lookup/LifetimeHandler.C b/test/Extensions/Lookup/LifetimeHandler.C index e7f47f7f..602909a6 100644 --- a/test/Extensions/Lookup/LifetimeHandler.C +++ b/test/Extensions/Lookup/LifetimeHandler.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %built_cling -I%p | FileCheck %s // We should revise the destruction of the LifetimeHandlers, because // its destructor uses gCling and the CompilerInstance, which are // already gone diff --git a/test/Extensions/Lookup/Simple.C b/test/Extensions/Lookup/Simple.C index d0aba5e5..8d48a31b 100644 --- a/test/Extensions/Lookup/Simple.C +++ b/test/Extensions/Lookup/Simple.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %built_cling -I%p | FileCheck %s // This test tests the hook that cling expects in clang and enables it // at compile time. However that is not actual dynamic lookup because diff --git a/test/Extensions/Lookup/SimpleDynamicExprs.C b/test/Extensions/Lookup/SimpleDynamicExprs.C index bd249d9a..7627f97a 100644 --- a/test/Extensions/Lookup/SimpleDynamicExprs.C +++ b/test/Extensions/Lookup/SimpleDynamicExprs.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %built_cling -I%p | FileCheck %s #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/InterpreterCallbacks.h" diff --git a/test/Extensions/Lookup/StillError.C b/test/Extensions/Lookup/StillError.C index b541a458..04b62f08 100644 --- a/test/Extensions/Lookup/StillError.C +++ b/test/Extensions/Lookup/StillError.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -I%p 2>&1 | FileCheck %s // Test failures of dynamic lookups. diff --git a/test/Interfaces/address.C b/test/Interfaces/address.C index a23a90c7..ddb8f4bc 100644 --- a/test/Interfaces/address.C +++ b/test/Interfaces/address.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: clang -shared %S/address_lib.c -olibaddress_lib%shlibext -// RUN: cat %s | %cling -L. -fno-rtti | FileCheck %s +// RUN: cat %s | %built_cling -L. -fno-rtti | FileCheck %s extern "C" int printf(const char*,...); #include "cling/Interpreter/Interpreter.h" diff --git a/test/Interfaces/transactionReuse.C b/test/Interfaces/transactionReuse.C index 6ead0a3b..f5d18f92 100644 --- a/test/Interfaces/transactionReuse.C +++ b/test/Interfaces/transactionReuse.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti | FileCheck %s // This test makes sure the interpreter doesn't create many useless empty // transactions. diff --git a/test/Lookup/args.C b/test/Lookup/args.C index d0dc3830..629138ff 100644 --- a/test/Lookup/args.C +++ b/test/Lookup/args.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti 2>&1 | FileCheck %s // Test findArgList #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/data.C b/test/Lookup/data.C index 7dc94ddd..15a188e3 100644 --- a/test/Lookup/data.C +++ b/test/Lookup/data.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti 2>&1 | FileCheck %s // Test lookupData .rawInput 1 diff --git a/test/Lookup/func.C b/test/Lookup/func.C index 8017fef8..841a5b5a 100644 --- a/test/Lookup/func.C +++ b/test/Lookup/func.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti 2>&1 | FileCheck %s // Test lookupFunctionArgs() .rawInput #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/scope.C b/test/Lookup/scope.C index f90b898d..3eb6032e 100644 --- a/test/Lookup/scope.C +++ b/test/Lookup/scope.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti 2>&1 | FileCheck %s // Test findScope, which is esentially is a DeclContext. #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/LookupHelper.h" diff --git a/test/Lookup/template.C b/test/Lookup/template.C index a72fcca8..c3d30d04 100644 --- a/test/Lookup/template.C +++ b/test/Lookup/template.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti 2>&1 | FileCheck %s // Test findClassTemplate, which is esentially is a DeclContext. #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/LookupHelper.h" diff --git a/test/Lookup/type.C b/test/Lookup/type.C index 9173df54..c59d75b4 100644 --- a/test/Lookup/type.C +++ b/test/Lookup/type.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti 2>&1 | FileCheck %s // Test Interpreter::lookupType() // #include "cling/Interpreter/Interpreter.h" diff --git a/test/Utils/Transform.C b/test/Utils/Transform.C index c80b23de..00b0522d 100644 --- a/test/Utils/Transform.C +++ b/test/Utils/Transform.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti | FileCheck %s +// RUN: cat %s | %built_cling -fno-rtti | FileCheck %s // The test verifies the expected behavior in cling::utils::Transform class, // which is supposed to provide different transformation of AST nodes and types. diff --git a/test/lit.cfg b/test/lit.cfg index 5e3d8e4b..56e324f8 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -240,6 +240,17 @@ if not lit_config.quiet: #Start cling with nologo config.substitutions.append( ('%cling', config.cling + ' --nologo') ) +if not os.getenv('CLING'): + # Add a substitution for the builds generated include dir before install + incDir = os.path.join(config.llvm_obj_root, 'tools', 'clang', 'include') + config.substitutions.append( ('%built_cling', config.cling + ' --nologo -I%s' + % os.path.normpath(incDir)) ) + if not lit_config.quiet: + lit_config.note('Running tests from build tree') +else: + config.substitutions.append( ('%built_cling', config.cling + ' --nologo') ) + if not lit_config.quiet: + lit_config.note('Running tests from installation') # FIXME: Find nicer way to prohibit this. config.substitutions.append(