"Fossies" - the Fresh Open Source Software Archive

Member "gnuastro-0.8/bootstrapped/tests/test-select-in.sh" (28 Dec 2018, 945 Bytes) of package /linux/privat/gnuastro-0.8.tar.lz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 # Test select() on file descriptors opened for reading.
    3 
    4 # This test is known to fail on Solaris 2.6 and older, due to its handling
    5 # of /dev/null.
    6 
    7 tmpfiles=""
    8 trap 'rm -fr $tmpfiles' 1 2 3 15
    9 
   10 tmpfiles="$tmpfiles t-select-in.tmp"
   11 
   12 # Regular files.
   13 
   14 rm -f t-select-in.tmp
   15 ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT}
   16 test `cat t-select-in.tmp` = "1" || exit 1
   17 
   18 # Pipes.
   19 
   20 rm -f t-select-in.tmp
   21 { sleep 1; echo abc; } | \
   22   { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; }
   23 test `cat t-select-in.tmp` = "0" || exit 1
   24 
   25 rm -f t-select-in.tmp
   26 echo abc | { sleep 1; ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; }
   27 test `cat t-select-in.tmp` = "1" || exit 1
   28 
   29 # Special files.
   30 # This part of the test is known to fail on Solaris 2.6 and older.
   31 
   32 rm -f t-select-in.tmp
   33 ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null
   34 test `cat t-select-in.tmp` = "1" || exit 1
   35 
   36 rm -fr $tmpfiles
   37 
   38 exit 0