diff options
Diffstat (limited to 'tests/test/simple')
-rw-r--r-- | tests/test/simple/generated/buildfile | 3 | ||||
-rw-r--r-- | tests/test/simple/generated/driver.cxx | 32 | ||||
-rw-r--r-- | tests/test/simple/generated/testscript | 57 |
3 files changed, 89 insertions, 3 deletions
diff --git a/tests/test/simple/generated/buildfile b/tests/test/simple/generated/buildfile index 0809bdf..0344891 100644 --- a/tests/test/simple/generated/buildfile +++ b/tests/test/simple/generated/buildfile @@ -6,4 +6,5 @@ ./: testscript exe{driver} $b file{*.in} -exe{driver}: cxx{driver} +import libs = libbutl%lib{butl} +exe{driver}: cxx{driver} $libs 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 <chrono> +# include <thread> +#else +# include <libbutl/win32-utility.hxx> +#endif + #include <string> #include <fstream> #include <iostream> 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; diff --git a/tests/test/simple/generated/testscript b/tests/test/simple/generated/testscript index a04dccc..f6a89d8 100644 --- a/tests/test/simple/generated/testscript +++ b/tests/test/simple/generated/testscript @@ -42,3 +42,60 @@ driver = $src_root/../exe{driver} ./: file{output}: test.stdout = true file{output}: in{output} $src_root/manifest #@@ in module EOI + +: timeout +: +{ + : operation + : + { + : no-output + : + ln -s $src_base/output.in ./; + $* config.test.timeout=1 <<EOI 2>>/~%EOE% != 0 + driver = $src_root/../exe{driver} + ./: test = $driver + ./: test.options = -s + ./: $driver + EOI + error: test dir{./} failed + % error: .+ -s terminated: execution timeout expired% + % info: test command line: .+% + EOE + + : output + : + ln -s $src_base/output.in ./; + $* config.test.timeout=1 &output &output.d <<EOI 2>>/~%EOE% != 0 + driver = $src_root/../exe{driver} + ./: test = $driver + ./: test.options = -s + ./: $driver + ./: file{output}: test.stdout = true + file{output}: in{output} $src_root/manifest #@@ in module + EOI + error: test dir{./} failed + % error: diff .+ terminated: execution timeout expired% + % error: .+ -s terminated: execution timeout expired% + % info: test command line: .+% + EOE + } + + : test + : + { + : no-output + : + ln -s $src_base/output.in ./; + $* config.test.timeout=/1 <<EOI 2>>/~%EOE% != 0 + driver = $src_root/../exe{driver} + ./: test = $driver + ./: test.options = -s + ./: $driver + EOI + error: test dir{./} failed + % error: .+ -s terminated: execution timeout expired% + % info: test command line: .+% + EOE + } +} |