summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlberto <alberto.ruiz@codethink.co.uk>2011-10-03 18:12:53 +0100
committerAlberto <alberto.ruiz@codethink.co.uk>2011-10-03 18:12:53 +0100
commit03dfbf38e41cfc9d84d81c4491e6d36f73056cbf (patch)
tree54f9656174d80e00379b94979eb712686a7c2597 /tests
parent7731c0e4b9a31504f120f2dbfd874326bdd79e4f (diff)
downloadtbdiff-03dfbf38e41cfc9d84d81c4491e6d36f73056cbf.tar.gz
Add FIFO test. Add fakeroot environment. Fixes in symlink diff.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/01_symlink_diff.sh6
-rwxr-xr-xtests/04_fifo_add_remove.sh29
-rwxr-xr-xtests/run_tests.sh2
-rw-r--r--tests/test_lib.sh3
4 files changed, 34 insertions, 6 deletions
diff --git a/tests/01_symlink_diff.sh b/tests/01_symlink_diff.sh
index 4246865..4181a30 100755
--- a/tests/01_symlink_diff.sh
+++ b/tests/01_symlink_diff.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-TEST_ID="02"
+TEST_ID="01"
TEST_NAME="Symlink add/remove"
CREATE=`pwd`/$1
@@ -18,8 +18,8 @@ function setup {
}
function check_results {
- test -L $ORIGIN/a && \
- check_symlink $ORIGIN/a "/bar" && \
+ test -L $ORIGIN/a && \
+ check_symlink $ORIGIN/a "/bar" && \
check_group $ORIGIN/a cdrom && \
check_same_mtime $ORIGIN/a $TARGET/a && \
check_same_uidgid $ORIGIN/a $TARGET/a
diff --git a/tests/04_fifo_add_remove.sh b/tests/04_fifo_add_remove.sh
new file mode 100755
index 0000000..ebea443
--- /dev/null
+++ b/tests/04_fifo_add_remove.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+TEST_ID="04"
+TEST_NAME="Named pipe (FIFO) add remove test"
+
+CREATE=`pwd`/$1
+DEPLOY=`pwd`/$2
+TEST_TOOLS=$3
+
+. ./test_lib.sh
+
+############# Test specific code ############
+
+function setup {
+ mkfifo $ORIGIN/remove && \
+ mkfifo $TARGET/add && \
+ chmod 707 $TARGET/add && \
+ chown -h :cdrom $TARGET/add
+}
+
+function check_results {
+ test -p $ORIGIN/add && \
+ test ! -p $ORIGIN/remove && \
+ check_same_mtime $ORIGIN/add $TARGET/add && \
+ check_same_uidgid $ORIGIN/add $TARGET/add
+}
+
+#############################################
+main $@
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 873d2eb..889f5f4 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -17,7 +17,7 @@ ALLTESTSDIR=`pwd`
for i in [0-9][0-9]*
do
cd $ALLTESTSDIR
- ./$i ../tbdiff-create ../tbdiff-deploy
+ fakeroot -- ./$i ../tbdiff-create ../tbdiff-deploy
if [ $? -ne 0 ]
then
echo "Test program $i failed" 1>&2
diff --git a/tests/test_lib.sh b/tests/test_lib.sh
index 6d431d0..d9c30d9 100644
--- a/tests/test_lib.sh
+++ b/tests/test_lib.sh
@@ -83,7 +83,6 @@ function main {
$DEPLOY $IMGFILE && \
RETVAL=$?
cd $CWD
-
if test "x$RETVAL" != "x0"
then
echo $FAIL
@@ -94,7 +93,7 @@ function main {
echo -n "$TEST_ID Checking $TEST_NAME results: "
check_results
- if test "x$RETVAL" != "x0"
+ if test "x$?" != "x0"
then
echo $FAIL
echo "Applying image did not produce the expected results" 1>&2