From f41599c8e9435f3dfec60b872c2b4ae31177efdd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 10 Oct 2020 17:22:46 +0300 Subject: Add support for test timeouts --- tests/test/simple/generated/driver.cxx | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'tests/test/simple/generated/driver.cxx') diff --git a/tests/test/simple/generated/driver.cxx b/tests/test/simple/generated/driver.cxx index 1d911df..18fd0ae 100644 --- a/tests/test/simple/generated/driver.cxx +++ b/tests/test/simple/generated/driver.cxx @@ -1,24 +1,52 @@ // file : tests/test/simple/generated/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#ifndef _WIN32 +# include +# include +#else +# include +#endif + #include #include #include using namespace std; +// If the -s option is specified, then also sleep for 5 seconds. +// int main (int argc, char* argv[]) { + int i (1); + for (; i != argc; ++i) + { + string a (argv[i]); + + if (a == "-s") + { + // MINGW GCC 4.9 doesn't implement this_thread so use Win32 Sleep(). + // +#ifndef _WIN32 + this_thread::sleep_for (chrono::seconds (5)); +#else + Sleep (5000); +#endif + } + else + break; + } + int r (0); - if (argc == 1) + if (i == argc) { cout << "1.2.3" << endl; } else { - ifstream ifs (argv[1]); + ifstream ifs (argv[i]); if (!ifs.is_open ()) cerr << "unable to open " << argv[1] << endl; -- cgit v1.1