From 4b0bf749fbb4b79f35754cd6adaf3ffd0f259c43 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 8 Jun 2015 18:00:18 +0100 Subject: [PATCH 1/4] Make sure the tests run when /tmp is not odirect capable Like on my Fedora box. Signed-off-by: Jon Ludlam --- test.local_allocator.conf.in | 2 +- test/common.ml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test.local_allocator.conf.in b/test.local_allocator.conf.in index c3d0a22..a431ef9 100644 --- a/test.local_allocator.conf.in +++ b/test.local_allocator.conf.in @@ -1,7 +1,7 @@ ( (socket /tmp/@HOST@-socket) (allocation_quantum 16) - (localJournal /tmp/@HOST@-localJournal) + (localJournal @HOST@-localJournal) (devices (@BIGDISK@)) (toLVM @HOST@-toLVM) (fromLVM @HOST@-fromLVM) diff --git a/test/common.ml b/test/common.ml index 4023799..b653708 100644 --- a/test/common.ml +++ b/test/common.ml @@ -218,7 +218,7 @@ let tib = Int64.(gib * kib) module Client = Xenvm_client.Client let with_temp_file fn = - let filename = "/tmp/vg" in + let filename = Filename.concat (Unix.getcwd ()) "vg" in let f = Unix.openfile filename [Unix.O_CREAT; Unix.O_RDWR; Unix.O_TRUNC] 0o644 in (* approximately 10000 4MiB extents for volumes, 100MiB for metadata and overhead *) From 0c56fa2bc84a6c79c3fcb19ba11f21f0a4eb6a93 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 8 Jun 2015 18:01:04 +0100 Subject: [PATCH 2/4] test.sh: Log the messages from the local allocator Signed-off-by: Jon Ludlam --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index a2fa4c9..fb3a267 100755 --- a/setup.sh +++ b/setup.sh @@ -62,7 +62,7 @@ sleep 30 # the local allocator daemonizes too soon ./xenvm.native host-create /dev/djstest host2 --configdir /tmp/xenvm.d $MOCK_ARG ./xenvm.native host-connect /dev/djstest host2 --configdir /tmp/xenvm.d $MOCK_ARG cat test.local_allocator.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" | sed -r "s|@HOST@|host2|g" > test.local_allocator.host2.conf -./local_allocator.native --config ./test.local_allocator.host2.conf $MOCK_ARG > /dev/null & +./local_allocator.native --config ./test.local_allocator.host2.conf $MOCK_ARG > local_allocator.host2.log & sleep 30 ./xenvm.native host-list /dev/djstest --configdir /tmp/xenvm.d $MOCK_ARG From bb7770affb59893cfe5db89356616d0453833fde Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 8 Jun 2015 18:02:04 +0100 Subject: [PATCH 3/4] Fix the test.sh script - 'wait' was failing as xenvmd was not a direct child of the shell - dmsetup commands were executed as non-root Signed-off-by: Jon Ludlam --- test.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test.sh b/test.sh index 42513d0..2da696d 100755 --- a/test.sh +++ b/test.sh @@ -36,7 +36,6 @@ cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" > test.xenvmd.conf mkdir -p /etc/xenvm.d BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest $MOCK_ARG BISECT_FILE=_build/xenvmd.coverage ./xenvmd.native --config ./test.xenvmd.conf --daemon - export BISECT_FILE=_build/xenvm.coverage ./xenvm.native set-vg-info --pvpath $LOOP -S /tmp/xenvmd djstest --local-allocator-path /tmp/xenvm-local-allocator --uri file://local/services/xenvmd/djstest $MOCK_ARG @@ -88,20 +87,28 @@ sleep 30 ./xenvm.native host-list /dev/djstest $MOCK_ARG +xenvmdpid=`pidof xenvmd.native` #shutdown ./xenvm.native lvchange -an /dev/djstest/live $MOCK_ARG ./xenvm.native shutdown /dev/djstest $MOCK_ARG -wait $(pidof xenvmd.native) +while [ -d /proc/$xenvmdpid ]; +do + sleep 1; +done + echo Generating bisect report-- this fails on travis (cd _build; bisect-report xenvm*.out -summary-only -html /vagrant/report/ || echo Ignoring bisect-report failure) echo Sending to coveralls-- this only works on travis `opam config var bin`/ocveralls --prefix _build _build/xenvm*.out --send || echo "Failed to upload to coveralls" -dmsetup remove_all -dd if=/dev/zero of=$LOOP bs=1M count=128 -losetup -d $LOOP -dd if=/dev/zero of=$CHENGZLOOP bs=1M count=128 -losetup -d $CHENGZLOOP -rm -f localJournal bigdisk *.out chengzDisk \ No newline at end of file +if [ "$USE_MOCK" -eq "0" ]; then + dmsetup remove_all + dd if=/dev/zero of=$LOOP bs=1M count=128 + losetup -d $LOOP + dd if=/dev/zero of=$CHENGZLOOP bs=1M count=128 + losetup -d $CHENGZLOOP +fi + +rm -f localJournal bigdisk *.out chengzDisk From 96c39ddf4d755261d7469525edef2b3142cdac98 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 8 Jun 2015 18:21:38 +0100 Subject: [PATCH 4/4] test.sh: Don't daemonize - run in the background. Capture the logs. Signed-off-by: Jon Ludlam --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index fb3a267..065cd31 100755 --- a/setup.sh +++ b/setup.sh @@ -53,7 +53,7 @@ mkdir -p /tmp/xenvm.d ./xenvm.native host-create /dev/djstest host1 --configdir /tmp/xenvm.d $MOCK_ARG ./xenvm.native host-connect /dev/djstest host1 --configdir /tmp/xenvm.d $MOCK_ARG cat test.local_allocator.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" | sed -r "s|@HOST@|host1|g" > test.local_allocator.host1.conf -./local_allocator.native --daemon --config ./test.local_allocator.host1.conf $MOCK_ARG +./local_allocator.native --config ./test.local_allocator.host1.conf $MOCK_ARG > local_allocator.host2.log & sleep 30 # the local allocator daemonizes too soon