Last active
October 6, 2016 14:54
-
-
Save lehnerpat/570ee9d94cea6e0e8ebc to your computer and use it in GitHub Desktop.
Test and comparison of inotifywait vs. inotify-win output and exclusion pattern application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################ | |
## TEST GROUP 1: simple events, watching absolute path | |
############################################################ | |
{$ inotifywait -qmr /tmp/inwtest/} | |
[/tmp/inwtest]$ touch testfile | |
/tmp/inwtest/ CREATE testfile | |
/tmp/inwtest/ OPEN testfile | |
/tmp/inwtest/ ATTRIB testfile | |
/tmp/inwtest/ CLOSE_WRITE,CLOSE testfile | |
[/tmp/inwtest]$ mkdir testdir | |
/tmp/inwtest/ CREATE,ISDIR testdir | |
/tmp/inwtest/ OPEN,ISDIR testdir | |
/tmp/inwtest/ CLOSE_NOWRITE,CLOSE,ISDIR testdir | |
[/tmp/inwtest]$ echo "what" > testfile | |
/tmp/inwtest/ MODIFY testfile | |
/tmp/inwtest/ OPEN testfile | |
/tmp/inwtest/ MODIFY testfile | |
/tmp/inwtest/ CLOSE_WRITE,CLOSE testfile | |
[/tmp/inwtest]$ mv testfile otherfile | |
/tmp/inwtest/ MOVED_FROM testfile | |
/tmp/inwtest/ MOVED_TO otherfile | |
############################################################ | |
## TEST GROUP 2: watching relative path (current dir) | |
############################################################ | |
# TEST 2a: no exclusion pattern | |
{[/tmp/inwtest]$ inotifywait -qmr .} | |
[/tmp/inwtest]$ mv otherfile testdir/ | |
./ MOVED_FROM otherfile | |
./testdir/ MOVED_TO otherfile | |
[/tmp/inwtest]$ mkdir -p testdir/2dir/3dir | |
./testdir/ CREATE,ISDIR 2dir | |
./testdir/ OPEN,ISDIR 2dir | |
./testdir/ CLOSE_NOWRITE,CLOSE,ISDIR 2dir | |
./testdir/ OPEN,ISDIR 2dir | |
./testdir/ CLOSE_NOWRITE,CLOSE,ISDIR 2dir | |
[/tmp/inwtest]$ touch testdir/2dir/3dir/subfile | |
./testdir/2dir/3dir/ CREATE subfile | |
./testdir/2dir/3dir/ OPEN subfile | |
./testdir/2dir/3dir/ ATTRIB subfile | |
./testdir/2dir/3dir/ CLOSE_WRITE,CLOSE subfile | |
------------------------------------------------------------ | |
# Test 2b | |
{[/tmp/inwtest]$ mkdir .git} | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '^\.git/' .} | |
[/tmp/inwtest]$ touch .git/gitfile | |
./.git/ CREATE gitfile | |
./.git/ OPEN gitfile | |
./.git/ ATTRIB gitfile | |
./.git/ CLOSE_WRITE,CLOSE gitfile | |
------------------------------------------------------------ | |
# Test 2c | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '\.git/' .} | |
[/tmp/inwtest]$ touch .git/gitfile | |
# no output | |
------------------------------------------------------------ | |
# Test 2d | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '^\./\.git/' .} | |
[/tmp/inwtest]$ touch .git/gitfile | |
# no output | |
------------------------------------------------------------ | |
# Test 2e | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude 'inwtest/\.git/' .} | |
[/tmp/inwtest]$ touch .git/gitfile | |
./.git/ OPEN gitfile | |
./.git/ ATTRIB gitfile | |
./.git/ CLOSE_WRITE,CLOSE gitfile | |
# because prefix is not resolved/canonicalized | |
------------------------------------------------------------ | |
# Test 2f | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '\.git/gitfile$' .} | |
[/tmp/inwtest]$ touch .git/gitfile | |
# no output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Note: commands were run in bash, thus the forward-slash syntax | |
############################################################ | |
## TEST GROUP 1: simple events, watching absolute path | |
############################################################ | |
{$ inotifywait.exe -qmr /d/tmp/inwtest/} | |
[/d/tmp/inwtest]$ touch testfile | |
d:\tmp\inwtest\ CREATE testfile | |
[/d/tmp/inwtest]$ mkdir testdir | |
d:\tmp\inwtest\ CREATE testdir | |
[/d/tmp/inwtest]$ echo "what" > testfile | |
d:\tmp\inwtest\ MODIFY testfile | |
[/d/tmp/inwtest]$ mv testfile otherfile | |
d:\tmp\inwtest\ MOVE_FROM testfile | |
d:\tmp\inwtest\ MOVE_TO otherfile | |
############################################################ | |
## TEST GROUP 2: watching relative path (current dir) | |
############################################################ | |
# TEST 2a: no exclusion pattern | |
{[/d/tmp/inwtest]$ inotifywait.exe -qmr .} | |
[/d/tmp/inwtest]$ mv otherfile testdir/ | |
d:\tmp\inwtest DELETE otherfile | |
[/d/tmp/inwtest]$ mkdir -p testdir/2dir/3dir | |
d:\tmp\inwtest CREATE testdir\2dir | |
[/d/tmp/inwtest]$ touch testdir/2dir/3dir/subfile | |
d:\tmp\inwtest CREATE testdir\2dir\3dir\subfile | |
------------------------------------------------------------ | |
# Test 2b | |
{[/d/tmp/inwtest]$ mkdir .git} | |
{[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '^\.git\\' .} | |
[/d/tmp/inwtest]$ touch .git/gitfile | |
# no output | |
------------------------------------------------------------ | |
# Test 2c | |
{[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '\.git\\' .} | |
[/d/tmp/inwtest]$ touch .git/gitfile | |
# no output | |
------------------------------------------------------------ | |
# Test 2d | |
{[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '^\.\\\.git\\' .} | |
[/d/tmp/inwtest]$ touch .git/gitfile | |
d:\tmp\inwtest MODIFY .git\gitfile | |
------------------------------------------------------------ | |
# Test 2e | |
{[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude 'inwtest\\\.git\\' .} | |
[/d/tmp/inwtest]$ touch .git/gitfile | |
d:\tmp\inwtest MODIFY .git\gitfile | |
# because full path is not used for matching | |
------------------------------------------------------------ | |
# Test 2f | |
{[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '\.git\\gitfile$' .} | |
[/d/tmp/inwtest]$ touch .git/gitfile | |
# no output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------------------------------------------------|------------------------------------------------------------------------- | |
Linux (Bash) | Windows (Git Bash) | |
----------------------------------------------------------------|------------------------------------------------------------------------- | |
| | |
############################################################ | |
## TEST GROUP 1: simple events, watching absolute path ## | |
############################################################ | |
| | |
{$ inotifywait -qmr /tmp/inwtest/} | {$ inotifywait.exe -qmr /d/tmp/inwtest/} | |
| | |
[/tmp/inwtest]$ touch testfile | [/d/tmp/inwtest]$ touch testfile | |
| | |
/tmp/inwtest/ CREATE testfile | d:\tmp\inwtest\ CREATE testfile | |
/tmp/inwtest/ OPEN testfile | | |
/tmp/inwtest/ ATTRIB testfile | | |
/tmp/inwtest/ CLOSE_WRITE,CLOSE testfile | | |
| | |
[/tmp/inwtest]$ mkdir testdir | [/d/tmp/inwtest]$ mkdir testdir | |
| | |
/tmp/inwtest/ CREATE,ISDIR testdir | d:\tmp\inwtest\ CREATE testdir | |
/tmp/inwtest/ OPEN,ISDIR testdir | | |
/tmp/inwtest/ CLOSE_NOWRITE,CLOSE,ISDIR testdir | | |
| | |
[/tmp/inwtest]$ echo "what" > testfile | [/d/tmp/inwtest]$ echo "what" > testfile | |
| | |
/tmp/inwtest/ MODIFY testfile | d:\tmp\inwtest\ MODIFY testfile | |
/tmp/inwtest/ OPEN testfile | | |
/tmp/inwtest/ MODIFY testfile | | |
/tmp/inwtest/ CLOSE_WRITE,CLOSE testfile | | |
| | |
[/tmp/inwtest]$ mv testfile otherfile | [/d/tmp/inwtest]$ mv testfile otherfile | |
| | |
/tmp/inwtest/ MOVED_FROM testfile | d:\tmp\inwtest\ MOVE_FROM testfile | |
/tmp/inwtest/ MOVED_TO otherfile | d:\tmp\inwtest\ MOVE_TO otherfile | |
| | |
| | |
############################################################ | |
################################### ## TEST GROUP 2: watching relative path (current dir) ## ######################################### | |
############################################################ | |
| | |
### TEST 2a: no exclusion pattern ### | |
| | |
| | |
{[/tmp/inwtest]$ inotifywait -qmr .} | {[/d/tmp/inwtest]$ inotifywait.exe -qmr .} | |
| | |
# 2a1 | # 2a1 | |
[/tmp/inwtest]$ mv otherfile testdir/ | [/d/tmp/inwtest]$ mv otherfile testdir/ | |
| | |
./ MOVED_FROM otherfile | d:\tmp\inwtest DELETE otherfile | |
./testdir/ MOVED_TO otherfile | | |
| | |
# 2a2 | # 2a2 | |
[/tmp/inwtest]$ mkdir -p testdir/2dir/3dir | [/d/tmp/inwtest]$ mkdir -p testdir/2dir/3dir | |
| | |
./testdir/ CREATE,ISDIR 2dir | d:\tmp\inwtest CREATE testdir\2dir | |
./testdir/ OPEN,ISDIR 2dir | | |
./testdir/ CLOSE_NOWRITE,CLOSE,ISDIR 2dir | | |
./testdir/ OPEN,ISDIR 2dir | | |
./testdir/ CLOSE_NOWRITE,CLOSE,ISDIR 2dir | | |
| | |
# 2a3 | # 2a3 | |
[/tmp/inwtest]$ touch testdir/2dir/3dir/subfile | [/d/tmp/inwtest]$ touch testdir/2dir/3dir/subfile | |
| | |
./testdir/2dir/3dir/ CREATE subfile | d:\tmp\inwtest CREATE testdir\2dir\3dir\subfile | |
./testdir/2dir/3dir/ OPEN subfile | | |
./testdir/2dir/3dir/ ATTRIB subfile | | |
./testdir/2dir/3dir/ CLOSE_WRITE,CLOSE subfile | | |
| | |
----------------------------------------------------------------|------------------------------------------------------------------------- | |
| | |
### Test 2b ### | |
| | |
| | |
{[/tmp/inwtest]$ mkdir .git} | {[/d/tmp/inwtest]$ mkdir .git} | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '^\.git/' .} | {[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '^\.git\\' .} | |
| | |
[/tmp/inwtest]$ touch .git/gitfile | [/d/tmp/inwtest]$ touch .git/gitfile | |
| | |
./.git/ CREATE gitfile | # no output | |
./.git/ OPEN gitfile | | |
./.git/ ATTRIB gitfile | | |
./.git/ CLOSE_WRITE,CLOSE gitfile | | |
| | |
----------------------------------------------------------------|------------------------------------------------------------------------- | |
| | |
### Test 2c ### | |
| | |
| | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '\.git/' .} | {[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '\.git\\' .} | |
| | |
[/tmp/inwtest]$ touch .git/gitfile | [/d/tmp/inwtest]$ touch .git/gitfile | |
| | |
# no output | # no output | |
| | |
----------------------------------------------------------------|------------------------------------------------------------------------- | |
| | |
### Test 2d ### | |
| | |
| | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '^\./\.git/' .} | {[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '^\.\\\.git\\' .} | |
| | |
[/tmp/inwtest]$ touch .git/gitfile | [/d/tmp/inwtest]$ touch .git/gitfile | |
| | |
# no output | d:\tmp\inwtest MODIFY .git\gitfile | |
| | |
----------------------------------------------------------------|------------------------------------------------------------------------- | |
| | |
### Test 2e ### | |
| | |
| | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude 'inwtest/\.git/' .} | {[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude 'inwtest\\\.git\\' .} | |
| | |
[/tmp/inwtest]$ touch .git/gitfile | [/d/tmp/inwtest]$ touch .git/gitfile | |
| | |
./.git/ OPEN gitfile | d:\tmp\inwtest MODIFY .git\gitfile | |
./.git/ ATTRIB gitfile | # because full path is not used for matching | |
./.git/ CLOSE_WRITE,CLOSE gitfile | | |
# because prefix is not resolved/canonicalized | | |
| | |
----------------------------------------------------------------|------------------------------------------------------------------------- | |
| | |
### Test 2f ### | |
| | |
| | |
{[/tmp/inwtest]$ inotifywait -qmr --exclude '\.git/gitfile$' .} | {[/d/tmp/inwtest]$ inotifywait.exe -qmr --exclude '\.git\\gitfile$' .} | |
| | |
[/tmp/inwtest]$ touch .git/gitfile | [/d/tmp/inwtest]$ touch .git/gitfile | |
| | |
# no output | # no output | |
| | |
----------------------------------------------------------------|------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment