1 //===-- TestRunner.cpp ----------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "TestRunner.h"
13 TestRunner::TestRunner(StringRef TestName
, const std::vector
<std::string
> &TestArgs
)
14 : TestName(TestName
), TestArgs(TestArgs
) {
17 /// Runs the interestingness test, passes file to be tested as first argument
18 /// and other specified test arguments after that.
19 int TestRunner::run(StringRef Filename
) {
20 std::vector
<StringRef
> ProgramArgs
;
21 ProgramArgs
.push_back(TestName
);
23 for (const auto &Arg
: TestArgs
)
24 ProgramArgs
.push_back(Arg
);
26 ProgramArgs
.push_back(Filename
);
29 int Result
= sys::ExecuteAndWait(
30 TestName
, ProgramArgs
, /*Env=*/None
, /*Redirects=*/None
,
31 /*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg
);
34 Error E
= make_error
<StringError
>("Error running interesting-ness test: " +
36 inconvertibleErrorCode());
37 errs() << toString(std::move(E
));