InstrProf: lit.cfg magic for running tests from source
Implement magic in compiler-rt to enable llvm-lit to be invoked on the source tree in lib/profile. This relies on a paired commit in the llvm tree that exposes a new built-in parameter. <rdar://problem/16458307> llvm-svn: 205263
This commit is contained in:
		
							parent
							
								
									acb367bd62
								
							
						
					
					
						commit
						da91cbdfa8
					
				| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
set(PROFILE_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 | 
					set(PROFILE_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 | 
				
			||||||
 | 
					set(PROFILE_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(PROFILE_TEST_DEPS)
 | 
					set(PROFILE_TEST_DEPS)
 | 
				
			||||||
if(NOT COMPILER_RT_STANDALONE_BUILD)
 | 
					if(NOT COMPILER_RT_STANDALONE_BUILD)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,22 @@ config.name = 'Profile'
 | 
				
			||||||
# Setup source root.
 | 
					# Setup source root.
 | 
				
			||||||
config.test_source_root = os.path.dirname(__file__)
 | 
					config.test_source_root = os.path.dirname(__file__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Setup executable root.
 | 
				
			||||||
 | 
					if hasattr(config, 'profile_lit_binary_dir') and \
 | 
				
			||||||
 | 
					        config.profile_lit_binary_dir is not None:
 | 
				
			||||||
 | 
					    config.test_exec_root = config.profile_lit_binary_dir
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# If the above check didn't work, we're probably in the source tree.  Use some
 | 
				
			||||||
 | 
					# magic to re-execute from the build tree.
 | 
				
			||||||
 | 
					if config.test_exec_root is None:
 | 
				
			||||||
 | 
					    # The magic relies on knowing compilerrt_site_basedir.
 | 
				
			||||||
 | 
					    compilerrt_basedir = lit_config.params.get('compilerrt_site_basedir', None)
 | 
				
			||||||
 | 
					    if compilerrt_basedir:
 | 
				
			||||||
 | 
					        site_cfg = os.path.join(compilerrt_basedir, 'profile', 'lit.site.cfg')
 | 
				
			||||||
 | 
					        if os.path.exists(site_cfg):
 | 
				
			||||||
 | 
					            lit_config.load_config(config, site_cfg)
 | 
				
			||||||
 | 
					            raise SystemExit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Test suffixes.
 | 
					# Test suffixes.
 | 
				
			||||||
config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
 | 
					config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,9 @@
 | 
				
			||||||
## Autogenerated by LLVM/Clang configuration.
 | 
					## Autogenerated by LLVM/Clang configuration.
 | 
				
			||||||
# Do not edit!
 | 
					# Do not edit!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Tool-specific config options.
 | 
				
			||||||
 | 
					config.profile_lit_binary_dir = "@PROFILE_LIT_BINARY_DIR@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Load common config for all compiler-rt lit tests.
 | 
					# Load common config for all compiler-rt lit tests.
 | 
				
			||||||
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
 | 
					lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue