brintos

brintos / llvm-project-archived public Read only

0
0
Text · 715 B · 267f247 Raw
22 lines · cpp
1#include <iostream>2#include <thread>3 4int main(int argc, char **argv) {5  // Print the string that the test looks for to make sure stdout and stderr6  // got recorded.7  std::cout << "stdout_needle" << std::flush;8  std::cerr << "stderr_needle" << std::flush;9 10  // Work around a timing issue that sometimes prevents stderr from being11  // captured.12  std::this_thread::sleep_for(std::chrono::seconds(1));13 14  // This is unreachable during normal test execution as we don't pass any15  // (or +100) arguments. This still needs to be theoretically reachable code16  // so that the compiler will generate code for this (that we can set a17  // breakpoint on).18  if (argc > 100)19    return 1; // break here20  return 0;21}22