Mercurial > gnulib
view tests/test-select-out.sh @ 40086:d6de7c427079
stdopen: modernize and simplify
* lib/stdopen.c: Update copyright date
Do not include sys/types.h; no longer needed these days.
(stdopen): Use C99-style decl in loop. Return int errno
value, rather than just a bool. Do not worry about fd mismatches,
since the caller cares only if 0, 1, 2 are occupied.
* lib/stdopen.h: No need to include <stdbool.h>.
* m4/stdopen.m4: Remove.
* modules/stdopen: New file.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 05 Jan 2019 18:02:32 -0800 |
parents | 97fca29bb224 |
children | 8c1a17df67e0 |
line wrap: on
line source
#!/bin/sh # Test select() on file descriptors opened for writing. tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp" # Regular files. rm -f t-select-out.tmp ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out test `cat t-select-out.tmp` = "1" || exit 1 # Pipes. if false; then # This test fails on some platforms. rm -f t-select-out.tmp ( { echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null test `cat t-select-out.tmp` = "0" || exit 1 fi rm -f t-select-out.tmp ( { sleep 1; echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null test `cat t-select-out.tmp` = "1" || exit 1 # Special files. rm -f t-select-out.tmp ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null test `cat t-select-out.tmp` = "1" || exit 1 rm -fr $tmpfiles exit 0