summaryrefslogtreecommitdiff
path: root/tests/test_lib.sh
diff options
context:
space:
mode:
authorAlberto <alberto.ruiz@codethink.co.uk>2011-10-03 13:14:45 +0100
committerAlberto <alberto.ruiz@codethink.co.uk>2011-10-03 13:14:45 +0100
commitba0b5c9ea786d12a4c89e93a0c7f2d7ea94eb99a (patch)
tree0dcefc6f0baa14e6f7030a9a7dacf4b5d10871f8 /tests/test_lib.sh
parent003acb3935e03f5752c3dbe2f16af8d8b7f121e3 (diff)
downloadtbdiff-ba0b5c9ea786d12a4c89e93a0c7f2d7ea94eb99a.tar.gz
Added symlink diff test
Diffstat (limited to 'tests/test_lib.sh')
-rw-r--r--tests/test_lib.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/test_lib.sh b/tests/test_lib.sh
index fa1c612..2c182a7 100644
--- a/tests/test_lib.sh
+++ b/tests/test_lib.sh
@@ -6,9 +6,7 @@ IMGFILE=$TESTDIR/tbdiff.img
ORIGIN=$TESTDIR/orig
TARGET=$TESTDIR/target
-ORG_FILE=$ORIGIN/b.txt
-TGT_FILE=$TARGET/b.txt
-
+# check_same_mtime FILE_A FILE_B
function check_same_mtime {
test $(stat -c %Y $1) = $(stat -c %Y $2)
}
@@ -18,11 +16,21 @@ function check_perm {
test $(stat -c %a $1) = $2
}
+# check_content FILE EXPECTED_OCTAL_PERMISSIONS
+function check_symlink {
+ test $(readlink $1) = $2
+}
+
# check_content FILE EXPECTED_CONTENT
function check_content {
test $(cat $1) = $2
}
+# check_group FILE EXPECTED_GROUP_NAME
+function check_group {
+ test $(stat -c %G $1) = $2
+}
+
function start {
if [ $# -ne 2 ]
then
@@ -51,6 +59,9 @@ function cleanup_and_exit {
function main {
start $@
echo -n "$TEST_ID Setting up $TEST_NAME test: "
+ rm -rf $TESTDIR && \
+ mkdir -p $ORIGIN && \
+ mkdir -p $TARGET && \
setup
if [ $? -ne 0 ]
then
@@ -60,7 +71,7 @@ function main {
fi
echo $OK
- echo -n "$TEST_ID Performing $TEST_NAME image creation and deployment: "
+ echo "$TEST_ID Performing $TEST_NAME image creation and deployment: "
CWD=$(pwd)
$CREATE $IMGFILE $ORIGIN $TARGET && \
cd $ORIGIN && \