2020-01-15 00:20:49 +08:00
|
|
|
# -*- Python -*-
|
|
|
|
|
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import lit.formats
|
|
|
|
import lit.util
|
|
|
|
|
|
|
|
from lit.llvm import llvm_config
|
|
|
|
from lit.llvm.subst import ToolSubst
|
|
|
|
from lit.llvm.subst import FindTool
|
|
|
|
|
|
|
|
# Configuration file for the 'lit' test runner.
|
|
|
|
|
|
|
|
# name: The name of this test suite.
|
|
|
|
config.name = 'Flang'
|
|
|
|
|
|
|
|
# testFormat: The test format to use to interpret tests.
|
|
|
|
#
|
|
|
|
# For now we require '&&' between commands, until they get globally killed and
|
|
|
|
# the test runner updated.
|
|
|
|
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
|
|
|
|
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
2020-09-11 17:17:31 +08:00
|
|
|
config.suffixes = ['.c', '.cpp', '.f', '.F', '.ff', '.FOR', '.for', '.f77', '.f90', '.F90',
|
2020-01-15 00:20:49 +08:00
|
|
|
'.ff90', '.f95', '.F95', '.ff95', '.fpp', '.FPP', '.cuf',
|
2020-08-02 03:53:27 +08:00
|
|
|
'.CUF', '.f18', '.F18', '.fir']
|
2020-01-15 00:20:49 +08:00
|
|
|
|
|
|
|
config.substitutions.append(('%PATH%', config.environment['PATH']))
|
|
|
|
|
|
|
|
llvm_config.use_default_substitutions()
|
|
|
|
|
|
|
|
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
|
|
|
|
# subdirectories contain auxiliary inputs for various tests in their parent
|
|
|
|
# directories.
|
|
|
|
config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']
|
|
|
|
|
2020-09-11 17:17:31 +08:00
|
|
|
# If the new Flang driver is enabled, add the corresponding feature to
|
|
|
|
# config. Otherwise, exclude the corresponding test directory.
|
|
|
|
if config.include_flang_new_driver_test:
|
|
|
|
config.available_features.add('new-flang-driver')
|
|
|
|
else:
|
|
|
|
config.excludes.append('Flang-Driver')
|
|
|
|
|
2020-01-15 00:20:49 +08:00
|
|
|
# test_source_root: The root path where tests are located.
|
|
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
# test_exec_root: The root path where tests should be run.
|
2020-03-06 19:21:36 +08:00
|
|
|
config.test_exec_root = os.path.join(config.flang_obj_root, 'test')
|
2020-01-15 00:20:49 +08:00
|
|
|
|
|
|
|
# Tweak the PATH to include the tools dir.
|
|
|
|
llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
|
|
|
|
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
|
|
|
|
|
2020-08-02 03:53:27 +08:00
|
|
|
if config.flang_standalone_build:
|
|
|
|
# For builds with FIR, set path for tco and enable related tests
|
|
|
|
if config.flang_llvm_tools_dir != "":
|
|
|
|
config.available_features.add('fir')
|
|
|
|
if config.llvm_tools_dir != config.flang_llvm_tools_dir:
|
|
|
|
llvm_config.with_environment('PATH', config.flang_llvm_tools_dir, append_path=True)
|
2020-08-01 02:10:44 +08:00
|
|
|
|
2020-01-15 00:20:49 +08:00
|
|
|
# For each occurrence of a flang tool name, replace it with the full path to
|
2020-05-04 22:25:02 +08:00
|
|
|
# the build directory holding that tool.
|
|
|
|
tools = [
|
2020-05-12 02:38:53 +08:00
|
|
|
ToolSubst('%f18', command=FindTool('f18'),
|
|
|
|
extra_args=["-intrinsic-module-directory "+config.flang_intrinsic_modules_dir],
|
|
|
|
unresolved='fatal')
|
2020-05-04 22:25:02 +08:00
|
|
|
]
|
2020-08-02 03:53:27 +08:00
|
|
|
|
2020-09-11 17:17:31 +08:00
|
|
|
if config.include_flang_new_driver_test:
|
|
|
|
tools.append(ToolSubst('%flang-new', command=FindTool('flang-new'), unresolved='fatal'))
|
|
|
|
|
2020-08-02 03:53:27 +08:00
|
|
|
if config.flang_standalone_build:
|
|
|
|
llvm_config.add_tool_substitutions(tools, [config.flang_llvm_tools_dir])
|
|
|
|
else:
|
|
|
|
llvm_config.add_tool_substitutions(tools, config.llvm_tools_dir)
|
2020-01-15 00:20:49 +08:00
|
|
|
|
2020-03-06 19:21:36 +08:00
|
|
|
# Enable libpgmath testing
|
|
|
|
result = lit_config.params.get("LIBPGMATH")
|
|
|
|
if result:
|
2020-02-26 07:22:14 +08:00
|
|
|
config.environment["LIBPGMATH"] = True
|