[sheepdog] [PATCH] test: Implentment fast random on AES

Joseph Glanville joseph at cloudscaling.com
Mon May 6 10:15:37 CEST 2013


Signed-off-by: Joseph Glanville <joseph at cloudscaling.com>
---
 tests/008       | 2 +-
 tests/009       | 2 +-
 tests/018       | 2 +-
 tests/019       | 2 +-
 tests/020       | 2 +-
 tests/030       | 6 +++---
 tests/035       | 2 +-
 tests/049       | 2 +-
 tests/055       | 6 +++---
 tests/056       | 2 +-
 tests/common.rc | 4 ++++
 11 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/tests/008 b/tests/008
index 1af5bcf..7b4061e 100755
--- a/tests/008
+++ b/tests/008
@@ -33,7 +33,7 @@ for i in `seq 0 4`; do
 done
 
 for i in `seq 0 4`; do
-    dd if=/dev/urandom | $COLLIE vdi write test$i -p 7000 &
+    _random | dd bs=1M | $COLLIE vdi write test$i -p 7000 &
 done
 
 sleep 3
diff --git a/tests/009 b/tests/009
index e139524..b8b2f1d 100755
--- a/tests/009
+++ b/tests/009
@@ -31,7 +31,7 @@ $COLLIE vdi create test 80M -P
 _kill_sheep 2
 
 # write data to the vdi
-cat /dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 
 # restart the 3rd node
 _start_sheep 2
diff --git a/tests/018 b/tests/018
index d8af69b..50ec779 100755
--- a/tests/018
+++ b/tests/018
@@ -25,7 +25,7 @@ $COLLIE cluster format -c 2
 
 $COLLIE vdi create test 4M
 
-dd if=/dev/urandom | $COLLIE vdi write -w test
+_random | $COLLIE vdi write -w test
 
 $COLLIE vdi flush test
 
diff --git a/tests/019 b/tests/019
index 98fc2b8..9bc2a88 100755
--- a/tests/019
+++ b/tests/019
@@ -25,7 +25,7 @@ $COLLIE cluster format -c 2
 
 $COLLIE vdi create test 4M
 
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 
 for port in `seq 0 2`; do
     $COLLIE vdi read test -p 700$port | md5sum > /tmp/csum.$port
diff --git a/tests/020 b/tests/020
index 6fe2e32..c5993f8 100755
--- a/tests/020
+++ b/tests/020
@@ -25,7 +25,7 @@ $COLLIE cluster format -c 2
 
 $COLLIE vdi create test 40M
 
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 
 # check cache size, should be 20 * 80%
 nr=`ls $STORE/0/cache/7c2b25 | wc -l`
diff --git a/tests/030 b/tests/030
index 7c5ed98..6c58658 100755
--- a/tests/030
+++ b/tests/030
@@ -25,15 +25,15 @@ $COLLIE cluster format -c 2
 
 $COLLIE vdi create test 8M
 
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 $COLLIE cluster snapshot
 $COLLIE vdi read test | md5sum > /tmp/csum.1
 
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 $COLLIE cluster snapshot
 $COLLIE vdi read test | md5sum > /tmp/csum.2
 
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 $COLLIE cluster snapshot -l | _filter_date
 
 $COLLIE cluster snapshot -R 2
diff --git a/tests/035 b/tests/035
index 5b948c9..f2c59e2 100755
--- a/tests/035
+++ b/tests/035
@@ -35,7 +35,7 @@ _wait_for_sheep 6
 $COLLIE cluster format -c 3 -m unsafe
 
 $COLLIE vdi create test 40M
-dd if=/dev/urandom | $COLLIE vdi write test &
+_random | $COLLIE vdi write test &
 
 sleep 3
 # Test write timeout
diff --git a/tests/049 b/tests/049
index 1336b5f..b27be1a 100755
--- a/tests/049
+++ b/tests/049
@@ -25,7 +25,7 @@ $COLLIE cluster format -c 1
 sleep 1
 
 $COLLIE vdi create test 20M
-dd if=/dev/urandom | $COLLIE vdi write -w test
+_random | $COLLIE vdi write -w test
 
 $COLLIE cluster shutdown
 _wait_for_sheep_stop
diff --git a/tests/055 b/tests/055
index 6b99552..9b908e4 100755
--- a/tests/055
+++ b/tests/055
@@ -25,14 +25,14 @@ $COLLIE vdi create test 200M -P
 
 # simulate one disk failure
 rm $STORE/0/d0 -rf
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 _wait_for_sheep_recovery 0
 $COLLIE vdi check test
 $COLLIE cluster info | _filter_cluster_info
 
 # simulate multiple disk failure
 rm $STORE/1/d0 -rf
-dd if=/dev/urandom | $COLLIE vdi write test &
+_random | $COLLIE vdi write test &
 sleep 1
 rm $STORE/1/d1 -rf
 _wait_for_sheep_recovery 0
@@ -42,7 +42,7 @@ $COLLIE cluster info | _filter_cluster_info
 
 # simulate all disks failure
 rm $STORE/1/d2 -rf
-dd if=/dev/urandom | $COLLIE vdi write test
+_random | $COLLIE vdi write test
 $COLLIE vdi check test
 $COLLIE cluster info | _filter_cluster_info
 
diff --git a/tests/056 b/tests/056
index 25dd22f..8d1dd64 100755
--- a/tests/056
+++ b/tests/056
@@ -25,7 +25,7 @@ $COLLIE vdi create test 200M -P
 
 # node event after disk failure
 rm $STORE/0/d0 -rf
-dd if=/dev/urandom | $COLLIE vdi write test &
+_random | $COLLIE vdi write test &
 sleep 1
 _start_sheep 3
 _wait_for_sheep 4
diff --git a/tests/common.rc b/tests/common.rc
index a2de9de..5086761 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -390,5 +390,9 @@ _cleanup_devices()
     done
 }
 
+_random()
+{
+	openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero | dd iflag=fullblock bs=1M
+}
 # make sure this script returns success
 /bin/true
-- 
1.8.1.2




More information about the sheepdog mailing list