13 #ifndef CIRCT_REDUCE_TESTER_H
14 #define CIRCT_REDUCE_TESTER_H
17 #include "mlir/IR/BuiltinOps.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/Support/Error.h"
20 #include "llvm/Support/FileSystem.h"
21 #include "llvm/Support/Program.h"
124 std::unique_ptr<llvm::ToolOutputFile>
file;
A single test case to be run by a tester.
std::optional< bool > interesting
Whether the tester has run on this test case, and its result.
TestCase(const Tester &tester, llvm::Twine filepath)
Create a test case for an already-prepared file on disk.
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.
llvm::SmallString< 32 > filepath
The path on disk where the test case is located.
mlir::ModuleOp module
The module to be tested.
size_t getSize()
Determine the size of the MLIR module on disk.
bool isValid()
Check whether the MLIR module is valid.
std::optional< size_t > size
Whether the size of the test case on disk has already been determined, and if yes,...
void ensureFileOnDisk()
Ensure filepath and size are populated, and that the test case is in a file on disk.
std::optional< bool > valid
Whether the MLIR module validation has run, and its result.
bool isInteresting()
Run the tester on the MLIR module and return whether it is deemed interesting.
const Tester & tester
The tester that is used to run this test case.
llvm::StringRef getFilepath()
Determine the path to the MLIR module on disk.
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 ...
A testing environment for reduction attempts.
llvm::StringRef testScript
The binary to execute in order to check a reduction attempt for interestingness.
Tester(llvm::StringRef testScript, llvm::ArrayRef< std::string > testScriptArgs, bool testMustFail)
bool isInteresting(llvm::StringRef testCase) const
Return whether the file in the given path is interesting.
bool testMustFail
Consider the testcase to be interesting if it fails rather than on exit code 0.
TestCase get(mlir::ModuleOp module) const
Create a new test case for the given module.
std::pair< bool, size_t > isInteresting(mlir::ModuleOp module) const
Runs the interestingness testing script on a MLIR test case file.
llvm::ArrayRef< std::string > testScriptArgs
Additional arguments to pass to testScript.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.