aboutsummaryrefslogtreecommitdiff
path: root/tests/recipe/buildscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-10-10 17:22:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-11-06 19:32:09 +0300
commitf41599c8e9435f3dfec60b872c2b4ae31177efdd (patch)
tree088f8d9bf906e4a2ed734e034699163c9ccc7306 /tests/recipe/buildscript
parentac76a4fd2afff48a0d5db84592babe5cabef3a2c (diff)
Add support for test timeouts
Diffstat (limited to 'tests/recipe/buildscript')
-rw-r--r--tests/recipe/buildscript/testscript120
1 files changed, 120 insertions, 0 deletions
diff --git a/tests/recipe/buildscript/testscript b/tests/recipe/buildscript/testscript
index 551f64a..787bafd 100644
--- a/tests/recipe/buildscript/testscript
+++ b/tests/recipe/buildscript/testscript
@@ -107,3 +107,123 @@
$* clean 2>-
}
+
+: timeout
+:
+if ($cxx.target.class != 'windows')
+{
+ : update
+ :
+ {
+ : expired
+ :
+ {
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ foo: bar
+ % [diag=update]
+ {{
+ cp $path($<) $path($>)
+ timeout 1
+ ^sleep 5
+ }}
+ EOI
+
+ $* 2>>~%EOE% != 0;
+ update file{foo}
+ buildfile:6:3: error: ^sleep terminated: execution timeout expired
+ info: while updating file{foo}
+ %.+
+ EOE
+
+ $* clean 2>-
+ }
+
+ : successful-timeout
+ :
+ {
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ foo: bar
+ % [diag=update]
+ {{
+ cp $path($<) $path($>)
+ timeout --success 1
+ ^sleep 5
+ }}
+ EOI
+
+ $* 2>>EOE;
+ update file{foo}
+ EOE
+
+ $* clean 2>-
+ }
+ }
+
+ : test
+ :
+ {
+ : expired
+ :
+ {
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ foo: bar
+ {{
+ cp $path($<) $path($>)
+ }}
+ % [diag=test] test
+ {{
+ ^sleep 5
+ }}
+ EOI
+
+ $* test config.test.timeout=1 2>>~%EOE% != 0;
+ cp file{foo}
+ test file{foo}
+ buildfile:7:3: error: ^sleep terminated: execution timeout expired
+ info: while testing file{foo}
+ %.+
+ EOE
+
+ $* test config.test.timeout=/1 2>>~%EOE% != 0;
+ test file{foo}
+ buildfile:7:3: error: ^sleep terminated: execution timeout expired
+ info: while testing file{foo}
+ %.+
+ EOE
+
+ $* clean 2>-
+ }
+
+ : not-expired
+ :
+ {
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ foo: bar
+ % [diag=cp]
+ {{
+ ^sleep 4
+ cp $path($<) $path($>)
+ }}
+ % [diag=test] test
+ {{
+ ^sleep 1
+ }}
+ EOI
+
+ $* test config.test.timeout=3 2>>EOE;
+ cp file{foo}
+ test file{foo}
+ EOE
+
+ $* clean 2>-
+ }
+ }
+}