[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / tools / llvm-reduce / TestRunner.h
blobc14d0459a0fb412f994b126c4a6033efdb90d530
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_LLVM_REDUCE_TESTRUNNER_H
10 #define LLVM_TOOLS_LLVM_REDUCE_TESTRUNNER_H
12 #include "ReducerWorkItem.h"
13 #include "llvm/ADT/SmallString.h"
14 #include "llvm/IR/Module.h"
15 #include "llvm/Support/Error.h"
16 #include "llvm/Support/FileSystem.h"
17 #include "llvm/Support/Path.h"
18 #include "llvm/Support/Program.h"
19 #include <vector>
21 namespace llvm {
23 // This class contains all the info necessary for running the provided
24 // interesting-ness test, as well as the most reduced module and its
25 // respective filename.
26 class TestRunner {
27 public:
28 TestRunner(StringRef TestName, const std::vector<std::string> &TestArgs,
29 std::unique_ptr<ReducerWorkItem> Program);
31 /// Runs the interesting-ness test for the specified file
32 /// @returns 0 if test was successful, 1 if otherwise
33 int run(StringRef Filename);
35 /// Returns the most reduced version of the original testcase
36 ReducerWorkItem &getProgram() const { return *Program; }
38 void setProgram(std::unique_ptr<ReducerWorkItem> P) {
39 assert(P && "Setting null program?");
40 Program = std::move(P);
43 private:
44 StringRef TestName;
45 const std::vector<std::string> &TestArgs;
46 std::unique_ptr<ReducerWorkItem> Program;
49 } // namespace llvm
51 #endif