circt/test/lit.cfg.py

83 lines
2.5 KiB
Python
Raw Normal View History

# -*- Python -*-
import os
import platform
import re
import shutil
import subprocess
import tempfile
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.
2020-06-18 01:19:08 +08:00
config.name = 'CIRCT'
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
# suffixes: A list of file extensions to treat as test files.
config.suffixes = ['.td', '.mlir', '.ll', '.fir', '.sv']
# 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-06-18 01:19:08 +08:00
config.test_exec_root = os.path.join(config.circt_obj_root, 'test')
config.substitutions.append(('%PATH%', config.environment['PATH']))
config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
config.substitutions.append(('%shlibdir', config.circt_shlib_dir))
llvm_config.with_system_environment(['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP'])
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']
# 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-06-18 01:19:08 +08:00
config.test_exec_root = os.path.join(config.circt_obj_root, 'test')
# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
tool_dirs = [
config.circt_tools_dir, config.mlir_tools_dir, config.llvm_tools_dir
]
tools = [
[reduce] Add a first proof-of-concept reducer implementation with sample FIRRTL dialect reducers (#1591) - Update/rewrite the `circt-reduce` tool with a custom proof-of-concept reducer for the FIRRTL dialect. This is supposed to be a pathfinding exercise and just uses FIRRTL as an example. The intent is for other dialects to be able to produce sets of their own reducers that will then be combined by the tool to operate on some input IR. At this point, `circt-reduce` can be used to reduce FIRRTL test cases by converting as many `firrtl.module` ops into `firrtl.extmodule` ops as possible while still maintaining some interesting characteristic. - Extend `circt-reduce` to support exploratively applying passes to the input in an effort to reduce its size. Also add the ability to specify an entire list of potential reduction strategies/patterns which are tried in order. This allows for reductions with big effect, like removing entire modules, to be tried first, before taking a closer look at individual instructions. - Add reduction strategies to `circt-reduce` that try to replace the right hand side of FIRRTL connects with `invalidvalue`, and generally try to remove operations if they have no results or no users of their results. - Add a reduction pattern to `circt-reduce` that replaces instances of `firrtl.extmodule` with a `firrtl.wire` for each port. This can significantly reduce the complexity of test cases by pruning the module hierarchy of unused modules. - Move the `Reduction` class and sample implementations into a separate header and implementation file. These currently live in `tools/circt-reduce`, but should later move into a dedicated reduction framework, maybe in `include/circt/Reduce`, where dialects can easily access them and provide their own reduction implementations.
2021-08-18 23:22:43 +08:00
'firtool', 'handshake-runner', 'circt-opt', 'circt-reduce',
'circt-translate', 'circt-capi-ir-test', 'esi-tester'
]
# Enable Verilator if it has been detected.
if config.verilator_path != "":
tool_dirs.append(os.path.dirname(config.verilator_path))
tools.append('verilator')
config.available_features.add('verilator')
# Enable ESI's Capnp tests if they're supported.
if config.esi_capnp != "":
config.available_features.add('capnp')
# Enable tests for schedulers relying on an external solver from OR-Tools.
if config.scheduling_or_tools != "":
config.available_features.add('or-tools')
# Add llhd-sim if it is built.
if config.llhd_sim_enabled:
config.available_features.add('llhd-sim')
tools.append('llhd-sim')
llvm_config.add_tool_substitutions(tools, tool_dirs)