"Fossies" - the Fresh Open Source Software Archive

Member "inotify-tools-3.20.11.0/t/inotifywait-format-option-null.t" (13 Nov 2020, 770 Bytes) of package /linux/privat/inotify-tools-3.20.11.0.tar.gz:


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 and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 test_description='Check producing NUL-delimited output'
    4 
    5 . ./sharness.sh
    6 
    7 logfile="log"
    8 
    9 run_() {
   10   touch $logfile
   11 
   12   export LD_LIBRARY_PATH="../../libinotifytools/src/.libs/"
   13 
   14   ../../src/.libs/inotifywait \
   15     --monitor \
   16     --quiet \
   17     --outfile $logfile \
   18     --format '%w%f%0' \
   19     --no-newline \
   20     --event create \
   21     --event moved_to \
   22     --event moved_from \
   23     $(realpath ./) &
   24 
   25   PID="$!"
   26   sleep 1
   27 
   28   touch test-file-src
   29 
   30   mv test-file-src test-file-dst
   31 
   32   sleep 1
   33 
   34   kill ${PID}
   35 }
   36 
   37 test_expect_success 'the output is delimited by NUL' \
   38     '
   39     set -e
   40     trap "set +e" RETURN
   41     run_
   42     srcfile="${PWD}/test-file-src"
   43     dstfile="${PWD}/test-file-dst"
   44 
   45     return $(printf "${srcfile}\0${srcfile}\0${dstfile}\0" | cmp -s "${logfile}")
   46     '
   47 
   48 test_done