Skip to content

Commit bf4545c

Browse files
committed
Add test cases for lvextend, lvcreate, lvdisplay
Signed-off-by: Cheng Zhang <[email protected]>
1 parent afb4430 commit bf4545c

File tree

1 file changed

+52
-7
lines changed

1 file changed

+52
-7
lines changed

test.sh

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,72 @@
11
set -e
2+
set -x
23

34
eval `opam config env`
45
#opam pin add ocveralls git://github.com/djs55/ocveralls#fix-vector-combine -y
56
make
67

7-
# Making a 1G disk
8+
# Making a 8G disk
89
rm -f bigdisk _build/xenvm*.out
9-
dd if=/dev/zero of=bigdisk bs=1 seek=256G count=0
10-
cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|`pwd`/bigdisk|g" > test.xenvmd.conf
11-
sudo mkdir -p /etc/xenvm.d
12-
BISECT_FILE=_build/xenvm.coverage ./xenvm.native format bigdisk --vg djstest
10+
dd if=/dev/zero of=bigdisk bs=1 seek=8G count=0
11+
12+
LOOP=$(losetup -f)
13+
echo Using $LOOP
14+
losetup $LOOP bigdisk
15+
cat test.xenvmd.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" > test.xenvmd.conf
16+
mkdir -p /etc/xenvm.d
17+
BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest
1318
BISECT_FILE=_build/xenvmd.coverage ./xenvmd.native --config ./test.xenvmd.conf --daemon
1419

1520
export BISECT_FILE=_build/xenvm.coverage
1621

17-
sudo ./xenvm.native set-vg-info --pvpath ./bigdisk -S /tmp/xenvmd djstest --local-allocator-path /tmp/xenvm-local-allocator --uri file://local/services/xenvmd/djstest
22+
./xenvm.native set-vg-info --pvpath $LOOP -S /tmp/xenvmd djstest --local-allocator-path /tmp/xenvm-local-allocator --uri file://local/services/xenvmd/djstest
23+
24+
#./xenvm.native benchmark /dev/djstest
25+
26+
./xenvm.native lvcreate -n live -L 4 djstest
27+
lvsize=`./xenvm.native lvdisplay /dev/djstest/live | grep 'LV Size'| awk '{print $3}'`
28+
if [ "$lvsize"x = "8192s"x ]; then echo "Pass lvcreate Test"; else echo "Failed lvcreate Test"; fi
29+
30+
./xenvm.native lvchange -ay /dev/djstest/live
31+
32+
./xenvm.native lvextend -L 5G /dev/djstest/live
33+
lvsize=`./xenvm.native lvdisplay /dev/djstest/live | grep 'LV Size'| awk '{print $3}'`
34+
if [ "$lvsize"x = "10485760s"x ]; then echo "Pass lvextend Test"; else echo "Failed lvextend Test"; fi
35+
36+
# create and connect to hosts
37+
./xenvm.native host-create /dev/djstest host1
38+
./xenvm.native host-connect /dev/djstest host1
39+
cat test.local_allocator.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" | sed -r "s|@HOST@|host1|g" > test.local_allocator.host1.conf
40+
./local_allocator.native --config ./test.local_allocator.host1.conf > /dev/null &
1841

19-
./xenvm.native benchmark /dev/djstest
42+
./xenvm.native host-create /dev/djstest host2
43+
./xenvm.native host-connect /dev/djstest host2
44+
cat test.local_allocator.conf.in | sed -r "s|@BIGDISK@|$LOOP|g" | sed -r "s|@HOST@|host2|g" > test.local_allocator.host2.conf
45+
./local_allocator.native --config ./test.local_allocator.host2.conf > /dev/null &
2046

47+
sleep 30
48+
./xenvm.native host-list /dev/djstest
49+
50+
# destroy hosts
51+
./xenvm.native host-disconnect /dev/djstest host2
52+
./xenvm.native host-destroy /dev/djstest host2
53+
./xenvm.native host-disconnect /dev/djstest host1
54+
./xenvm.native host-destroy /dev/djstest host1
55+
56+
./xenvm.native host-list /dev/djstest
57+
58+
#shutdown
59+
./xenvm.native lvchange -an /dev/djstest/live
2160
./xenvm.native shutdown /dev/djstest
2261

62+
2363
wait $(pidof xenvmd.native)
2464
echo Generating bisect report-- this fails on travis
2565
(cd _build; bisect-report xenvm*.out -summary-only -html /vagrant/report/ || echo Ignoring bisect-report failure)
2666
echo Sending to coveralls-- this only works on travis
2767
`opam config var bin`/ocveralls --prefix _build _build/xenvm*.out --send || echo "Failed to upload to coveralls"
68+
69+
dmsetup remove_all
70+
dd if=/dev/zero of=$LOOP bs=1M count=128
71+
losetup -d $LOOP
72+
rm -f localJournal bigdisk *.out

0 commit comments

Comments
 (0)