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

Enable testing Flang by 'make check-clang' #20

Open
wants to merge 2 commits into
base: flang_release_40
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions test/Driver/fortran.f95
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@

// RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-OBJECT %s
// CHECK-OBJECT: gcc
// CHECK-OBJECT: "-c"
// CHECK-OBJECT: "-x" "f95"
// CHECK-OBJECT-NOT: cc1as

// RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-ASM %s
// CHECK-ASM: gcc
// CHECK-ASM: "-S"
// CHECK-ASM: "-x" "f95"
// CHECK-ASM-NOT: cc1

// RUN: %clang -Wall -target x86_64-unknown-linux-gnu -integrated-as %s -o %t -### 2>&1 | FileCheck --check-prefix=CHECK-WARN %s
// CHECK-WARN: gcc
// CHECK-WARN-NOT: "-Wall"
// CHECK-WARN: ld
// CHECK-WARN-NOT: "-Wall"
260 changes: 0 additions & 260 deletions test/Driver/gfortran.f90

This file was deleted.

3 changes: 3 additions & 0 deletions test/Parser/empty.f95
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
! RUN: %flang -O0 -fsyntax-only %s
PROGRAM test
END PROGRAM test
30 changes: 28 additions & 2 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ else:
config.test_format = lit.formats.ShTest(execute_external)

# suffixes: A list of file extensions to treat as test files.
config.suffixes = ['.c', '.cpp', '.cppm', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']
config.suffixes = ['.c', '.cpp', '.cppm', '.m', '.mm', '.cu', '.f', '.f95', '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']

# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
# subdirectories contain auxiliary inputs for various tests in their parent
Expand Down Expand Up @@ -173,7 +173,7 @@ if config.test_exec_root is None:

###

# Discover the 'clang' and 'clangcc' to use.
# Discover the 'clang', 'clangcc' and 'flang' to use.

import os

Expand All @@ -195,10 +195,33 @@ def inferClang(PATH):

return clang


config.clang = inferClang(config.environment['PATH']).replace('\\', '/')
if not lit_config.quiet:
lit_config.note('using clang: %r' % config.clang)

def inferFlang(PATH):
# Determine which flang to use.
flang = os.getenv('FLANG')

# If the user set flang in the environment, definitely use that and don't
# try to validate.
if flang:
return flang

# Otherwise look in the path.
flang = lit.util.which('flang', PATH)

if not flang:
lit_config.fatal("couldn't find 'flang' program, try setting "
"FLANG in your environment")

return flang

config.flang = inferFlang(config.environment['PATH']).replace('\\', '/')
if not lit_config.quiet:
lit_config.note('using flang: %r' % config.flang)

# Plugins (loadable modules)
# TODO: This should be supplied by Makefile or autoconf.
if sys.platform in ['win32', 'cygwin']:
Expand Down Expand Up @@ -270,6 +293,7 @@ config.substitutions.append( ('%clang_cl', ' ' + config.clang +
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' --driver-mode=g++ '))
config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )
config.substitutions.append( ('%flang', ' ' + config.flang + ' ') )
config.substitutions.append( ('%test_debuginfo', ' ' + config.llvm_src_root + '/utils/test_debuginfo.pl ') )
config.substitutions.append( ('%itanium_abi_triple', makeItaniumABITriple(config.target_triple)) )
config.substitutions.append( ('%ms_abi_triple', makeMSABITriple(config.target_triple)) )
Expand Down Expand Up @@ -302,6 +326,8 @@ config.substitutions.append(
config.substitutions.append(
(' %clang-cl ',
"""*** invalid substitution, use '%clang_cl'. ***""") )
config.substitutions.append(
(' flang ', """*** Do not use 'flang' in tests, use '%flang'. ***""") )

# For each occurrence of a clang tool name as its own word, replace it
# with the full path to the build directory holding that tool. This
Expand Down