redmine

Try to add "coverage test"

... ... @@ -52,4 +52,8 @@ Makefile.in
/autoscan.log
/configure.scan
# coverage test files
/*.gcda
/*.gcno
/*.gcov
... ...
#!/bin/bash
# configuration
TIMEOUT_SYNC=15
# test aggressive optimizations
export CFLAGS="-O3 -march=native"
autoreconf -if
... ... @@ -15,6 +19,71 @@ build_test() {
}
}
# Cleanup functions for run_example()
run_example_cleanup_success() {
pkill -F "$CLSYNC_PIDFILE"
}
run_example_cleanup_failure() {
pkill -F "$CLSYNC_PIDFILE"
exit 1
}
# Run example script
run_example() {
MODE="$1"
export CLSYNC_PIDFILE="/tmp/clsync-example-$MODE.pid"
CONFIGFILE="/tmp/clsync-example-$MODE.conf"
rm -rf "examples/testdir"/{to,from}/*
mkdir -p "examples/testdir/to"
trap run_example_cleanup_failure INT TERM
touch "$CONFIGFILE"
cd examples
bash -x clsync-start-"$MODE".sh --background --pid-file "$CLSYNC_PIDFILE" --config-file "$CONFIGFILE" -w1 -t1
cd -
rm -f "$CONFIGFILE"
sleep 1
mkdir -p examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/DIR
touch examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/{a,b,c,d,e,f,g,h}
touch examples/testdir/from/a/b/c/d/e/f/g/h/a
touch examples/testdir/from/test
mkdir examples/testdir/from/dontSync
i=0
while [ "$i" -le "$TIMEOUT_SYNC" ]; do
if [ -f "examples/testdir/to/test" -a -f "examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/a" -a -d "examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/DIR" ]; then
sleep 1
break
fi
sleep 1
(( i++ ))
done
if [ "$i" -gt "$TIMEOUT_SYNC" ]; then
run_example_cleanup_failure
fi
if ! [ -f "$CLSYNC_PIDFILE" ]; then
run_example_cleanup_failure
fi
touch "examples/testdir/from/file" "examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/DIR/file"
rm -rf "examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/DIR"
i=0
while [ "$i" -le "$TIMEOUT_SYNC" ]; do
if ! [ -f "$CLSYNC_PIDFILE" ]; then
run_example_cleanup_failure
fi
if [ -f "examples/testdir/to/file" -a ! -d "examples/testdir/from/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/DIR" ]; then
sleep 1
run_example_cleanup_success
return
fi
sleep 1
(( i++ ))
done
run_example_cleanup_failure
}
# Test all possible package-specific configure options.
# Do not test empty cases save as no options at all.
build_test ${arg[@]}
... ... @@ -37,3 +106,15 @@ done
done
done
done
# Test coverage
export CFLAGS="$CFLAGS --coverage -O0"
export PATH=".:$PATH"
build_test --enable-cluster --enable-debug --enable-paranoid=2 --with-capabilities --without-mhash
run_example rsyncdirect
run_example rsyncshell
run_example rsyncso
#run_example so
#run_example cluster
exit 0
... ...
language: c
before_install:
- sudo apt-get install libcap-dev libglib2.0-dev libmhash-dev
- sudo pip install cpp-coveralls --use-mirrors
script:
- ./.travis.sh
after_success:
- coveralls --exclude examples --exclude debian --exclude gentoo --exclude autom4te.cache --exclude man --exclude conf*.dir
... ...
... ... @@ -22,5 +22,5 @@ cat > rules <<EOF
+*.*
EOF
clsync -K example-cluster -c "$IPADDR" -M rsyncshell -L ./testdir/listdir -w 2 -p -t 5 -W ./testdir/from -S ./clsync-synchandler-rsync.sh -R rules
clsync -K example-cluster -c "$IPADDR" -M rsyncshell -L ./testdir/listdir -w 2 -p -t 5 -W ./testdir/from -S ./clsync-synchandler-rsync.sh -R rules $@
... ...
... ... @@ -7,5 +7,5 @@ cat > rules <<EOF
+*.*
EOF
clsync -K example-simple -M rsyncdirect -L ./testdir/listdir -w2 -p -t5 -W ./testdir/from -S `which rsync` -R rules -D ./testdir/to
clsync -K example-simple -M rsyncdirect -L ./testdir/listdir -w2 -p -t5 -W ./testdir/from -S `which rsync` -R rules -D ./testdir/to $@
... ...
... ... @@ -7,5 +7,5 @@ cat > rules <<EOF
+*.*
EOF
clsync -K example-rsync -l test -M rsyncshell -L ./testdir/listdir -w2 -p -t5 -W ./testdir/from -S ./clsync-synchandler-rsyncshell.sh -R rules
clsync -K example-rsync -l test -M rsyncshell -L ./testdir/listdir -w2 -p -t5 -W ./testdir/from -S ./clsync-synchandler-rsyncshell.sh -R rules $@
... ...
... ... @@ -9,5 +9,5 @@ EOF
gcc -ggdb3 -fPIC -shared -o clsync-synchandler-rsyncso.so clsync-synchandler-rsyncso.c &&
clsync -K example-rsyncso -M rsyncso -L /dev/shm/clsync -w2 -t5 -W ./testdir/from -S ./clsync-synchandler-rsyncso.so -R rules -D ./testdir/to
clsync -K example-rsyncso -M rsyncso -L /dev/shm/clsync -w2 -t5 -W ./testdir/from -S ./clsync-synchandler-rsyncso.so -R rules -D ./testdir/to $@
... ...
... ... @@ -9,5 +9,5 @@ EOF
gcc -ggdb3 -fPIC -shared -o clsync-synchandler-so.so clsync-synchandler-so.c &&
clsync -K example-so -M so -w2 -t5 -W ./testdir/from -S ./clsync-synchandler-so.so -R rules -D ./testdir/to
clsync -K example-so -M so -w2 -t5 -W ./testdir/from -S ./clsync-synchandler-so.so -R rules -D ./testdir/to $@
... ...
... ... @@ -887,7 +887,7 @@ int main(int argc, char *argv[]) {
main_status_update(&options, STATE_STARTING);
#ifdef VERYPARANOID
if((options.flags[RETRIES] != 1) && options.flags[PTHREAD]) {
if((options.retries != 1) && options.flags[PTHREAD]) {
printf_e("Error: \"--retries\" values should be equal to \"1\" for \"--pthread\" mode.\n");
ret = EINVAL;
}
... ...