1 #include <iostream>
2 #include <thread>
3 
main(int argc,char ** argv)4 int main(int argc, char **argv) {
5   // Print the string that the test looks for to make sure stdout and stderr
6   // 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 being
11   // 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 any
15   // (or +100) arguments. This still needs to be theoretically reachable code
16   // so that the compiler will generate code for this (that we can set a
17   // breakpoint on).
18   if (argc > 100)
19     return 1; // break here
20   return 0;
21 }
22