bug-automake
[Top][All Lists]
Advanced

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

bug#10466: MSYS problem with redirects


From: Peter Rosin
Subject: bug#10466: MSYS problem with redirects
Date: Mon, 09 Jan 2012 12:29:42 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0

Hi!

parallel-tests-fd-redirect.test fails on MSYS, and I think
the cause is that the write (9, ...) simply doesn't work for
MinGW programs (baz.exe and qux.test.exe).  It works for the
shell scripts (foo.sh and bar) since /bin/sh is an MSYS
program and thus is a lot more POSIXy.  But redirecting from
the MinGW world to the MSYS world in this maner is simply
not possible, I think.  I think that will only work for
fd 0,1 and 2 (but I'm not 100% sure).

Also, including unistd.h will not work for non-ANSI systems,
MinGW provides a half-baked unistd.h but MSVC does not.
MSVC has its write() in io.h, but it will probably suffer
from the same problem with a dysfunctional fd 9.

With this diff:

diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-red
index 73a134e..5728014 100755
--- a/tests/parallel-tests-fd-redirect.test
+++ b/tests/parallel-tests-fd-redirect.test
@@ -65,20 +65,26 @@ END
 chmod a+x foo.sh bar

 cat > baz.c <<'END'
+#include <stdio.h>
 #include <unistd.h>
 int main (void)
 {
-  write (9, " bazbazbaz\n", 11);
-  return 0;
+  ssize_t res = write (9, " bazbazbaz\n", 11);
+  if (res < 0)
+    perror("write failed");
+  return res != 11;
 }
 END

 cat > zardoz.c <<'END'
+#include <stdio.h>
 #include <unistd.h>
 int main (void)
 {
-  write (9, " quxquxqux\n", 11);
-  return 0;
+  ssize_t res = write (9, " quxquxqux\n", 11);
+  if (res < 0)
+    perror("write failed");
+  return res != 11;
 }
 END

the embedded test suite goes from 4 PASS to 2 PASS / 2 FAIL,
and this in the log files:

+ cat foo.log
+ cat bar.log
+ cat baz.log
write failed: Bad file descriptor
+ cat qux.log
write failed: Bad file descriptor

supporting the above beliefs.

Cheers,
Peter

For reference, the original parallel-tests-fd-redirect.log:

Running from installcheck: no
Using TAP: no
PATH = /home/peda/automake/tests:/c/Program Files (x86)/Microsoft 
F#/v4.0/:/c/Program Files (x86)/Microsoft Visual Studio 
10.0/VSTSDB/Deploy:/c/Program Files (x86)/Microsoft Visual Studio 
10.0/Common7/IDE/:/c/Program Files (x86)/Microsoft Visual Studio 
10.0/VC/BIN:/c/Program Files (x86)/Microsoft Visual Studio 
10.0/Common7/Tools/:/c/Windows/Microsoft.NET/Framework/v4.0.30319:/c/Windows/Microsoft.NET/Framework/v3.5:/c/Program
 Files (x86)/Microsoft Visual Studio 10.0/VC/VCPackages:/c/Program Files 
(x86)/HTML Help Workshop:/c/Program Files (x86)/Microsoft Visual Studio 
10.0/Team Tools/Performance Tools:/c/Program Files (x86)/Microsoft 
SDKs/Windows/v7.0A/bin/NETFX 4.0 
Tools:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/Common Files/Microsoft 
Shared/Windows Live:/c/Program Files (x86)/Common Files/Microsoft 
Shared/Windows 
Live:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/
++ pwd
/home/peda/automake/tests/parallel-tests-fd-redirect.dir
+ cat
+ cat
+ aclocal-1.11a -Werror
+ autoconf -B /no/such/dir
+ automake-1.11a --foreign -Werror -Wall -a
configure.in:2: installing `./test-driver'
+ cat
+ chmod a+x foo.sh
+ cat
+ chmod a+x foo.sh bar
+ cat
+ cat
+ ./configure
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
+ st=0
+ grep '^bar\.log:.*bar' Makefile
bar.log: bar
+ grep '^baz\.log:.*baz\$(EXEEXT)' Makefile
baz.log: baz$(EXEEXT)
+ grep '^\.test\$(EXEEXT)\.log:' Makefile
.test$(EXEEXT).log:
+ /bin/grep -E '^(foo|qux)\.log:' Makefile
+ test 0 -eq 0
+ st=0
+ make check
+ cat stdout
make  baz.exe qux.test.exe
make[1]: Entering directory 
`/home/peda/automake/tests/parallel-tests-fd-redirect.dir'
gcc -DPACKAGE_NAME=\"parallel-tests-fd-redirect\" 
-DPACKAGE_TARNAME=\"parallel-tests-fd-redirect\" -DPACKAGE_VERSION=\"1.0\" 
-DPACKAGE_STRING=\"parallel-tests-fd-redirect\ 1.0\" -DPACKAGE_BUGREPORT=\"\" 
-DPACKAGE_URL=\"\" -DPACKAGE=\"parallel-tests-fd-redirect\" -DVERSION=\"1.0\" 
-I.     -g -O2 -MT baz.o -MD -MP -MF .deps/baz.Tpo -c -o baz.o baz.c
mv -f .deps/baz.Tpo .deps/baz.Po
gcc  -g -O2   -o baz.exe baz.o  
gcc -DPACKAGE_NAME=\"parallel-tests-fd-redirect\" 
-DPACKAGE_TARNAME=\"parallel-tests-fd-redirect\" -DPACKAGE_VERSION=\"1.0\" 
-DPACKAGE_STRING=\"parallel-tests-fd-redirect\ 1.0\" -DPACKAGE_BUGREPORT=\"\" 
-DPACKAGE_URL=\"\" -DPACKAGE=\"parallel-tests-fd-redirect\" -DVERSION=\"1.0\" 
-I.     -g -O2 -MT zardoz.o -MD -MP -MF .deps/zardoz.Tpo -c -o zardoz.o zardoz.c
mv -f .deps/zardoz.Tpo .deps/zardoz.Po
gcc  -g -O2   -o qux.test.exe zardoz.o  
make[1]: Leaving directory 
`/home/peda/automake/tests/parallel-tests-fd-redirect.dir'
make  check-TESTS check-local
make[1]: Entering directory 
`/home/peda/automake/tests/parallel-tests-fd-redirect.dir'
make[2]: Entering directory 
`/home/peda/automake/tests/parallel-tests-fd-redirect.dir'
 foofoofoo
PASS: foo.sh
 barbarbar
PASS: bar
PASS: baz.exe
PASS: qux.test.exe
============================================================================
Testsuite summary for parallel-tests-fd-redirect 1.0
============================================================================
# TOTAL: 4
# PASS:  4
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[2]: Leaving directory 
`/home/peda/automake/tests/parallel-tests-fd-redirect.dir'
make[1]: Nothing to be done for `check-local'.
make[1]: Leaving directory 
`/home/peda/automake/tests/parallel-tests-fd-redirect.dir'
+ cat foo.log
+ cat bar.log
+ cat baz.log
+ cat qux.log
+ test 0 -eq 0
+ grep '^ foofoofoo$' stdout
 foofoofoo
+ grep '^ barbarbar$' stdout
 barbarbar
+ grep '^ bazbazbaz$' stdout
+ exit_status=1
+ set +e
+ cd /home/peda/automake/tests
+ test no = yes
+ case $am_explicit_skips in
+ test 1 -eq 0
+ keep_testdirs=yes
+ am_keeping_testdirs
+ case $keep_testdirs in
+ return 0
+ set +x
parallel-tests-fd-redirect: exit 1





reply via email to

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