[PATCH] D25155: [Polly] Build and run isl_test as part of check-polly

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 1 01:09:26 PDT 2016


grosser created this revision.
grosser added a reviewer: Meinersbur.
grosser added subscribers: llvm-commits, pollydev.
Herald added subscribers: mgorny, beanz.

Running isl tests is imporant to gain confidence that the isl build we created
works as expected. Besides isl_test, there is also isl_codegen to test the
code generation part of isl. This change only adds isl_test support. isl_codegen
support is left for a later commit.

This patch is still hacky at the following places:

- As setting the srcdir environment variable is hard to do in a platform dependent way, I changed isl to assume srcdir='.' if srcdir is not set.

  -> I will upstream this change.
- Currently I pipe stdout to /dev/null. I am still looking for a way to disable the output.


https://reviews.llvm.org/D25155

Files:
  lib/External/CMakeLists.txt
  lib/External/isl/isl_test.c
  test/CMakeLists.txt


Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -162,6 +162,8 @@
   FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
   GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 
+add_dependencies(check-polly check-polly-isl)
+
 # Add a legacy target spelling: polly-test
 add_custom_target(polly-test)
 set_target_properties(polly-test PROPERTIES FOLDER "Polly")
Index: lib/External/isl/isl_test.c
===================================================================
--- lib/External/isl/isl_test.c
+++ lib/External/isl/isl_test.c
@@ -6695,7 +6695,11 @@
 	struct isl_options *options;
 
 	srcdir = getenv("srcdir");
-	assert(srcdir);
+
+        if (!srcdir) {
+          printf("No isl source directory specified, assuming 'srcdir=.'.");
+          srcdir = ".";
+        }
 
 	options = isl_options_new_with_defaults();
 	assert(options);
@@ -6708,6 +6712,8 @@
 			goto error;
 	}
 	isl_ctx_free(ctx);
+
+        printf("isl_test: All tests passed.");
 	return 0;
 error:
 	isl_ctx_free(ctx);
Index: lib/External/CMakeLists.txt
===================================================================
--- lib/External/CMakeLists.txt
+++ lib/External/CMakeLists.txt
@@ -260,27 +260,50 @@
   ${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 ()
 
+add_custom_command(OUTPUT polly-run-isl-test
+  COMMAND polly-isl-test > /dev/null
+  WORKING_DIRECTORY ${ISL_SOURCE_DIR}
+  VERBATIM
+  DEPENDS polly-isl-test
+  COMMENT "Testing isl with isl_test"
+)
+add_custom_target(check-polly-isl DEPENDS polly-run-isl-test)
+
 set(PET_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/pet")
 set(PPCG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ppcg")
 set(PPCG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/ppcg")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25155.73189.patch
Type: text/x-patch
Size: 2928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161001/6be4c4c6/attachment.bin>


More information about the llvm-commits mailing list