"Fossies" - the Fresh Open Source Software Archive

Member "inotify-tools-3.20.11.0/t/inotifywait-daemon-logs-chown.t" (13 Nov 2020, 855 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/sh
    2 
    3 test_description='Issue #62
    4 
    5 When --daemon is used, events are logged correctly to --outfile
    6 even if that is a relative path
    7 '
    8 
    9 . ./sharness.sh
   10 
   11 logfile="log"
   12 
   13 run_() {
   14     # Setup code, defer an ATTRIB event for after
   15     # inotifywait has been set up.
   16     timeout=2 &&
   17     touch $logfile test-file &&
   18     {(sleep 1 && chown $(id -u) test-file)&} &&
   19 
   20     export LD_LIBRARY_PATH="../../libinotifytools/src/.libs/"
   21     ../../src/.libs/inotifywait \
   22         --quiet \
   23         --daemon \
   24         --outfile $logfile \
   25         --event ATTRIB \
   26         --timeout $timeout \
   27         $(realpath test-file) &&
   28     # No way to use 'wait' for a process that is not a child of this one,
   29     # sleep instead until inotifywait's timeout is reached.
   30     sleep $timeout
   31 }
   32 
   33 test_expect_success 'event logged' '
   34     run_ &&
   35     grep ATTRIB $logfile
   36 '
   37 
   38 test_done