diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/06_dir_diff.sh | 33 | ||||
-rwxr-xr-x | tests/07_dir_add_remove.sh | 29 | ||||
-rw-r--r-- | tests/test_lib.sh | 5 |
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/06_dir_diff.sh b/tests/06_dir_diff.sh new file mode 100755 index 0000000..36fed65 --- /dev/null +++ b/tests/06_dir_diff.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +TEST_ID="06" +TEST_NAME="Dir difference" + +CREATE=`pwd`/$1 +DEPLOY=`pwd`/$2 +TEST_TOOLS=$3 + +. ./test_lib.sh + +############# Test specific code ############ + +function setup { + mkdir $ORIGIN/a && \ + mkdir $TARGET/a && \ + echo "1" > $TARGET/a/1 && \ + chown -h :cdrom $TARGET/a && \ + chmod 707 $TARGET/a +} + +function check_results { + test -d $ORIGIN/a && \ + test -f $ORIGIN/a && \ + check_same_mode $ORIGIN/a $TARGET/a && \ + check_same_uidgid $ORIGIN/a $TARGET/a && \ + check_same_mode $ORIGIN/a/1 $TARGET/a/1 && \ + check_same_uidgid $ORIGIN/a/1 $TARGET/a/1 && \ + check_content $ORIGIN/a/1 "1" +} + +############################################# +main $@ diff --git a/tests/07_dir_add_remove.sh b/tests/07_dir_add_remove.sh new file mode 100755 index 0000000..e141351 --- /dev/null +++ b/tests/07_dir_add_remove.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +TEST_ID="05" +TEST_NAME="Symlink add/remove" + +CREATE=`pwd`/$1 +DEPLOY=`pwd`/$2 +TEST_TOOLS=$3 + +. ./test_lib.sh + +############# Test specific code ############ + +function setup { + mkdir $ORIGIN/remove && \ + mkdir $TARGET/add && \ + chown -h :cdrom $TARGET/add +} + +function check_results { + test -d $ORIGIN/add && \ + test ! -d $ORIGIN/remove && \ + check_same_mtime $ORIGIN/add $TARGET/add && \ + check_same_mode $ORIGIN/add $TARGET/add && \ + check_same_uidgid $ORIGIN/add $TARGET/add +} + +############################################# +main $@ diff --git a/tests/test_lib.sh b/tests/test_lib.sh index d9c30d9..342ee39 100644 --- a/tests/test_lib.sh +++ b/tests/test_lib.sh @@ -16,6 +16,11 @@ function check_same_uidgid { test $(stat -c "%u.%g" $1) = $(stat -c "%u.%g" $2) } +# check_same_mode FILE_A FILE_B +function check_same_mode { + test $(stat -c "%f" $1) = $(stat -c "%f" $2) +} + # check_content FILE EXPECTED_OCTAL_PERMISSIONS function check_perm { test $(stat -c %a $1) = $2 |