aboutsummaryrefslogtreecommitdiff
path: root/t/inotifywait-daemon-logs-to-relative-paths.t
blob: a3bafa44619f095a64940aa94b395a271bae3948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

test_description='Issue #62

When --daemon is used, events are logged correctly to --outfile
even if that is a relative path
'

. ./sharness.sh

logfile="log"

run_() {
    # Setup code, defer an ATTRIB event for after
    # inotifywait has been set up.
    timeout=2 &&
    touch $logfile test-file &&
    {(sleep 1 && chmod 777 test-file)&} &&

    export LD_LIBRARY_PATH="../../libinotifytools/src/.libs/"
    ../../src/.libs/inotifywait \
        --quiet \
        --daemon \
        --outfile $logfile \
        --event ATTRIB \
        --timeout $timeout \
        $(realpath test-file) &&
    # No way to use 'wait' for a process that is not a child of this one,
    # sleep instead until inotifywait's timeout is reached.
    sleep $timeout
}

test_expect_success 'event logged' '
    run_ &&
    grep ATTRIB $logfile
'

test_done