public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: testsuite: Add '-notimeout' option to cygrun
@ 2023-08-08 13:16 Jon Turney
0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2023-08-08 13:16 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c88ac48eab3e9df4c7bb353af1b5dfd3798fa9f0
commit c88ac48eab3e9df4c7bb353af1b5dfd3798fa9f0
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Thu Jul 20 13:54:09 2023 +0100
Cygwin: testsuite: Add '-notimeout' option to cygrun
Add '-notimeout' option for cygrun. This is very useful when using it
to run a test standalone and under a debugger.
Also: warn about excess arguments
Diff:
---
winsup/testsuite/cygrun.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/winsup/testsuite/cygrun.c b/winsup/testsuite/cygrun.c
index d8de7d158..450201342 100644
--- a/winsup/testsuite/cygrun.c
+++ b/winsup/testsuite/cygrun.c
@@ -23,24 +23,42 @@ main (int argc, char **argv)
DWORD res;
DWORD ec = 1;
char *p;
+ DWORD timeout = 60 * 1000;
if (argc < 2)
{
fprintf (stderr, "Usage: cygrun [program]\n");
- exit (0);
+ exit (1);
+ }
+
+ int i;
+ for (i = 1; i < argc; ++i)
+ {
+ if (strcmp (argv[i], "-notimeout") == 0)
+ timeout = INFINITE;
+ else
+ break;
+ }
+
+ char *command = argv[i];
+
+ if (i < (argc-1))
+ {
+ fprintf (stderr, "cygrun: excess arguments\n");
+ exit (1);
}
SetEnvironmentVariable ("CYGWIN_TESTING", "1");
memset (&sa, 0, sizeof (sa));
memset (&pi, 0, sizeof (pi));
- if (!CreateProcess (0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi))
+ if (!CreateProcess (0, command, 0, 0, 1, 0, 0, 0, &sa, &pi))
{
- fprintf (stderr, "CreateProcess %s failed\n", argv[1]);
+ fprintf (stderr, "CreateProcess %s failed\n", command);
exit (1);
}
- res = WaitForSingleObject (pi.hProcess, 60 * 1000);
+ res = WaitForSingleObject (pi.hProcess, timeout);
if (res == WAIT_TIMEOUT)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-08 13:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 13:16 [newlib-cygwin/main] Cygwin: testsuite: Add '-notimeout' option to cygrun Jon Turney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).