summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-10-04 19:48:40 +0000
committerTobias Grosser <tobias@grosser.es>2016-10-04 19:48:40 +0000
commite84ee850d1f7fc2e8dac8d90c5856e8451ca3bbe (patch)
treedf55efc5a8a31a92fc0d956b7912aa9b538e4d40
parentc43fa4f23c44cf7b5946c94fb3886722cd56627e (diff)
downloadbcm5719-llvm-e84ee850d1f7fc2e8dac8d90c5856e8451ca3bbe.tar.gz
bcm5719-llvm-e84ee850d1f7fc2e8dac8d90c5856e8451ca3bbe.zip
Build and run isl_test as part of check-polly
Running isl tests is important to gain confidence that the isl build we created works as expected. Besides the actual isl tests, there are also isl AST generation tests shipped with isl. This change only adds support for the isl unit tests. AST generation test support is left for a later commit. There is a choice to run tests directly through the build system or in the context of lit. We choose to run tests as part of lit to as this allows us to easily set environment variables, print output only on error and generally run the tests directly from the lit command. Reviewers: brad.king, Meinersbur Subscribers: modocache, brad.king, pollydev, beanz, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D25155 llvm-svn: 283245
-rw-r--r--polly/lib/External/CMakeLists.txt16
-rw-r--r--polly/test/CMakeLists.txt23
-rw-r--r--polly/test/UnitIsl/isl_test.sh1
-rw-r--r--polly/test/UnitIsl/lit.cfg46
-rw-r--r--polly/test/UnitIsl/lit.site.cfg.in9
5 files changed, 94 insertions, 1 deletions
diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt
index f8216bd45fa..2e0d89ca896 100644
--- a/polly/lib/External/CMakeLists.txt
+++ b/polly/lib/External/CMakeLists.txt
@@ -261,25 +261,39 @@ add_polly_library(PollyISL
${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")
diff --git a/polly/test/CMakeLists.txt b/polly/test/CMakeLists.txt
index 256fe0cbad6..87ba9444cc2 100644
--- a/polly/test/CMakeLists.txt
+++ b/polly/test/CMakeLists.txt
@@ -97,6 +97,18 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
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 @@ else (NOT DEFINED LLVM_MAIN_SRC_DIR)
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
diff --git a/polly/test/UnitIsl/isl_test.sh b/polly/test/UnitIsl/isl_test.sh
new file mode 100644
index 00000000000..776ede5b950
--- /dev/null
+++ b/polly/test/UnitIsl/isl_test.sh
@@ -0,0 +1 @@
+; RUN: polly-isl-test
diff --git a/polly/test/UnitIsl/lit.cfg b/polly/test/UnitIsl/lit.cfg
new file mode 100644
index 00000000000..874875a1d05
--- /dev/null
+++ b/polly/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')
diff --git a/polly/test/UnitIsl/lit.site.cfg.in b/polly/test/UnitIsl/lit.site.cfg.in
new file mode 100644
index 00000000000..b0ad505f3b2
--- /dev/null
+++ b/polly/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")
OpenPOWER on IntegriCloud