[polly] r283245 - Build and run isl_test as part of check-polly

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 12:48:41 PDT 2016


Author: grosser
Date: Tue Oct  4 14:48:40 2016
New Revision: 283245

URL: http://llvm.org/viewvc/llvm-project?rev=283245&view=rev
Log:
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

Added:
    polly/trunk/test/UnitIsl/
    polly/trunk/test/UnitIsl/isl_test.sh
    polly/trunk/test/UnitIsl/lit.cfg
    polly/trunk/test/UnitIsl/lit.site.cfg.in
Modified:
    polly/trunk/lib/External/CMakeLists.txt
    polly/trunk/test/CMakeLists.txt

Modified: polly/trunk/lib/External/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/CMakeLists.txt?rev=283245&r1=283244&r2=283245&view=diff
==============================================================================
--- polly/trunk/lib/External/CMakeLists.txt (original)
+++ polly/trunk/lib/External/CMakeLists.txt Tue Oct  4 14:48:40 2016
@@ -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")

Modified: polly/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CMakeLists.txt?rev=283245&r1=283244&r2=283245&view=diff
==============================================================================
--- polly/trunk/test/CMakeLists.txt (original)
+++ polly/trunk/test/CMakeLists.txt Tue Oct  4 14:48:40 2016
@@ -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

Added: polly/trunk/test/UnitIsl/isl_test.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/UnitIsl/isl_test.sh?rev=283245&view=auto
==============================================================================
--- polly/trunk/test/UnitIsl/isl_test.sh (added)
+++ polly/trunk/test/UnitIsl/isl_test.sh Tue Oct  4 14:48:40 2016
@@ -0,0 +1 @@
+; RUN: polly-isl-test

Added: polly/trunk/test/UnitIsl/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/UnitIsl/lit.cfg?rev=283245&view=auto
==============================================================================
--- polly/trunk/test/UnitIsl/lit.cfg (added)
+++ polly/trunk/test/UnitIsl/lit.cfg Tue Oct  4 14:48:40 2016
@@ -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')

Added: polly/trunk/test/UnitIsl/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/UnitIsl/lit.site.cfg.in?rev=283245&view=auto
==============================================================================
--- polly/trunk/test/UnitIsl/lit.site.cfg.in (added)
+++ polly/trunk/test/UnitIsl/lit.site.cfg.in Tue Oct  4 14:48:40 2016
@@ -0,0 +1,9 @@
+ at 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")




More information about the llvm-commits mailing list