From: Eric Blake Date: 2013年3月12日 23:23:30 +0000 (-0600) Subject: build: avoid test failure on HPUX X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7044c45b704482ee62d1edf3a2f3dc81c6115d60;p=m4.git build: avoid test failure on HPUX POSIX permits implementations to open fd 0, 1, and 2 on exec(), even when the user tried to close them. HPUX-11.23 is one of the implementations that does not allow closed standard descriptors, leading to a failure of test 005.command_li. But a test that makes sure we behave gracefully in the face of closed standard descriptors makes no sense on a platform where we can never have them closed, so add some code to skip the test on "helpful" platforms. Note - HPUX opens any closed standard descriptor as O_WRONLY on /dev/null. This means that attempts to close stdout generally result in silent success, but attempts to close stdin often still result in failure when it is not possible to read from the O_WRONLY stdin. * doc/m4.texi (Command line files): Skip tests on systems where it is impossible to start with stdin/out closed. Reported by Gary V. Vaughan. Signed-off-by: Eric Blake --- diff --git a/doc/m4.texi b/doc/m4.texi index f262a7b4..801f9f94 100644 --- a/doc/m4.texi +++ b/doc/m4.texi @@ -1129,6 +1129,70 @@ If you need to read a file whose name starts with a @file{-}, you can specify it as @samp{./-file}, or use @option{--} to mark the end of options. +@ignore +@comment Test that 'm4 file/' detects that file is not a directory; we +@comment can assume that the current directory contains a Makefile. +@comment mingw fails with EINVAL rather than ENOTDIR. + +@comment status: 1 +@comment xerr: ignore +@comment options: Makefile/ +@example +@error{}m4: cannot open file 'Makefile/': No such file or directory +@end example + +@comment Test that closed stderr does not cause a crash. Not all +@comment systems have the same message for EBADF. + +@comment xerr: ignore +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`echo | cat>&- 2>/dev/null')ifelse(sysval, `0', + `errprint(` skipping: system does not allow closing stdout +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo | ']__program__['>&-])dnl +@error{}m4: write error: Bad file descriptor +sysval +@result{}1 +@end example + +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`echo | cat>&- 2>/dev/null')ifelse(sysval, `0', + `errprint(` skipping: system does not allow closing stdout +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo 'esyscmd(echo hi>&2 && echo err"print(bye +)d"nl)dnl'> tmp.m4 \ + && ']__program__[' tmp.m4 <&->&- \ + && rm tmp.m4])sysval +@error{}hi +@error{}bye +@result{}0 +@end example + +@comment Test that we obey POSIX semantics with -D interspersed with +@comment files, even with POSIXLY_CORRECT (BSD getopt gets it wrong). + +$ @kbd{m4 } +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([POSIXLY_CORRECT=1 ']__program__[' -Dbar=hello foo -Dbar=world foo])dnl +@result{}hello +@result{}world +sysval +@result{}0 +@end example +@end ignore + @node Syntax @chapter Lexical and syntactic conventions

AltStyle によって変換されたページ (->オリジナル) /