-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
231 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.gcno | ||
*.gcda |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
language: c | ||
|
||
compiler: | ||
- clang | ||
- gcc | ||
|
||
env: | ||
- CC_FLAGS="-O3 -Wall -std=c99 -D_BSD_SOURCE -D_XOPEN_SOURCE=500" | ||
- COVERAGE=yes CC_FLAGS="-O3 -Wall --coverage -std=c99 -D_BSD_SOURCE -D_XOPEN_SOURCE=500" | ||
|
||
before_install: | ||
- pip install --user cpp-coveralls | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq libc6-dev-i386 | ||
|
||
script: | ||
- ./compile.sh | ||
- cd t | ||
- ./suite.sh | ||
- cd .. | ||
|
||
after_success: | ||
- if [ x"$COVERAGE" = "xyes" ]; then ~/.local/bin/coveralls -b $PWD ; fi |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
COMPILER=clang | ||
#COMPILER=gcc | ||
echo "compiling 32-bit version" | ||
$COMPILER -m32 $CC_FLAGS -o fsnotifier main.c inotify.c util.c | ||
if [ $? -eq 0 ] ; then | ||
echo "compiling 64-bit version" | ||
$COMPILER -m64 $CC_FLAGS -o fsnotifier64 main.c inotify.c util.c | ||
if [ $? -eq 0 ] ; then | ||
chmod 755 fsnotifier fsnotifier64 | ||
fi | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
export CC_FLAGS="-O3 -Wall --coverage -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=500" | ||
./compile.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
#!/bin/sh | ||
CC_FLAGS="-O0 -g -Wall -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=500" | ||
echo "compiling 32-bit version" | ||
clang -m32 $CC_FLAGS -o fsnotifier main.c inotify.c util.c | ||
if [ $? -eq 0 ] ; then | ||
echo "compiling 64-bit version" | ||
clang -m64 $CC_FLAGS -o fsnotifier64 main.c inotify.c util.c | ||
if [ $? -eq 0 ] ; then | ||
chmod 755 fsnotifier fsnotifier64 | ||
fi | ||
fi | ||
./compile.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
#!/bin/sh | ||
CC_FLAGS="-O3 -Wall -std=c99 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=500" | ||
echo "compiling 32-bit version" | ||
clang -m32 $CC_FLAGS -o fsnotifier main.c inotify.c util.c | ||
if [ $? -eq 0 ] ; then | ||
echo "compiling 64-bit version" | ||
clang -m64 $CC_FLAGS -o fsnotifier64 main.c inotify.c util.c | ||
if [ $? -eq 0 ] ; then | ||
chmod 755 fsnotifier fsnotifier64 | ||
fi | ||
fi | ||
./compile.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# compile with coverage support | ||
.coverage.sh | ||
|
||
# run test suite | ||
cd t | ||
./suite.sh | ||
cd .. | ||
|
||
# txt report | ||
gcov -abcfu *.c | ||
#cat *.gcov | ||
|
||
# html report | ||
lcov --directory . --capture --output-file app.info | ||
genhtml --output-directory cov_html app.info | ||
#xdg-open cov_html/index.html |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test*.out |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
#!/bin/bash | ||
|
||
./test1.sh | sed 's+'$PWD'/++' > test1.out | ||
function colorecho() { | ||
echo -e "\x1b[$1m$2\x1b[m" | ||
} | ||
|
||
diff test1.ok test1.out | ||
for test in $(ls test*.sh | sort --version-sort) | ||
do | ||
basename_test=$(basename ${test} .sh) | ||
title=$(grep "###" $test | sed 's/^###\s*//') | ||
tmpdir=$(mktemp -d "${basename_test}.XXX") | ||
cd ${tmpdir} | ||
../${test} | sed 's+'$PWD'/++' > ../${basename_test}.out | ||
cd .. | ||
rm -rf ${tmpdir} | ||
diff ${basename_test}.ok ${basename_test}.out | ||
if [ "$?" == 0 ] | ||
then | ||
echo $(colorecho 34 ${basename_test}) "${title}" $(colorecho 32 ok) | ||
else | ||
echo $(colorecho 34 ${basename_test}) "${title}" $(colorecho 31 ko) | ||
fi | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
UNWATCHEABLE | ||
# | ||
CREATE | ||
test1/foo | ||
foo | ||
CHANGE | ||
test1/foo | ||
foo | ||
STATS | ||
test1/foo | ||
foo | ||
CHANGE | ||
test1/foo | ||
foo | ||
DELETE | ||
test1/foo | ||
foo | ||
CREATE | ||
test1/bar | ||
bar | ||
CHANGE | ||
test1/bar | ||
bar | ||
DELETE | ||
test1/bar | ||
DELETE | ||
test1 | ||
bar |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
|
||
trap 'kill $(jobs -p)' EXIT | ||
|
||
mkdir test1 | ||
### basic operations | ||
|
||
../fsnotifier64 --background --roots $PWD/test1 & | ||
../../fsnotifier64 --background --roots $PWD & | ||
|
||
sleep 1 | ||
|
||
cd test1 | ||
touch foo | ||
echo foobar > foo | ||
mv foo bar | ||
rm bar | ||
|
||
sleep 1 | ||
|
||
cd .. | ||
rm -rf test1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fsnotifier 20130715.1353 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
### show --help | ||
|
||
../../fsnotifier64 --version | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
UNWATCHEABLE | ||
# | ||
UNWATCHEABLE | ||
# | ||
UNWATCHEABLE | ||
# | ||
UNWATCHEABLE | ||
# | ||
UNWATCHEABLE | ||
# |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
trap 'kill $(jobs -p)' EXIT | ||
|
||
### log level configuration | ||
|
||
../../fsnotifier64 --background --roots $PWD --log-level debug & | ||
../../fsnotifier64 --background --roots $PWD --log-level info & | ||
../../fsnotifier64 --background --roots $PWD --log-level warning & | ||
../../fsnotifier64 --background --roots $PWD --log-level error & | ||
../../fsnotifier64 --background --roots $PWD --log-level off & | ||
|
||
sleep 3 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
info: started (self-test mode) (v.20130715.1353) | ||
debug: inotify fd: 4 | ||
info: updating roots (curr:0, new:1) | ||
info: registering root: | ||
debug: watching : 1 | ||
info: unregistering root: | ||
debug: unwatching : 1 () | ||
info: finished (0) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
### self test | ||
|
||
../../fsnotifier64 --selftest |& \ | ||
sed 's/^fsnotifier\[[0-9]\+\] //' | \ | ||
sed 's+'$PWD'++' | \ | ||
sed 's+\(debug: unwatching : 1 (\).*)+\1)+' | \ | ||
sed '/mtab/d' | \ | ||
sed '/inotify watch descriptors/d' | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
unrecognized option: --wrong-option | ||
Try 'fsnotifier --help' for more information. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
### wrong options | ||
|
||
../../fsnotifier64 --wrong-option & |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
running in background needs the --roots option to be set |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
### --background option needs --roots option | ||
|
||
../../fsnotifier64 --background & |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
unrecognized option: background | ||
Try 'fsnotifier --help' for more information. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
### watch / is not allowed | ||
|
||
../../fsnotifier64 --roots / background & |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
UNWATCHEABLE | ||
# | ||
DELETE | ||
temp/temp | ||
CREATE | ||
temp/temp | ||
CHANGE | ||
temp/temp |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
trap 'kill $(jobs -p)' EXIT | ||
|
||
### remove and restore root | ||
|
||
mkdir -p temp/temp | ||
|
||
../../fsnotifier64 --background --roots $PWD/temp/temp --log-level debug & | ||
|
||
sleep 2 | ||
|
||
rmdir temp/temp | ||
mkdir temp/temp | ||
|
||
sleep 2 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
UNWATCHEABLE | ||
# | ||
RESET |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
trap 'kill $(jobs -p)' EXIT | ||
|
||
### reset event | ||
|
||
mkdir mnt | ||
sudo mount -ttmpfs none mnt | ||
|
||
../../fsnotifier64 --background --roots $PWD/mnt --log-level debug & | ||
|
||
sleep 2 | ||
|
||
sudo fuser -vm mnt | ||
sudo umount -f mnt | ||
|
||
sleep 2 | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
fsnotifier - IntelliJ IDEA companion program for watching and reporting file and directory structure modifications. | ||
|
||
fsnotifier utilizes "user" facility of syslog(3) - messages usually can be found in /var/log/user.log. | ||
Verbosity is regulated via FSNOTIFIER_LOG_LEVEL environment variable, possible values are: debug, info, warning, error, off; default is warning. | ||
|
||
Options: | ||
--selftest perform some self-diagnostics (output will be logged and printed to console). | ||
--log-level Explicit set of log level. | ||
--roots Paths to inspect. Values separated by comma. Relative or absolute. | ||
--background execute in background. Do not read input. | ||
--version fsnotifier version. | ||
--help Show this help. | ||
|
||
Usage: | ||
$ ./fsnotifier | ||
ROOTS | ||
<path to watch> | ||
# | ||
|
||
From here file changes comes as a two line events | ||
|
||
EVENT | ||
file/path/changed | ||
|
||
Events: | ||
CREATE, CHANGE, STATS, DELETE, RESET | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
### show --help | ||
|
||
../../fsnotifier64 --help | ||
|