[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / tools / llvm-reduce / TestRunner.h
blob2270d6bd90b27656659e62683cd80916c4624dae
1 //===-- tools/llvm-reduce/TestRunner.h ---------------------------*- C++ -*-===/
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMREDUCE_TESTRUNNER_H
10 #define LLVM_TOOLS_LLVMREDUCE_TESTRUNNER_H
12 #include "llvm/ADT/SmallString.h"
13 #include "llvm/IR/Module.h"
14 #include "llvm/Support/Error.h"
15 #include "llvm/Support/FileSystem.h"
16 #include "llvm/Support/Path.h"
17 #include "llvm/Support/Program.h"
18 #include <vector>
20 namespace llvm {
22 // This class contains all the info necessary for running the provided
23 // interesting-ness test, as well as the most reduced module and its
24 // respective filename.
25 class TestRunner {
26 public:
27 TestRunner(StringRef TestName, const std::vector<std::string> &TestArgs);
29 /// Runs the interesting-ness test for the specified file
30 /// @returns 0 if test was successful, 1 if otherwise
31 int run(StringRef Filename);
33 /// Returns the most reduced version of the original testcase
34 Module *getProgram() const { return Program.get(); }
36 void setProgram(std::unique_ptr<Module> P) { Program = std::move(P); }
38 private:
39 StringRef TestName;
40 const std::vector<std::string> &TestArgs;
41 std::unique_ptr<Module> Program;
44 } // namespace llvm
46 #endif