diff options
author | Danny Abukalam <dannyabukalam@codethink.co.uk> | 2012-01-09 15:12:27 +0000 |
---|---|---|
committer | Danny Abukalam <dannyabukalam@codethink.co.uk> | 2012-01-09 15:12:27 +0000 |
commit | 044708588a29b0d5b8d0083b2a8653e625db8708 (patch) | |
tree | 2c788b4bc7d39f39efaa2fea0177c3dea5f4687f | |
parent | 556c83b65d74cbcba4116aad1870f927c130578a (diff) | |
download | tbdiff-044708588a29b0d5b8d0083b2a8653e625db8708.tar.gz |
Added Cross Platform Testing
-rw-r--r-- | Makefile | 8 | ||||
-rwxr-xr-x | tests/cross_plat.sh | 98 | ||||
-rw-r--r-- | tests/test_lib.sh | 1 |
3 files changed, 104 insertions, 3 deletions
@@ -42,8 +42,12 @@ uninstall: rm -rf /usr/local/bin/$(CREATE) test: - cd tests && ./run_tests.sh && cd .. + cd tests && ./run_tests.sh && fakeroot -- ./cross_plat.sh && cd .. + .PHONY: clean + +check: + cd tests && ./run_tests.sh && cd .. + clean: rm -f $(DEPLOY) $(CREATE) *.o *.d -check: test diff --git a/tests/cross_plat.sh b/tests/cross_plat.sh new file mode 100755 index 0000000..1228bd7 --- /dev/null +++ b/tests/cross_plat.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +CWD=`pwd` + +CREATE="../tbdiff-create" +DEPLOY="../tbdiff-deploy" + +PATCH1="../patch1.tbd" +PATCH2="../patch2.tbd" + +EMPTY="empty" +MIDDIR="middir" +FINALDIR="finaldir" + +cleanup() { + echo "Cleaning up..." + cd $CWD + rm -rf $EMPTY $MIDDIR $FINALDIR patch1prime.tbd patch2prime.tbd +} +checkmeta() { + cd $CWD + echo "Checking metadata..." + cd $MIDDIR + #1325779232 is the hardcoded creation time of b.txt and blockdev in patch1 + if [ `stat -c %Y b.txt` -eq 1325779232 ]; then + echo "b.txt OK" + else + echo "Metadata mismatch" + cleanup + exit 1 + fi + if [ `stat -c %Y dirdir/blockdev` -eq 1325779232 ]; then + echo "blockdev OK" + else + echo "Metadata mismatch" + cleanup + exit 1 + fi + cd .. + cd $FINALDIR + #1325769455 is the hardcoded creation time of a.txt and fifo in patch2 + if [ `stat -c %Y a.txt` -eq 1325769455 ]; then + echo "a.txt OK" + else + echo "Metadata mismatch" + cleanup + exit 1 + fi + if [ `stat -c %Y dirdir/fifo` -eq 1325769455 ]; then + echo "fifo OK" + else + echo "Metadata mismatch" + cleanup + exit 1 + fi + cd .. +} + +echo -e "\n#### Preparing Cross Platform Test" +if [ ! -f run_tests.sh ] +then + echo "Test needs to be run from the tests directory" 1>&2 + cleanup + exit 1 +fi + +mkdir $EMPTY +mkdir $MIDDIR +cd $MIDDIR +../$DEPLOY $PATCH1 +cd .. + +cp -R $MIDDIR $FINALDIR +cd $FINALDIR +../$DEPLOY $PATCH2 +cd .. + +$CREATE patch1prime.tbd $EMPTY $MIDDIR +$CREATE patch2prime.tbd $MIDDIR $FINALDIR + +echo -e "\n#### Testing ####" +echo "Checking Diffs..." +diff patch1.tbd patch1prime.tbd +if [ $? -eq 0 ]; then + echo -n "Patch 1: " + echo OK +fi +diff patch2.tbd patch2prime.tbd +if [ $? -eq 0 ]; then + echo -n "Patch 2: " + echo OK +fi + +checkmeta +cleanup +echo "#####################################################################" + +exit 0 diff --git a/tests/test_lib.sh b/tests/test_lib.sh index 4185bed..0ae5399 100644 --- a/tests/test_lib.sh +++ b/tests/test_lib.sh @@ -126,7 +126,6 @@ main () { mkdir -p $ORIGIN && check_command 'setup_origin' "$TEST_ID-$TEST_NAME: creating origin" \ 'command_succeeded' && - sleep 2s && mkdir -p $TARGET && check_command 'setup_target' "$TEST_ID-$TEST_NAME: creating target" \ 'command_succeeded' && |