llvm-project/polly/test/UnitIsl/lit.cfg
Michael Kruse abf05b18db [CMake] Fix polly-isl-test execution in out-of-LLVM-tree builds.
The isl unittest modified its PATH variable to point to the LLVM bin dir.
When building out-of-LLVM-tree, it does not contain the
polly-isl-test executable, hence the test fails.

Ensure that the polly-isl-test is written to a bin directory in the
build root, just like it would happen in an inside-LLVM build.
Then, change PATH to include that dir such that the executable in it
is prioritized before any other location.

llvm-svn: 301096
2017-04-22 23:02:53 +00:00

46 lines
1.5 KiB
INI

# -*clang- Python -*-
import os
import platform
import re
import lit.formats
import lit.util
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
config.name = 'Polly - isl unit tests'
# 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'
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
config.suffixes = ['.sh']
# 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.
polly_obj_root = getattr(config, 'polly_obj_root', None)
if polly_obj_root is not None:
config.test_exec_root = os.path.join(polly_obj_root, 'test')
# Set llvm_{src,obj}_root for use by others.
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
# Tweak the PATH to ensure that built files are the ones executed.
bin_dir = getattr(config, 'bin_dir', None)
if bin_dir is None:
lit_config.fatal('No executable dir set!')
path = os.path.pathsep.join((bin_dir, config.environment['PATH']))
config.environment['PATH'] = path
config.environment['srcdir'] = os.path.join(config.test_source_root,
'../../lib/External/isl')