aboutsummaryrefslogtreecommitdiff
path: root/winsup/testsuite
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-01-22 15:18:58 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-01-22 15:18:58 +0000
commit19876644c750f10e517f4eaa5fec5fed81228c66 (patch)
treef73ad08c2aa2ffc772870080b50fbe729d3c8f04 /winsup/testsuite
parent89f7e8d1d3a52ac824cfc10fdaaa213f43b4c121 (diff)
downloadnewlib-19876644c750f10e517f4eaa5fec5fed81228c66.zip
newlib-19876644c750f10e517f4eaa5fec5fed81228c66.tar.gz
newlib-19876644c750f10e517f4eaa5fec5fed81228c66.tar.bz2
* cygrun.c: Move here from ../cygwin.
* Makefile.in: Build cygrun.exe. * winsup.api/winsup.exp: Expect cygrun.exe in $rootme.
Diffstat (limited to 'winsup/testsuite')
-rw-r--r--winsup/testsuite/ChangeLog6
-rw-r--r--winsup/testsuite/Makefile.in9
-rw-r--r--winsup/testsuite/cygrun.c67
-rw-r--r--winsup/testsuite/winsup.api/winsup.exp2
4 files changed, 82 insertions, 2 deletions
diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog
index d16f1f4..210f06f 100644
--- a/winsup/testsuite/ChangeLog
+++ b/winsup/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2003-01-22 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygrun.c: Move here from ../cygwin.
+ * Makefile.in: Build cygrun.exe.
+ * winsup.api/winsup.exp: Expect cygrun.exe in $rootme.
+
2003-01-21 Christopher Faylor <cgf@redhat.com>
* Makefile.in: Find tcl library in the right place.
diff --git a/winsup/testsuite/Makefile.in b/winsup/testsuite/Makefile.in
index b74f4c0..9d48e1f 100644
--- a/winsup/testsuite/Makefile.in
+++ b/winsup/testsuite/Makefile.in
@@ -87,7 +87,7 @@ ifdef VERBOSE
RUNTESTFLAGS = -v
endif
-RUNTIME=$(cygwin_build)/new-cygwin1.dll $(cygwin_build)/new-libcygwin.a $(cygwin_build)/cygrun.exe
+RUNTIME=$(cygwin_build)/new-cygwin1.dll $(cygwin_build)/new-libcygwin.a cygrun.exe
TESTSUP_LIB_NAME:=libltp.a
TESTSUP_OFILES:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(libltp_srcdir)/lib/*.c}}}}}
@@ -180,3 +180,10 @@ check: $(TESTSUP_LIB_NAME) $(RUNTIME) testsuite/site.exp
export TCL_LIBRARY ; fi ; \
PATH=$(bupdir)/cygwin:$${PATH} ;\
$(RUNTEST) --tool winsup $(RUNTESTFLAGS)
+
+cygrun.o: cygrun.c
+ $(CC) $(MINGW_CFLAGS) -o $@ -c $<
+
+cygrun.exe : cygrun.o
+ $(CC) ${MINGW_LDFLAGS} -mno-cygwin -o $@ $<
+
diff --git a/winsup/testsuite/cygrun.c b/winsup/testsuite/cygrun.c
new file mode 100644
index 0000000..63d9863
--- /dev/null
+++ b/winsup/testsuite/cygrun.c
@@ -0,0 +1,67 @@
+/* cygrun.c: testsuite support program
+
+ Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+/* This program is intended to be used only by the testsuite. It runs
+ programs without using the cygwin api, so that the just-built dll
+ can be tested without interference from the currently installed
+ dll. */
+
+#include <stdio.h>
+#include <windows.h>
+#include <stdlib.h>
+
+int
+main (int argc, char **argv)
+{
+ STARTUPINFO sa;
+ PROCESS_INFORMATION pi;
+ DWORD ec = 1;
+ char *p;
+
+ if (argc < 2)
+ {
+ fprintf (stderr, "Usage: cygrun [program]\n");
+ exit (0);
+ }
+
+ SetEnvironmentVariable ("CYGWIN_TESTING", "1");
+ if ((p = getenv ("CYGWIN")) == NULL || (strstr (p, "ntsec") == NULL))
+ {
+ char buf[4096];
+ if (!p)
+ {
+ p = buf;
+ p[0] = '\0';
+ }
+ else
+ {
+ strcpy (buf, p);
+ strcat (buf, " ");
+ }
+ strcat(buf, "ntsec");
+ SetEnvironmentVariable ("CYGWIN", buf);
+ }
+
+ memset (&sa, 0, sizeof (sa));
+ memset (&pi, 0, sizeof (pi));
+ if (!CreateProcess (0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi))
+ {
+ fprintf (stderr, "CreateProcess %s failed\n", argv[1]);
+ exit (1);
+ }
+
+ WaitForSingleObject (pi.hProcess, INFINITE);
+
+ GetExitCodeProcess (pi.hProcess, &ec);
+
+ CloseHandle (pi.hProcess);
+ CloseHandle (pi.hThread);
+ return ec;
+}
diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp
index 6d71fa9..c79889e 100644
--- a/winsup/testsuite/winsup.api/winsup.exp
+++ b/winsup/testsuite/winsup.api/winsup.exp
@@ -58,7 +58,7 @@ foreach src [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.c] {
} else {
set redirect_output /dev/null
}
- ws_spawn "$runtime_root/cygrun ./$base.exe > $redirect_output"
+ ws_spawn "$rootme/cygrun ./$base.exe > $redirect_output"
if { $rv != "" } {
verbose -log "$testcase: $rv"
fail "$testcase (execute)"