Skip to content

Commit 518d9c3

Browse files
committed
[test-suite] Disable Fortran FM509 test when -std=legacy is not supported
This test requires -std=legacy which is not supported by flang. Currently we check if the flag is supported and add if so, but run the test anyway if not supported. This has been failing on our bots for a long time but was not noticed due to some issues reporting NOEXE failures. https://lab.llvm.org/buildbot/#/builders/179/builds/3132 Executable Missing Tests (1): test-suite :: Fortran/UnitTests/fcvs21_f95/FM509.test This fixes llvm_singlesource to allow you to pass a list of source files (which used to work when it was a macro). (this was done for multisource in cecca64) If the flag is not supported we remove the test from the list of source files. This means it's disabled for flang and enabled for gfortran. Reviewed By: awarzynski Differential Revision: https://reviews.llvm.org/D121287
1 parent 04a01ad commit 518d9c3

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

Fortran/UnitTests/fcvs21_f95/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@
3333
# clean-up fort.* files otherwise one of the tests will fail
3434
llvm_test_prepare(rm -f %S/fort.*)
3535

36-
# Test 509 requires this flag in more recent versions of GCC
36+
file(GLOB Source CONFIGURE_DEPENDS *.f)
37+
38+
# Test 509 requires this flag in more recent versions of GCC.
39+
# If this flag is not supported, the test should be excluded.
3740
check_fortran_compiler_flag("-std=legacy" SUPPORTS_LEGACY)
3841
if (SUPPORTS_LEGACY)
3942
add_compile_options(-std=legacy)
40-
endif ()
43+
else()
44+
# Regex because the GLOB returns the full path to each file
45+
list(FILTER Source EXCLUDE REGEX "FM509\.f$")
46+
endif()
4147

4248
set(FP_TOLERANCE 1.0e-11) # set by the most sensitive numerical test
43-
llvm_singlesource()
49+
llvm_singlesource(${Source})
4450

4551
file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

cmake/modules/SingleMultiSource.cmake

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
#
88
# Defines helpers to add executables and tests. The entry points to this
99
# file are:
10-
# `llvm_singlesource([PREFIX p])`, and
10+
# `llvm_singlesource([PREFIX p] [sources...])`, and
1111
# `llvm_multisource()`
1212
#
1313
# Following convenience functions provide shortcuts for common test cases:
1414
#
15-
# llvm_singlesource([PREFIX p])
15+
# llvm_singlesource([PREFIX p] [sources...])
1616
#
17-
# Invokes llvm_test_executable() for each c/c++ source file. If
18-
# 'sources is emptyno sources are specified, creates test executables
19-
# for all C/C++ files in current directory.
17+
# Invokes llvm_test_executable() for each C/C++/Fortran source file.
18+
# If sources is empty, creates test executables for all C/C++/Fortran
19+
# files in current directory.
2020
# Passes optional PREFIX parameter to llvm_test_executable().
2121
#
2222
# llvm_multisource(target)
@@ -27,14 +27,22 @@
2727
include(TestSuite)
2828

2929
# Configure the current directory as a SingleSource subdirectory - i.e. every
30-
# file in *.{c,cpp,cc} is treated as its own test.
30+
# C/C++/Fortran file is treated as its own test.
3131
function(llvm_singlesource)
32+
# PREFIX is optional so it cannot be a named argument.
3233
cmake_parse_arguments(_LSARG "" "PREFIX" "" ${ARGN})
33-
if(DEFINED Source)
34-
set(sources ${Source})
35-
else()
34+
if(DEFINED _LSARG_PREFIX)
35+
# Remove "PREFIX" and the associated value from ARGN so that it only
36+
# contains sources.
37+
list(REMOVE_AT ARGN 0)
38+
list(REMOVE_AT ARGN 0)
39+
endif()
40+
41+
set(sources ${ARGN})
42+
if(NOT sources)
3643
file(GLOB sources *.c *.cpp *.cc *.f *.F *.f90 *.F90)
3744
endif()
45+
3846
foreach(source ${sources})
3947
basename(name ${source})
4048
set(_target ${_LSARG_PREFIX}${name})

0 commit comments

Comments
 (0)