CIRCT
20.0.0git
|
A single test case to be run by a tester. More...
#include <Tester.h>
Public Member Functions | |
TestCase (const Tester &tester, mlir::ModuleOp module) | |
Create a test case with an MLIR module that will be written to a temporary file on disk. More... | |
TestCase (const Tester &tester, llvm::Twine filepath) | |
Create a test case for an already-prepared file on disk. More... | |
bool | isValid () |
Check whether the MLIR module is valid. More... | |
llvm::StringRef | getFilepath () |
Determine the path to the MLIR module on disk. More... | |
size_t | getSize () |
Determine the size of the MLIR module on disk. More... | |
bool | isInteresting () |
Run the tester on the MLIR module and return whether it is deemed interesting. More... | |
Private Member Functions | |
void | ensureFileOnDisk () |
Ensure filepath and size are populated, and that the test case is in a file on disk. More... | |
Private Attributes | |
const Tester & | tester |
The tester that is used to run this test case. More... | |
mlir::ModuleOp | module |
The module to be tested. More... | |
llvm::SmallString< 32 > | filepath |
The path on disk where the test case is located. More... | |
std::unique_ptr< llvm::ToolOutputFile > | file |
In case this test case has created a temporary file on disk, this is the ToolOutputFile that did the writing. More... | |
std::optional< bool > | valid |
Whether the MLIR module validation has run, and its result. More... | |
std::optional< size_t > | size |
Whether the size of the test case on disk has already been determined, and if yes, that size. More... | |
std::optional< bool > | interesting |
Whether the tester has run on this test case, and its result. More... | |
Friends | |
class | Tester |
A single test case to be run by a tester.
This is a helper object that wraps a ModuleOp
and can be used to query initial information about the test, such as validity of the module and size on disk, before the test is actually executed.
|
inline |
|
inline |
|
private |
Ensure filepath
and size
are populated, and that the test case is in a file on disk.
Definition at line 118 of file Tester.cpp.
References assert(), file, filepath, module, and size.
Referenced by getFilepath(), getSize(), and isInteresting().
StringRef TestCase::getFilepath | ( | ) |
Determine the path to the MLIR module on disk.
Actual writing to disk is only performed on the first call; subsequent calls return the cached result.
Definition at line 88 of file Tester.cpp.
References ensureFileOnDisk(), filepath, and isValid().
size_t TestCase::getSize | ( | ) |
Determine the size of the MLIR module on disk.
Actual writing to disk is only performed on the first call; subsequent calls return the cached result.
Definition at line 97 of file Tester.cpp.
References ensureFileOnDisk(), isValid(), and size.
bool TestCase::isInteresting | ( | ) |
Run the tester on the MLIR module and return whether it is deemed interesting.
Actual testing is only performed on the first call; subsequent calls return the cached result.
Definition at line 107 of file Tester.cpp.
References ensureFileOnDisk(), filepath, interesting, circt::Tester::isInteresting(), isValid(), and tester.
bool TestCase::isValid | ( | ) |
Check whether the MLIR module is valid.
Actual validation is only performed on the first call; subsequent calls return the cached result.
Definition at line 77 of file Tester.cpp.
References module, valid, and AssertPropertyLikeOp::verify().
Referenced by getFilepath(), getSize(), and isInteresting().
|
private |
In case this test case has created a temporary file on disk, this is the ToolOutputFile
that did the writing.
Keeping this class around ensures that the file will be cleaned up properly afterwards. This field remains null if the user already has provided a filepath in the constructor.
Definition at line 124 of file Tester.h.
Referenced by ensureFileOnDisk().
|
private |
The path on disk where the test case is located.
Definition at line 118 of file Tester.h.
Referenced by ensureFileOnDisk(), getFilepath(), isInteresting(), and TestCase().
|
private |
Whether the tester has run on this test case, and its result.
Definition at line 132 of file Tester.h.
Referenced by isInteresting().
|
private |
The module to be tested.
Definition at line 116 of file Tester.h.
Referenced by hw.InstanceBuilder::create_default_value(), ensureFileOnDisk(), om.Evaluator::instantiate(), isValid(), hw.InstanceBuilder::operand_names(), and hw.InstanceBuilder::result_names().
|
private |
Whether the size of the test case on disk has already been determined, and if yes, that size.
Definition at line 130 of file Tester.h.
Referenced by esiaccel.types.ArrayType::bit_width(), esiaccel.types.ArrayType::deserialize(), ensureFileOnDisk(), getSize(), and esiaccel.types.ArrayType::is_valid().
|
private |
The tester that is used to run this test case.
Definition at line 114 of file Tester.h.
Referenced by isInteresting().
|
private |