[sheepdog] [PATCH stable-0.6 05/22] tests: don't use /tmp for each test
Hitoshi Mitake
mitake.hitoshi at gmail.com
Mon Aug 12 16:55:09 CEST 2013
From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Any files under /tmp can be removed by the succeeding tests. Creating
a temporary file under $STORE allows us to check the testing results
later.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
tests/006 | 4 ++--
tests/008 | 4 ++--
tests/009 | 6 +++---
tests/018 | 4 ++--
tests/019 | 4 ++--
tests/023 | 4 ++--
tests/030 | 45 ++++++++++++++++++++++-----------------------
tests/035 | 6 +++---
tests/041 | 14 +++++++-------
9 files changed, 45 insertions(+), 46 deletions(-)
diff --git a/tests/006 b/tests/006
index 5d4d8bf..c89676b 100755
--- a/tests/006
+++ b/tests/006
@@ -31,8 +31,8 @@ _wait_for_sheep 10
echo check whether all nodes have the same cluster info
for i in `seq 0 9`; do
- $COLLIE cluster info -p 700$i | _filter_cluster_info > /tmp/cinfo.$i
+ $COLLIE cluster info -p 700$i | _filter_cluster_info > $STORE/cinfo.$i
done
for i in `seq 1 9`; do
- diff -u /tmp/cinfo.0 /tmp/cinfo.$i
+ diff -u $STORE/cinfo.0 $STORE/cinfo.$i
done
diff --git a/tests/008 b/tests/008
index 7e207e5..1b78ecd 100755
--- a/tests/008
+++ b/tests/008
@@ -59,10 +59,10 @@ wait
for i in `seq 0 4`; do
for port in `seq 0 7`; do
- $COLLIE vdi read test$i -p 700$port | md5sum > /tmp/csum.$port &
+ $COLLIE vdi read test$i -p 700$port | md5sum > $STORE/csum.$port &
done
wait
for port in `seq 1 7`; do
- diff -u /tmp/csum.0 /tmp/csum.$port
+ diff -u $STORE/csum.0 $STORE/csum.$port
done
done
diff --git a/tests/009 b/tests/009
index b8b2f1d..c76bb5e 100755
--- a/tests/009
+++ b/tests/009
@@ -40,8 +40,8 @@ _wait_for_sheep_recovery 0
# show md5sum of the vdi on each node
for i in 0 1 2; do
- $COLLIE vdi read test -p 700$i | md5sum > /tmp/csum.$i
+ $COLLIE vdi read test -p 700$i | md5sum > $STORE/csum.$i
done
-diff -u /tmp/csum.0 /tmp/csum.1
-diff -u /tmp/csum.0 /tmp/csum.2
+diff -u $STORE/csum.0 $STORE/csum.1
+diff -u $STORE/csum.0 $STORE/csum.2
diff --git a/tests/018 b/tests/018
index 50ec779..aab6194 100755
--- a/tests/018
+++ b/tests/018
@@ -30,9 +30,9 @@ _random | $COLLIE vdi write -w test
$COLLIE vdi flush test
for port in `seq 0 2`; do
- $COLLIE vdi read test -p 700$port | md5sum > /tmp/csum.$port
+ $COLLIE vdi read test -p 700$port | md5sum > $STORE/csum.$port
done
for port in `seq 1 2`; do
- diff -u /tmp/csum.0 /tmp/csum.$port
+ diff -u $STORE/csum.0 $STORE/csum.$port
done
diff --git a/tests/019 b/tests/019
index 9bc2a88..351a1e9 100755
--- a/tests/019
+++ b/tests/019
@@ -28,9 +28,9 @@ $COLLIE vdi create test 4M
_random | $COLLIE vdi write test
for port in `seq 0 2`; do
- $COLLIE vdi read test -p 700$port | md5sum > /tmp/csum.$port
+ $COLLIE vdi read test -p 700$port | md5sum > $STORE/csum.$port
done
for port in `seq 1 2`; do
- diff -u /tmp/csum.0 /tmp/csum.$port
+ diff -u $STORE/csum.0 $STORE/csum.$port
done
diff --git a/tests/023 b/tests/023
index cd4c889..d1d1703 100755
--- a/tests/023
+++ b/tests/023
@@ -32,8 +32,8 @@ _wait_for_sheep "10"
echo "comparing cluster info for all sheep. Should be the same"
for i in `seq 0 10`; do
- $COLLIE cluster info > /tmp/cinfo.$i
+ $COLLIE cluster info > $STORE/cinfo.$i
done
for i in `seq 1 10`; do
- diff -u /tmp/cinfo.0 /tmp/cinfo.$i
+ diff -u $STORE/cinfo.0 $STORE/cinfo.$i
done
diff --git a/tests/030 b/tests/030
index 03da274..62e78ec 100755
--- a/tests/030
+++ b/tests/030
@@ -20,7 +20,8 @@ for i in `seq 0 3`; do
done
_wait_for_sheep 4
-TMPDIR=`mktemp -d`
+TMPDIR="$STORE/tmp"
+rm -rf $TMPDIR
$COLLIE cluster format -c 3
@@ -29,8 +30,8 @@ $COLLIE vdi create test2 10M
_random | $COLLIE vdi write test1
_random | $COLLIE vdi write test2
-$COLLIE vdi read test1 | md5sum > /tmp/csum.11.org
-$COLLIE vdi read test2 | md5sum > /tmp/csum.21.org
+$COLLIE vdi read test1 | md5sum > $STORE/csum.11.org
+$COLLIE vdi read test2 | md5sum > $STORE/csum.21.org
$COLLIE vdi snapshot test1
$COLLIE vdi snapshot test2
$COLLIE cluster snapshot save s1 $TMPDIR
@@ -38,8 +39,8 @@ $COLLIE cluster snapshot list $TMPDIR | _filter_date
_random | $COLLIE vdi write test1
_random | $COLLIE vdi write test2
-$COLLIE vdi read test1 | md5sum > /tmp/csum.12.org
-$COLLIE vdi read test2 | md5sum > /tmp/csum.22.org
+$COLLIE vdi read test1 | md5sum > $STORE/csum.12.org
+$COLLIE vdi read test2 | md5sum > $STORE/csum.22.org
$COLLIE vdi snapshot test1
$COLLIE vdi snapshot test2
$COLLIE cluster snapshot save s2 $TMPDIR
@@ -57,10 +58,10 @@ $COLLIE cluster format -c 3
$COLLIE cluster snapshot load s1 $TMPDIR
$COLLIE vdi list | _filter_short_date
-$COLLIE vdi read test1 | md5sum > /tmp/csum.11.new
-$COLLIE vdi read test2 | md5sum > /tmp/csum.21.new
-diff -u /tmp/csum.11.org /tmp/csum.11.new
-diff -u /tmp/csum.21.org /tmp/csum.21.new
+$COLLIE vdi read test1 | md5sum > $STORE/csum.11.new
+$COLLIE vdi read test2 | md5sum > $STORE/csum.21.new
+diff -u $STORE/csum.11.org $STORE/csum.11.new
+diff -u $STORE/csum.21.org $STORE/csum.21.new
_cleanup
for i in `seq 0 3`; do
@@ -80,19 +81,17 @@ _wait_for_sheep 4
$COLLIE cluster snapshot load 2 $TMPDIR
$COLLIE vdi list | _filter_short_date
-$COLLIE vdi read -s 2 test1 | md5sum > /tmp/csum.12.new
-$COLLIE vdi read -s 2 test2 | md5sum > /tmp/csum.22.new
-diff -u /tmp/csum.12.org /tmp/csum.12.new
-diff -u /tmp/csum.22.org /tmp/csum.22.new
-
-$COLLIE vdi read test1 | md5sum > /tmp/csum.12.new
-$COLLIE vdi read test2 | md5sum > /tmp/csum.22.new
-diff -u /tmp/csum.12.org /tmp/csum.12.new
-diff -u /tmp/csum.22.org /tmp/csum.22.new
+$COLLIE vdi read -s 2 test1 | md5sum > $STORE/csum.12.new
+$COLLIE vdi read -s 2 test2 | md5sum > $STORE/csum.22.new
+diff -u $STORE/csum.12.org $STORE/csum.12.new
+diff -u $STORE/csum.22.org $STORE/csum.22.new
-$COLLIE vdi read -s 1 test1 | md5sum > /tmp/csum.11.new
-$COLLIE vdi read -s 1 test2 | md5sum > /tmp/csum.21.new
-diff -u /tmp/csum.11.org /tmp/csum.11.new
-diff -u /tmp/csum.21.org /tmp/csum.21.new
+$COLLIE vdi read test1 | md5sum > $STORE/csum.12.new
+$COLLIE vdi read test2 | md5sum > $STORE/csum.22.new
+diff -u $STORE/csum.12.org $STORE/csum.12.new
+diff -u $STORE/csum.22.org $STORE/csum.22.new
-rm -rf $TMPDIR
+$COLLIE vdi read -s 1 test1 | md5sum > $STORE/csum.11.new
+$COLLIE vdi read -s 1 test2 | md5sum > $STORE/csum.21.new
+diff -u $STORE/csum.11.org $STORE/csum.11.new
+diff -u $STORE/csum.21.org $STORE/csum.21.new
diff --git a/tests/035 b/tests/035
index f2c59e2..090bd2f 100755
--- a/tests/035
+++ b/tests/035
@@ -47,7 +47,7 @@ done
wait
_wait_for_sheep_recovery 0
-$COLLIE vdi read test | md5sum > /tmp/csum.1
+$COLLIE vdi read test | md5sum > $STORE/csum.1
for i in `seq 0 9`; do
$COLLIE vdi object -i $i test
@@ -60,11 +60,11 @@ done
_wait_for_sheep_recovery 0
# Test read timeout
-$COLLIE vdi read test | md5sum > /tmp/csum.2 &
+$COLLIE vdi read test | md5sum > $STORE/csum.2 &
for i in `seq 5 7`; do
_simulate_machine_down $i
done
wait
-diff -u /tmp/csum.1 /tmp/csum.2
+diff -u $STORE/csum.1 $STORE/csum.2
status=0
diff --git a/tests/041 b/tests/041
index a266fa9..ddcb43d 100755
--- a/tests/041
+++ b/tests/041
@@ -44,24 +44,24 @@ for i in `seq 1 3`; do
done
# create backup files between snapshots
-$COLLIE vdi backup test -F snap1 -s snap2 > /tmp/backup.1.2
-$COLLIE vdi backup test -F snap1 -s snap3 > /tmp/backup.1.3
-$COLLIE vdi backup test -F snap2 -s snap3 > /tmp/backup.2.3
+$COLLIE vdi backup test -F snap1 -s snap2 > $STORE/backup.1.2
+$COLLIE vdi backup test -F snap1 -s snap3 > $STORE/backup.1.3
+$COLLIE vdi backup test -F snap2 -s snap3 > $STORE/backup.2.3
# restore backups
-$COLLIE vdi restore test -s snap1 < /tmp/backup.1.2
+$COLLIE vdi restore test -s snap1 < $STORE/backup.1.2
$COLLIE vdi list | _filter_short_date
$COLLIE vdi tree | _filter_short_date
-$COLLIE vdi restore test -s 4 < /tmp/backup.2.3
+$COLLIE vdi restore test -s 4 < $STORE/backup.2.3
$COLLIE vdi list | _filter_short_date
$COLLIE vdi tree | _filter_short_date
-$COLLIE vdi restore test -s snap1 < /tmp/backup.1.3
+$COLLIE vdi restore test -s snap1 < $STORE/backup.1.3
$COLLIE vdi list | _filter_short_date
$COLLIE vdi tree | _filter_short_date
-$COLLIE vdi restore test -s snap2 < /tmp/backup.2.3
+$COLLIE vdi restore test -s snap2 < $STORE/backup.2.3
$COLLIE vdi list | _filter_short_date
$COLLIE vdi tree | _filter_short_date
--
1.8.1.2
More information about the sheepdog
mailing list