libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: don't use assert/abort on MSVC as they are interactiv


From: Peter Rosin
Subject: Re: [PATCH] tests: don't use assert/abort on MSVC as they are interactive.
Date: Wed, 29 Sep 2010 10:06:00 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2

Den 2010-09-28 22:09 skrev Ralf Wildenhues:
> Hello Peter,
> 
> * Peter Rosin wrote on Tue, Sep 28, 2010 at 08:08:13PM CEST:
>> Ok to push?
> 
> Avoiding assert doesn't seem like a scalable solution: lots of packages
> use assert for testing.  assert is ANSI C.  We use assert in slist.at.
> Is there a way to avoid popups?
> 
> Hmm, or, if there is no way, then I guess you're saying popups are ok if
> it only happens for unexpected failures.  Then I don't have a good
> argument against the patch any more.

I started out by setting the w32 error mode directly in the executable in
the test, and that revealed that I was wrong in what error mode flag
this was connected to (I thought SEM_FAILCRITICALERRORS, but it really is
SEM_NOGPFAULTERRORBOX).  That revelation made me reimplement an idea I
had a while back that I didn't get to work because of that misconception.

So, here's a patch with a different take on the problem that makes the old
testsuite non-interactive on MSYS, and that fixes this non-interactiveness
too. The two remaining interactive tests (link-order2.at and static.at)
unfortunately runs installed binaries so this scheme is not working there.

I didn't want to unconditionally fiddle the error mode when running through
the wrapper, as that would royally screw users depending on the error
dialog to be there.

Cygwin is always running with this error mode (I think), MSYS is not.

Ok to push this one?

Cheers,
Peter

>From fa648e86ec81defc48e035ca952635e2dc42cc51 Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Wed, 29 Sep 2010 09:59:18 +0200
Subject: [PATCH] tests: make more tests non-interactive on MSYS.

* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src):
Recognize --lt-no-popup and set the w32 error mode so that
Windows do not popup dialogs if the option is seen.
* libltdl/config/ltmain.m4sh (func_parse_lt_options): Recognize
--lt-no-popup and strip it out (with no side effect, there is
no API for adjusting the w32 error mode from within a shell).
* tests/demo-relink.test, tests/depdemo-relink.test: Use the
above option to make the test non-interactive on MSYS.
tests/lalib-syntax.at: Use the above option to make the test
non-interactive on MSYS/MSVC (the MSVC version of assert/abort
pops up an error dialog).
* docs/libtool.texi (Wrapper executables): Document the new
option of the wrapper.

Signed-off-by: Peter Rosin <address@hidden>
---
 ChangeLog                  |   17 +++++++++++++++++
 doc/libtool.texi           |    7 +++++++
 libltdl/config/ltmain.m4sh |   16 ++++++++++++++--
 tests/demo-relink.test     |    2 +-
 tests/depdemo-relink.test  |    2 +-
 tests/lalib-syntax.at      |    2 +-
 6 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a7aa489..3967d0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-29  Peter Rosin  <address@hidden>
+
+       tests: make more tests non-interactive on MSYS.
+       * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src):
+       Recognize --lt-no-popup and set the w32 error mode so that
+       Windows do not popup dialogs if the option is seen.
+       * libltdl/config/ltmain.m4sh (func_parse_lt_options): Recognize
+       --lt-no-popup and strip it out (with no side effect, there is
+       no API for adjusting the w32 error mode from within a shell).
+       * tests/demo-relink.test, tests/depdemo-relink.test: Use the
+       above option to make the test non-interactive on MSYS.
+       tests/lalib-syntax.at: Use the above option to make the test
+       non-interactive on MSYS/MSVC (the MSVC version of assert/abort
+       pops up an error dialog).
+       * docs/libtool.texi (Wrapper executables): Document the new
+       option of the wrapper.
+
 2010-09-27  Peter Rosin  <address@hidden>
 
        tests: check if sys_lib_search_path_spec works on MSVC.
diff --git a/doc/libtool.texi b/doc/libtool.texi
index cd5a181..a9f6c5a 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -904,6 +904,13 @@ These command line options include:
 Causes the wrapper to print a copy of the wrapper @emph{script}
 to @code{stdout}, and exit.
 
