blob: af79d70cd42c1fef92ce392bb2b1f93281f8a2a5 [file] [log] [blame]
# -*- Python -*-
import os
import platform
import re
import subprocess
import lit.formats
# Allow import of our local utilities.
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
import DEUtils
# It will validate you. That's what it does. That's all it does.
config.name = 'The Validator'
# Load common definitions.
lit_config.load_config(config, lit_config.params['site'])
# Tweak PATH for Win32
if platform.system() == 'Windows':
# Seek sane tools in directories and set to $PATH.
path = getattr(config, 'lit_tools_dir', None)
path = lit_config.getToolsPath(path,
config.environment['PATH'],
['cmp.exe', 'grep.exe', 'sed.exe'])
if path is not None:
path = os.path.pathsep.join((path,
config.environment['PATH']))
config.environment['PATH'] = path
# Tweak the PATH to include the tools dir.
path = os.path.pathsep.join((config.llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
# testFormat: The test format to use to interpret tests.
#
# For now we require '&&' between commands, until they get globally killed and
# the test runner updated.
execute_external = (platform.system() != 'Windows'
or lit_config.getBashPath() not in [None, ""])
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
config.suffixes = []
for language in DEUtils.getSupportedLanguages(config.gcc_executable):
config.suffixes = config.suffixes + DEUtils.getSuffixesForLanguage(language)
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
config.test_exec_root = config.test_output_dir + '/validator/'
# When running under valgrind, we mangle '-vg' onto the end of the triple so we
# can check it with XFAIL and XTARGET.
if lit_config.useValgrind:
config.target_triple += '-vg'
# %dragonegg means: run dragonegg and output LLVM IR.
config.substitutions.append( ('%dragonegg', '%s -fplugin=%s '
'-fplugin-arg-dragonegg-emit-ir' %
(config.gcc_executable, config.dragonegg_plugin)))
# %eggdragon means: run dragonegg and output target assembler.
config.substitutions.append( ('%eggdragon', '%s -fplugin=%s ' %
(config.gcc_executable, config.dragonegg_plugin)))