Index: polly/trunk/lib/External/CMakeLists.txt =================================================================== --- polly/trunk/lib/External/CMakeLists.txt +++ polly/trunk/lib/External/CMakeLists.txt @@ -261,25 +261,39 @@ ${ISL_FILES} ) +add_executable(polly-isl-test + isl/isl_test.c +) + +target_link_libraries(polly-isl-test + PollyISL +) + if (MSVC) # Disable common warnings; ideally, they should be fixed upstream - target_compile_options(PollyISL PRIVATE + set(DISABLE_WARNING_FLAGS -wd4018 # 'expression' : signed/unsigned mismatch -wd4090 # 'operation' : different 'modifier' qualifiers -wd4200 # nonstandard extension used: zero-sized array in struct/union -wd4201 # nonstandard extension used: nameless struct/union -wd4334 # 'operator': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) ) + target_compile_options(PollyISL PRIVATE ${DISABLE_WARNING_FLAGS}) + target_compile_options(polly-isl-test PRIVATE ${DISABLE_WARNING_FLAGS}) endif () # ISL requires at least C99 to compile. gcc < 5.0 use -std=gnu89 as default. target_enable_c99(PollyISL) +target_enable_c99(polly-isl-test) # Disable warnings which should be coped with upstream for isl and imath. if (NOT MSVC) set_target_properties(PollyISL PROPERTIES COMPILE_FLAGS "-w" ) + set_target_properties(polly-isl-test PROPERTIES + COMPILE_FLAGS "-w" + ) endif () set(PET_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/pet") Index: polly/trunk/test/CMakeLists.txt =================================================================== --- polly/trunk/test/CMakeLists.txt +++ polly/trunk/test/CMakeLists.txt @@ -97,6 +97,18 @@ COMMENT "Running Polly unit tests") set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly") endif () + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg) + + add_custom_target(check-polly-isl + command ${LLVM_LIT} + --param polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg + --param build_config=${CMAKE_CFG_INTDIR} + -sv ${POLLY_TEST_EXTRA_ARGS} + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS polly-isl-test + COMMENT "Running isl unit tests") endif() else (NOT DEFINED LLVM_MAIN_SRC_DIR) @@ -141,6 +153,17 @@ set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly") endif () + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg) + + add_lit_testsuite(check-polly-isl "Running isl unit tests only" + ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl + PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg + DEPENDS polly-isl-test + ) + set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly") + # Run polly-check-format as part of polly-check only if we are compiling with # clang, so clang-format is available. # if (TARGET clang-format) would be preferable, but this target is only added Index: polly/trunk/test/UnitIsl/isl_test.sh =================================================================== --- polly/trunk/test/UnitIsl/isl_test.sh +++ polly/trunk/test/UnitIsl/isl_test.sh @@ -0,0 +1 @@ +; RUN: polly-isl-test Index: polly/trunk/test/UnitIsl/lit.cfg =================================================================== --- polly/trunk/test/UnitIsl/lit.cfg +++ polly/trunk/test/UnitIsl/lit.cfg @@ -0,0 +1,46 @@ +# -*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 include the tools dir and the scripts dir. +if polly_obj_root is not None: + llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) + if not llvm_tools_dir: + lit_config.fatal('No LLVM tools dir set!') + path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) + config.environment['PATH'] = path + +config.environment['srcdir'] = os.path.join(config.test_source_root, + '../../lib/External/isl') Index: polly/trunk/test/UnitIsl/lit.site.cfg.in =================================================================== --- polly/trunk/test/UnitIsl/lit.site.cfg.in +++ polly/trunk/test/UnitIsl/lit.site.cfg.in @@ -0,0 +1,9 @@ +@LIT_SITE_CFG_IN_HEADER@ + +import sys + +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.polly_obj_root = "@POLLY_BINARY_DIR@" + +# Let the main config do the real work. +lit_config.load_config(config, "@POLLY_SOURCE_DIR@/test/UnitIsl/lit.cfg")