* Run the given program and set the stdout and stderr parameters to * the output on each of the streams. The return code of the program is * returned as the result. */
| 44 | * returned as the result. |
| 45 | */ |
| 46 | int runProgram(const std::vector<std::string>& args, std::string& out, std::string& err) { |
| 47 | std::ostringstream command; |
| 48 | std::copy(args.begin(), args.end(), std::ostream_iterator<std::string>(command, " ")); |
| 49 | |
| 50 | testing::internal::CaptureStdout(); |
| 51 | testing::internal::CaptureStderr(); |
| 52 | |
| 53 | int status = system(command.str().c_str()); |
| 54 | |
| 55 | out = testing::internal::GetCapturedStdout(); |
| 56 | err = testing::internal::GetCapturedStderr(); |
| 57 | |
| 58 | return WEXITSTATUS(status); |
| 59 | } |
| 60 | |
| 61 | #define ORC_TOOL_TEST_STRINGIFY(path) ORC_TOOL_TEST_STR(path) |
| 62 | #define ORC_TOOL_TEST_STR(path) #path |