From 7f9832e774a4b4a5bf7a7cbf31d22d11791fab48 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 2 Jan 2006 06:15:58 +0000 Subject: [PATCH] * cygload/README: Delete. * cygload/cygload.cc: Move to winsup.api. Add comments from README. * cygload/cygload.h: Move to winsup.api. * cygload/cygload.exp: Move to winsup.api. * Makefile.in: Remove cygload. * winsup.api/winsup.exp: If a .exp file is detected, run it rather than using standard compile. * winsup.api/resethand.c (main): Use printf to print status or expect thinks something is wrong. --- winsup/testsuite/ChangeLog | 13 +++++ winsup/testsuite/Makefile.in | 1 - winsup/testsuite/cygload/Makefile | 36 ------------- winsup/testsuite/cygload/README | 18 ------- .../{cygload => winsup.api}/cygload.cc | 46 +++++++++------- .../{cygload => winsup.api}/cygload.exp | 0 .../{cygload => winsup.api}/cygload.h | 2 +- winsup/testsuite/winsup.api/resethand.c | 3 +- winsup/testsuite/winsup.api/winsup.exp | 54 ++++++++++--------- 9 files changed, 72 insertions(+), 101 deletions(-) delete mode 100644 winsup/testsuite/cygload/Makefile delete mode 100644 winsup/testsuite/cygload/README rename winsup/testsuite/{cygload => winsup.api}/cygload.cc (93%) rename winsup/testsuite/{cygload => winsup.api}/cygload.exp (100%) rename winsup/testsuite/{cygload => winsup.api}/cygload.h (99%) diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog index 6ed7c39a1..5fb31a8a3 100644 --- a/winsup/testsuite/ChangeLog +++ b/winsup/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2006-01-02 Christopher Faylor + + * cygload/README: Delete. + * cygload/cygload.cc: Move to winsup.api. Add comments from README. + * cygload/cygload.h: Move to winsup.api. + * cygload/cygload.exp: Move to winsup.api. + * Makefile.in: Remove cygload. + * winsup.api/winsup.exp: If a .exp file is detected, run it rather than + using standard compile. + + * winsup.api/resethand.c (main): Use printf to print status or expect + thinks something is wrong. + 2006-01-01 Christopher Faylor * winsup.api/resethand.c (main): Remove core dump flag from exit diff --git a/winsup/testsuite/Makefile.in b/winsup/testsuite/Makefile.in index cdc96d80b..70bf30c8b 100644 --- a/winsup/testsuite/Makefile.in +++ b/winsup/testsuite/Makefile.in @@ -187,7 +187,6 @@ check: $(TESTSUP_LIB_NAME) $(RUNTIME) cygrun.exe testsuite/site.exp export TCL_LIBRARY ; fi ; \ PATH=$(bupdir)/cygwin:$${PATH} ;\ $(RUNTEST) --tool winsup $(RUNTESTFLAGS) ;\ - $(RUNTEST) --tool cygload $(RUNTESTFLAGS) cygrun.o: cygrun.c $(CC) $(MINGW_CFLAGS) -o $@ -c $< diff --git a/winsup/testsuite/cygload/Makefile b/winsup/testsuite/cygload/Makefile deleted file mode 100644 index e88dde3cd..000000000 --- a/winsup/testsuite/cygload/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# Makefile for cygload - -### -### MinGW options -### -CC = gcc -CFLAGS = -mno-cygwin -Wall -LINKFLAGS = -lstdc++ -Wl,-e,_cygloadCRTStartup@0 - -### -### MSVC options -### -ifndef MSVCDir -MSVCDir = C:/cygwin/usr/local/tools/i686_win32/vc7/Vc7 -endif - -CL = $(MSVCDir)/bin/cl -# If you want to look at the assembly, add "/Famsvc-cygload.asm /FAs". -MSVCCFLAGS = /nologo /GX /MDd /Zi /W4 /TP -MSVCINCLUDES = /I $(MSVCDir)/include /I $(MSVCDir)/PlatformSDK/Include -# Using /ENTRY seems to automatically invoke /NODEFAULTLIBS. -MSVCLIBS = /link /LIBPATH:$(MSVCDir)/lib /LIBPATH:$(MSVCDir)/PlatformSDK/lib \ - /ENTRY:cygloadCRTStartup uuid.lib msvcprtd.lib msvcrtd.lib \ - oldnames.lib kernel32.lib - -all: mingw-cygload.exe - -mingw-cygload.exe: cygload.cc cygload.h - $(CC) $(CFLAGS) $< -o $@ $(LINKFLAGS) - -msvc-cygload.exe: cygload.cc cygload.h - $(CL) $(MSVCCFLAGS) $(MSVCINCLUDES) $< /o $@ $(MSVCLIBS) - -clean: - rm -f msvc-cygload.exe msvc-cygload.ilk cygload.obj \ - msvc-cygload.pdb vc70.pdb mingw-cygload.exe diff --git a/winsup/testsuite/cygload/README b/winsup/testsuite/cygload/README deleted file mode 100644 index a61f73bee..000000000 --- a/winsup/testsuite/cygload/README +++ /dev/null @@ -1,18 +0,0 @@ -cygload demonstrates how to dynamically load cygwin1.dll. The default -build uses MinGW to compile it; the Makefile also shows how to build -it using the Microsoft compiler. - -By default, the program will silently test basic functionality: - * Making space on the stack for cygtls - * Loading and initializing cygwin1.dll - * Path translation - * Error handling - * Signal handling - -Command line parameters are: - - -v Verbose output - -testinterrupts Pause for 30 seconds to allow testing command line - interrupts (^C) - -cygwin xxx Specifies an alternative DLL to load instead of - cygwin1.dll. diff --git a/winsup/testsuite/cygload/cygload.cc b/winsup/testsuite/winsup.api/cygload.cc similarity index 93% rename from winsup/testsuite/cygload/cygload.cc rename to winsup/testsuite/winsup.api/cygload.cc index 0febf326e..bdbbcd1a3 100644 --- a/winsup/testsuite/cygload/cygload.cc +++ b/winsup/testsuite/winsup.api/cygload.cc @@ -1,23 +1,33 @@ -// cygload.cpp -// -// Copyright 2005, Red Hat, Inc. -// -// Written by Max Kaehn -// -// This software is a copyrighted work licensed under the terms of the -// Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. -// -// Note that dynamically linking to cygwin1.dll automatically places your code -// under the GPL unless you purchase a Cygwin Contract with Red Hat, Inc. -// See http://www.redhat.com/software/cygwin/ for more information. +/* cygload.cc + Copyright 2005, 2006 Red Hat, Inc. -// Options for this program: -// -v Verbose output. Normal operation is entirely silent, -// save for errors. -// -testinterrupts Pauses the program for 30 seconds so you can demonstrate -// that it handles ^C properly. -// -cygwin Name of DLL to load. Defaults to "cygwin1.dll". + Written by Max Kaehn + + This software is a copyrighted work licensed under the terms of the + Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. + + Note that dynamically linking to cygwin1.dll automatically places your code + under the GPL unless you purchase a Cygwin Contract with Red Hat, Inc. + See http://www.redhat.com/software/cygwin/ for more information. + + cygload demonstrates how to dynamically load cygwin1.dll. The default + build uses MinGW to compile it; the Makefile also shows how to build + it using the Microsoft compiler. + + By default, the program will silently test basic functionality: + * Making space on the stack for cygtls + * Loading and initializing cygwin1.dll + * Path translation + * Error handling + * Signal handling + + Options for this program: + -v Verbose output. Normal operation is entirely silent, + save for errors. + -testinterrupts Pauses the program for 30 seconds so you can demonstrate + that it handles ^C properly. + -cygwin Name of DLL to load. Defaults to "cygwin1.dll". */ #include "cygload.h" #include diff --git a/winsup/testsuite/cygload/cygload.exp b/winsup/testsuite/winsup.api/cygload.exp similarity index 100% rename from winsup/testsuite/cygload/cygload.exp rename to winsup/testsuite/winsup.api/cygload.exp diff --git a/winsup/testsuite/cygload/cygload.h b/winsup/testsuite/winsup.api/cygload.h similarity index 99% rename from winsup/testsuite/cygload/cygload.h rename to winsup/testsuite/winsup.api/cygload.h index dfe9d0f78..226a3f8da 100644 --- a/winsup/testsuite/cygload/cygload.h +++ b/winsup/testsuite/winsup.api/cygload.h @@ -66,7 +66,7 @@ namespace cygwin // gdb reports sizeof(_cygtls) == 3964 at the time of this writing. // This is at the end of the object so it'll be toward the bottom // of the stack when it gets declared. - char _padding[4096]; + char _padding[8192]; static padding *_main; static DWORD _mainTID; diff --git a/winsup/testsuite/winsup.api/resethand.c b/winsup/testsuite/winsup.api/resethand.c index 2d1ccabc9..7d58dcd2c 100644 --- a/winsup/testsuite/winsup.api/resethand.c +++ b/winsup/testsuite/winsup.api/resethand.c @@ -8,7 +8,6 @@ int doit = 0; void ouch (int sig) { - fprintf (stderr, "ouch %d\n", sig); if (doit++ > 0) kill (getpid (), SIGTERM); } @@ -32,6 +31,6 @@ main (int argc, char **argv) exit (0x42); } status &= ~0x80; // remove core dump flag - fprintf (stderr, "pid %d exited with status %p\n", pid, (void *) status); + printf ("pid %d exited with status %p\n", pid, (void *) status); exit (argc == 1 ? !(status == SIGSEGV) : !(status == SIGTERM)); } diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp index 26d3af0d2..639096267 100644 --- a/winsup/testsuite/winsup.api/winsup.exp +++ b/winsup/testsuite/winsup.api/winsup.exp @@ -29,7 +29,7 @@ proc ws_spawn {cmd args} { verbose "Filter: $test_filter" -foreach src [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.c] { +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc,c}]] { if { $test_filter != "" && ! [regexp $test_filter $src] } { verbose -log "Skipping $src" continue @@ -48,32 +48,36 @@ foreach src [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.c] { clear_xfail } - ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libcygwin0.a -lkernel32 -luser32 -o $base.exe" - if { $rv != "" } { - verbose -log "$rv" - fail "$testcase (compile)" + if [ file exists "$srcdir/$subdir/$basename.exp" ] then { + source "$srcdir/$subdir/$basename.exp" } else { - if { $verbose } { - set redirect_output "./$base.log" - } else { - set redirect_output /dev/null - } - ws_spawn "$rootme/cygrun ./$base.exe > $redirect_output" - if { $rv != "" } { - verbose -log "$testcase: $rv" - fail "$testcase (execute)" - if { $xfail_expected } { - catch { file delete "$base.exe" } err - if { $err != "" } { - note "error deleting $base.exe: $err" - } - } + ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libcygwin0.a -lkernel32 -luser32 -o $base.exe" + if { $rv != "" } { + verbose -log "$rv" + fail "$testcase (compile)" } else { - pass "$testcase" - if { ! $xfail_expected } { - catch { file delete "$base.exe" } err - if { $err != "" } { - note "error deleting $base.exe: $err" + if { $verbose } { + set redirect_output "./$base.log" + } else { + set redirect_output /dev/null + } + ws_spawn "$rootme/cygrun ./$base.exe > $redirect_output" + if { $rv != "" } { + verbose -log "$testcase: $rv" + fail "$testcase (execute)" + if { $xfail_expected } { + catch { file delete "$base.exe" } err + if { $err != "" } { + note "error deleting $base.exe: $err" + } + } + } else { + pass "$testcase" + if { ! $xfail_expected } { + catch { file delete "$base.exe" } err + if { $err != "" } { + note "error deleting $base.exe: $err" + } } } }