[PATCH] D103354: [test-suite] Decouple Fortran tests from C/C++ tests.

Nichols A. Romero via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 12:13:22 PDT 2021


naromero77 updated this revision to Diff 349050.
naromero77 added a comment.

- Move hello test to its own subdirectory on UnitTests
- include Fortran helper moduler in top-level CMakeLists.txt to permit selection of individual UnitTests.
- Additional CMakeLists.txt needed at this intermediate level.
- Update comment in Fortran subdirectory CMakeLists.


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103354/new/

https://reviews.llvm.org/D103354

Files:
  CMakeLists.txt
  Fortran/CMakeLists.txt
  Fortran/UnitTests/CMakeLists.txt
  Fortran/UnitTests/hello/CMakeLists.txt
  Fortran/UnitTests/hello/hello.f90
  Fortran/UnitTests/hello/hello.reference_output
  Fortran/UnitTests/hello/lit.local.cfg
  SingleSource/UnitTests/CMakeLists.txt
  SingleSource/UnitTests/Fortran/CMakeLists.txt
  SingleSource/UnitTests/Fortran/hello.f90
  SingleSource/UnitTests/Fortran/hello.reference_output


Index: SingleSource/UnitTests/Fortran/CMakeLists.txt
===================================================================
--- SingleSource/UnitTests/Fortran/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-llvm_singlesource()
Index: SingleSource/UnitTests/CMakeLists.txt
===================================================================
--- SingleSource/UnitTests/CMakeLists.txt
+++ SingleSource/UnitTests/CMakeLists.txt
@@ -12,11 +12,6 @@
   add_subdirectory(ObjC++)
 endif()
 
-# Fortran
-if(TEST_SUITE_FORTRAN)
-  add_subdirectory(Fortran)
-endif()
-
 file(GLOB Source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cpp)
 if(TARGET_OS STREQUAL "AIX" AND ARCH STREQUAL "PowerPC" AND NOT PPC_IS_PPC64_ENABLED) 
   list(REMOVE_ITEM Source AtomicOps.c)
Index: Fortran/UnitTests/hello/lit.local.cfg
===================================================================
--- /dev/null
+++ Fortran/UnitTests/hello/lit.local.cfg
@@ -0,0 +1,2 @@
+config.traditional_output = True
+config.single_source = True
Index: SingleSource/UnitTests/Fortran/hello.reference_output
===================================================================
--- /dev/null
+++ SingleSource/UnitTests/Fortran/hello.reference_output
@@ -1,2 +0,0 @@
- Hello world
-exit 0
Index: SingleSource/UnitTests/Fortran/hello.f90
===================================================================
--- /dev/null
+++ SingleSource/UnitTests/Fortran/hello.f90
@@ -1,3 +0,0 @@
-program hello
-  print *, 'Hello world'
-end program hello
Index: Fortran/UnitTests/hello/CMakeLists.txt
===================================================================
--- /dev/null
+++ Fortran/UnitTests/hello/CMakeLists.txt
@@ -0,0 +1,3 @@
+llvm_singlesource()
+
+file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
Index: Fortran/UnitTests/CMakeLists.txt
===================================================================
--- /dev/null
+++ Fortran/UnitTests/CMakeLists.txt
@@ -0,0 +1,2 @@
+# This file should only contain add_subdirectory(...) one for each test
+add_subdirectory(hello)
Index: Fortran/CMakeLists.txt
===================================================================
--- /dev/null
+++ Fortran/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Fortran TestSuite Directory Structure (TENTATIVE):
+#
+# UnitTests    - Single source tests for language features
+# Benchmarks   - Single source tests for benchmarking
+# Applications - Multi-source tests for proxy apps, small apps, etc.
+#
+# This file should only contain add_subdirectory(...) one for each test
+# directory
+add_subdirectory(UnitTests)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -243,6 +243,10 @@
 include(SingleMultiSource)
 # Needs by External/sollve_vv.
 find_package(OpenMP)
+# Fortran Helper Modules
+if(TEST_SUITE_FORTRAN)
+  include(Fortran)
+endif()
 
 if(NOT DEFINED TARGET_OS)
   message(STATUS "Check target operating system - ${CMAKE_SYSTEM_NAME}")
@@ -339,6 +343,10 @@
     if(NOT ${subdir} STREQUAL tools AND NOT ${subdir} STREQUAL CTMark)
       list(APPEND TEST_SUITE_SUBDIRS ${subdir})
     endif()
+    # Exclude Fortran tests unless explicitly activated
+    if(NOT TEST_SUITE_FORTRAN)
+      list(REMOVE_ITEM TEST_SUITE_SUBDIRS Fortran)
+    endif()
   endforeach()
   set(TEST_SUITE_SUBDIRS "${TEST_SUITE_SUBDIRS}")
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103354.349050.patch
Type: text/x-patch
Size: 3346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210601/65702d36/attachment.bin>


More information about the llvm-commits mailing list