Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting F18 tests to use LLVM lit without FileCheck #1027

Merged
merged 4 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ enable_testing()
add_subdirectory(include/flang)
add_subdirectory(lib)
add_subdirectory(runtime)
add_subdirectory(test)
add_subdirectory(unittests)
add_subdirectory(tools)
add_subdirectory(test-lit)
add_subdirectory(test)

configure_file(
${FLANG_SOURCE_DIR}/include/flang/Config/config.h.cmake
Expand Down
30 changes: 0 additions & 30 deletions test-lit/CMakeLists.txt

This file was deleted.

42 changes: 30 additions & 12 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
#===-- test/CMakeLists.txt -------------------------------------------------===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#

add_subdirectory(Decimal)
add_subdirectory(Evaluate)
add_subdirectory(Runtime)
add_subdirectory(Semantics)
# Test runner infrastructure for Flang. This configures the Flang test trees
# for use by Lit, and delegates to LLVM's lit test handlers.

set(FLANG_INTRINSIC_MODULES_DIR ${FLANG_BINARY_DIR}/tools/f18/include)

configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)

set(FLANG_TEST_PARAMS
flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)

set(FLANG_TEST_DEPENDS
f18
)

if (LINK_WITH_FIR)
list(APPEND FLANG_TEST_DEPENDS tco)
endif()

add_lit_testsuite(check-all "Running the Flang regression tests"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug and only works when compiling f18 standalone. LLVM already has a cmake target of "check-all" and this will conflict with it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed this already in the cmake rework PR. Check-all will still exist as a if flang is built out of tree running only flang tests, and the check-flang target will always exist and always only run flang tests.

${CMAKE_CURRENT_BINARY_DIR}
PARAMS ${FLANG_TEST_PARAMS}
DEPENDS ${FLANG_TEST_DEPENDS}
)
set_target_properties(check-all PROPERTIES FOLDER "Tests")

File renamed without changes.
1 change: 1 addition & 0 deletions test/Evaluate/folding01.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t

! Test intrinsic operation folding

Expand Down
1 change: 1 addition & 0 deletions test/Evaluate/folding02.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Check intrinsic function folding with host runtime library

module m
Expand Down
1 change: 1 addition & 0 deletions test/Evaluate/folding03.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Test operation folding edge case (both expected value and messages)
! These tests make assumptions regarding real(4) and integer(4) extrema.

Expand Down
1 change: 1 addition & 0 deletions test/Evaluate/folding04.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Test intrinsic function folding edge case (both expected value and messages)
! These tests make assumptions regarding real(4) extrema.

Expand Down
Binary file modified test/Evaluate/folding05.f90
Binary file not shown.
1 change: 1 addition & 0 deletions test/Evaluate/folding06.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Test transformational intrinsic function folding

module m
Expand Down
1 change: 1 addition & 0 deletions test/Evaluate/folding07.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Test numeric model inquiry intrinsics

module m
Expand Down
1 change: 1 addition & 0 deletions test/Evaluate/folding08.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Test folding of LBOUND and UBOUND

module m
Expand Down
1 change: 1 addition & 0 deletions test/Evaluate/folding09.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
! RUN: %S/test_folding.sh %s %flang %t
! Test folding of IS_CONTIGUOUS on simply contiguous items (9.5.4)
! When IS_CONTIGUOUS() is constant, it's .TRUE.

Expand Down
21 changes: 9 additions & 12 deletions test/Evaluate/test_folding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,25 @@
# - test_x is not folded (it is neither .true. nor .false.). This means the
# compiler could not fold the expression.

PATH=/usr/bin:/bin
srcdir=$(dirname $0)
F18CC=${F18:-../../../tools/f18/bin/f18}
CMD="$F18CC -fdebug-dump-symbols -fparse-only"
CMD="$2 -fdebug-dump-symbols -fparse-only"

if [[ $# < 1 ]]; then
echo "Usage: $0 <fortran-source> [-pgmath=<true/false>]"
if [[ $# < 3 ]]; then
echo "Usage: $0 <fortran-source> <f18-executable> <temp test dir>"
exit 1
fi

src=$srcdir/$1
src=$1
[[ ! -f $src ]] && echo "File not found: $src" && exit 1

temp=temp-$1
rm -rf $temp
mkdir $temp
[[ $KEEP ]] || trap "rm -rf $temp" EXIT
temp=$3
mkdir -p $temp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be mkdir $3 ? You are passing in a %t on the lit RUN line but then the script goes and makes it's own tempdir and ignores the %t you passed in. The other scripts use common.sh to parse the commandline but this script does not.


# Check if tests should assume folding is using libpgmath
if [[ $# > 1 && "$2" = "-pgmath=true" ]]; then
if [[ $LIBPGMATH ]]; then
CMD="$CMD -DTEST_LIBPGMATH"
echo "Assuming libpgmath support"
else
echo "Not assuming libpgmath support"
fi

src1=$temp/symbols.log
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions test/Preprocessing/lit.local.cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- Python -*-

from lit.llvm import llvm_config

# Added this line file to prevent lit from discovering these tests
# See Issue #1052
config.suffixes = []