summaryrefslogtreecommitdiff
path: root/tests/actions
diff options
context:
space:
mode:
authorruki <[email protected]>2023-12-28 22:34:59 +0800
committerruki <[email protected]>2023-12-28 22:34:59 +0800
commit060626edbf26101044d6ab74f7f1af2fd755dc13 (patch)
treee5271d4e3219a275abe9fe8c01b72a25fdc858fd /tests/actions
parent5274ebb6ac3b130f820c9b6caf512181fbde37bf (diff)
test process timeout #4544
Diffstat (limited to 'tests/actions')
-rw-r--r--tests/actions/test/src/run_timeout.cpp14
-rw-r--r--tests/actions/test/xmake.lua7
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/actions/test/src/run_timeout.cpp b/tests/actions/test/src/run_timeout.cpp
new file mode 100644
index 000000000..b4746403f
--- /dev/null
+++ b/tests/actions/test/src/run_timeout.cpp
@@ -0,0 +1,14 @@
+#ifdef _MSC_VER
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
+
+int main(int argc, char** argv) {
+#ifdef _MSC_VER
+ Sleep(10 * 1000);
+#else
+ usleep(10 * 100 * 1000);
+#endif
+ return 0;
+}
diff --git a/tests/actions/test/xmake.lua b/tests/actions/test/xmake.lua
index a4f75036d..67223bc79 100644
--- a/tests/actions/test/xmake.lua
+++ b/tests/actions/test/xmake.lua
@@ -42,3 +42,10 @@ target("test_15")
set_default(false)
add_files("src/test_1.cpp")
add_tests("stub_n", {files = "tests/stub_n*.cpp", defines = "STUB_N"})
+
+target("test_timeout")
+ set_kind("binary")
+ set_default(false)
+ add_files("src/run_timeout.cpp")
+ add_tests("run_timeout", {run_timeout = 1000})
+