address@hidden --lt-no-popup
+This option makes the wrapper attempt to set things up so that the
+program does not issue any error dialogs, and instead report errors with
+an exit status as is the normal way.  This is particularly useful in
+testsuites on w32, as w32 has a tendency to pop up error dialogs for
+certain errors potentially making the testsuite non-interactive.
+
 @item --lt-debug
 Causes the wrapper to print diagnostic information to @code{stdout},
 before launching the program executable.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 0418007..cacf68f 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -3111,8 +3111,8 @@ _LTECHO_EOF'
 # (application programs are unlikely to have options which match
 # this pattern).
 #
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
+# There are only three supported options: --lt-debug, --lt-no-popup
+# and --lt-dump-script. There is, deliberately, no --lt-help.
 #
 # The first argument to this parsing function should be the
 # script's $0 value, followed by "$@".
@@ -3125,6 +3125,7 @@ func_parse_lt_options ()
   do
     case \"\$lt_opt\" in
     --lt-debug) lt_option_debug=1 ;;
+    --lt-no-popup) ;;
     --lt-dump-script)
         lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 
's%/[^/]*$%%'\`
         test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
@@ -3379,6 +3380,9 @@ EOF
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+#ifdef _WIN32
+# include <windows.h>
+#endif
 
 /* declarations of non-ANSI functions */
 #if defined(__MINGW32__)
@@ -3550,6 +3554,7 @@ EOF
 
 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX 
"dump-script";
+static const char *nopopup_opt          = LTWRAPPER_OPTION_PREFIX "no-popup";
 static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 
 int
@@ -3590,6 +3595,13 @@ EOF
          lt_dump_script (stdout);
          return 0;
        }
+      if (strcmp (argv[i], nopopup_opt) == 0)
+       {
+#ifdef _WIN32
+         SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | 
SEM_NOOPENFILEERRORBOX);
+#endif
+         continue;
+       }
       if (strcmp (argv[i], debug_opt) == 0)
        {
           lt_debug = 1;
diff --git a/tests/demo-relink.test b/tests/demo-relink.test
index 8310e46..3e75b78 100755
--- a/tests/demo-relink.test
+++ b/tests/demo-relink.test
@@ -78,7 +78,7 @@ func_make libhello.la libhello_la_OBJECTS=hello.lo \
 rm -f libhello.la
 
 func_msg "running demo/hell with broken libhello.la"
-if (./hell) 2>&1; then
+if (./hell$EXEEXT --lt-no-popup) 2>&1; then
   func_msg "Exiting: demo/hell runs even though libhello.la is incomplete"
   func_fail "shlibpath_overrides_runpath should be set to no"
 else
diff --git a/tests/depdemo-relink.test b/tests/depdemo-relink.test
index dab51b3..0c78ed2 100755
--- a/tests/depdemo-relink.test
+++ b/tests/depdemo-relink.test
@@ -96,7 +96,7 @@ func_msg "linking a broken depdemo/l3/libl3.la"
 rm -f l3/libl3.la
 
 func_msg "running depdemo/depdemo with broken libl3.la"
-if (./depdemo$EXEEXT) 2>&1; then
+if (./depdemo$EXEEXT --lt-no-popup) 2>&1; then
   func_msg "Exiting: depdemo/depdemo runs even though libl3.la is incomplete"
   func_fail "shlibpath_overrides_runpath should be set to no"
 elif test "$build" != "$host"; then
diff --git a/tests/lalib-syntax.at b/tests/lalib-syntax.at
index 0f78ca8..987da1c 100644
--- a/tests/lalib-syntax.at
+++ b/tests/lalib-syntax.at
@@ -130,7 +130,7 @@ libdir='/somewhere'
 
 for file in ./missing-closing-quote.la ./wrong-quotes.la \
            ./no-dlname.la ./nonexistent-dlname.la; do
-  LT_AT_EXEC_CHECK([./main], [1], [stdout], [ignore], [$file])
+  LT_AT_EXEC_CHECK([./main], [1], [stdout], [ignore], [$file --lt-no-popup])
   AT_CHECK([grep 'plugin failed to open' stdout], [], [ignore])
 done
 
-- 
1.7.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]