11set -e
22set -x
33
4+ if [ " $EUID " -ne " 0" ]; then
5+ echo " I am not running with EUID 0. I will use the mock device mapper interface"
6+ USE_MOCK=1
7+ MOCK_ARG=" --mock-devmapper"
8+ else
9+ echo " I am running with EUID 0. I will use the real device mapper interface"
10+ USE_MOCK=0
11+ MOCK_ARG=" "
12+ fi
13+
414eval ` opam config env`
515# opam pin add ocveralls git://github.com/djs55/ocveralls#fix-vector-combine -y
616make
717
818# Making a 8G disk
9- rm -f bigdisk _build/xenvm* .out
19+ rm -f bigdisk _build/xenvm* .out chengzDisk
1020dd if=/dev/zero of=bigdisk bs=1 seek=8G count=0
21+ dd if=/dev/zero of=chengzDisk bs=1 seek=8G count=0
22+
23+ if [ " $USE_MOCK " -eq " 0" ]; then
24+ LOOP=$( losetup -f)
25+ echo Using $LOOP
26+ losetup $LOOP bigdisk
27+ CHENGZLOOP=$( losetup -f)
28+ losetup $CHENGZLOOP chengzDisk
29+ echo Using $chengzDisk
30+ else
31+ LOOP=` pwd` /bigdisk
32+ CHENGZLOOP=` pwd` /chengzDisk
33+ fi
1134
12- LOOP=$( losetup -f)
13- echo Using $LOOP
14- losetup $LOOP bigdisk
1535cat test.xenvmd.conf.in | sed -r " s|@BIGDISK@|$LOOP |g" > test.xenvmd.conf
1636mkdir -p /etc/xenvm.d
17- BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest
37+ BISECT_FILE=_build/xenvm.coverage ./xenvm.native format $LOOP --vg djstest $MOCK_ARG
1838BISECT_FILE=_build/xenvmd.coverage ./xenvmd.native --config ./test.xenvmd.conf --daemon
1939
2040export BISECT_FILE=_build/xenvm.coverage
2141
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
42+ ./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
43+
44+ # ./xenvm.native benchmark /dev/djstest $MOCK_ARG
45+
46+ ./xenvm.native vgcreate chengztest $CHENGZLOOP
47+ ./xenvm.native format $CHENGZLOOP --vg chengztest
48+ ./xenvm.native vgs djstest
49+ # ./xenvm.native vgs chengztest ###failed with Need to know the local device!
50+ ./xenvm.native vgremove chengztest
51+ ./xenvm.native vgremove chengztestsasa
52+
2353
24- # ./xenvm.native benchmark /dev/ djstest
54+ ./xenvm.native lvcreate -n live -L 2G djstest $MOCK_ARG
2555
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
56+ ./xenvm.native lvdisplay /dev/ djstest/live
57+ lvsize=` ./xenvm.native lvdisplay /dev/djstest/live $MOCK_ARG | grep ' LV Size' | awk ' {print $3}' `
58+ if [ " $lvsize " x = " 4194304sx " ]; then echo " Pass lvcreate Test" ; else echo " Failed lvcreate Test" ; fi
2959
30- ./xenvm.native lvchange -ay /dev/djstest/live
60+ ./xenvm.native lvchange -ay /dev/djstest/live $MOCK_ARG
3161
32- ./xenvm.native lvextend -L 5G /dev/djstest/live
33- lvsize=` ./xenvm.native lvdisplay /dev/djstest/live | grep ' LV Size' | awk ' {print $3}' `
62+
63+ ./xenvm.native lvextend -L 5G /dev/djstest/live $MOCK_ARG
64+ lvsize=` ./xenvm.native lvdisplay /dev/djstest/live $MOCK_ARG | grep ' LV Size' | awk ' {print $3}' `
3465if [ " $lvsize " x = " 10485760s" x ]; then echo " Pass lvextend Test" ; else echo " Failed lvextend Test" ; fi
3566
3667# create and connect to hosts
37- ./xenvm.native host-create /dev/djstest host1
38- ./xenvm.native host-connect /dev/djstest host1
68+ ./xenvm.native host-create /dev/djstest host1 $MOCK_ARG
69+
70+ ./xenvm.native host-connect /dev/djstest host1 $MOCK_ARG
71+
3972cat 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 &
73+ ./local_allocator.native --config ./test.local_allocator.host1.conf $MOCK_ARG > /dev/null &
4174
42- ./xenvm.native host-create /dev/djstest host2
43- ./xenvm.native host-connect /dev/djstest host2
75+ ./xenvm.native host-create /dev/djstest host2 $MOCK_ARG
76+ ./xenvm.native host-connect /dev/djstest host2 $MOCK_ARG
4477cat 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 &
78+ ./local_allocator.native --config ./test.local_allocator.host2.conf $MOCK_ARG > /dev/null &
4679
4780sleep 30
48- ./xenvm.native host-list /dev/djstest
81+ ./xenvm.native host-list /dev/djstest $MOCK_ARG
4982
5083# 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
84+ ./xenvm.native host-disconnect /dev/djstest host2 $MOCK_ARG
85+ ./xenvm.native host-destroy /dev/djstest host2 $MOCK_ARG
86+ ./xenvm.native host-disconnect /dev/djstest host1 $MOCK_ARG
87+ ./xenvm.native host-destroy /dev/djstest host1 $MOCK_ARG
5588
56- ./xenvm.native host-list /dev/djstest
89+ ./xenvm.native host-list /dev/djstest $MOCK_ARG
5790
5891# shutdown
59- ./xenvm.native lvchange -an /dev/djstest/live
60- ./xenvm.native shutdown /dev/djstest
92+ ./xenvm.native lvchange -an /dev/djstest/live $MOCK_ARG
93+ ./xenvm.native shutdown /dev/djstest $MOCK_ARG
6194
6295
6396wait $( pidof xenvmd.native)
@@ -69,4 +102,6 @@ echo Sending to coveralls-- this only works on travis
69102dmsetup remove_all
70103dd if=/dev/zero of=$LOOP bs=1M count=128
71104losetup -d $LOOP
72- rm -f localJournal bigdisk * .out
105+ dd if=/dev/zero of=$CHENGZLOOP bs=1M count=128
106+ losetup -d $CHENGZLOOP
107+ rm -f localJournal bigdisk * .out chengzDisk
0 commit comments