aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-05-05 14:17:05 +0200
committerJakob Unterwurzacher2016-05-05 14:17:05 +0200
commitd56f1ee179857701df0a3bfb1d20a81921088bc5 (patch)
treeb5f35fcc0a02ba238ae8d5e3e84ac4b4174aa859
parent730291feabdcdbd6345aa12ddba87a3ffea4ecb1 (diff)
stress_tests: extractloop: run two loops in parallel
This increases the load but also the disk space requirements (to about 2GB).
-rwxr-xr-xstress_tests/extractloop.bash33
1 files changed, 19 insertions, 14 deletions
diff --git a/stress_tests/extractloop.bash b/stress_tests/extractloop.bash
index 3d43763..b3c13c0 100755
--- a/stress_tests/extractloop.bash
+++ b/stress_tests/extractloop.bash
@@ -16,17 +16,22 @@ cd $DIR2
# Just ignore fusermount errors.
trap "cd /; fusermount -u -z $DIR2; rm -rf $DIR1 $DIR2" EXIT
-# Loop
-N=1
-while true
-do
- echo -n "$N "
- echo -n "extract "
- tar xf /tmp/linux-3.0.tar.gz
- echo -n "diff "
- diff -ur linux-3.0 /tmp/linux-3.0
- echo -n "rm "
- rm -Rf linux-3.0
- date
- let N=$N+1
-done
+function loop {
+ # Note: $$ returns the PID of the *parent* shell
+ mkdir $BASHPID
+ cd $BASHPID
+
+ N=1
+ while true
+ do
+ echo "Process $BASHPID iteration $N: $(date)"
+ tar xf /tmp/linux-3.0.tar.gz
+ diff -ur linux-3.0 /tmp/linux-3.0
+ rm -Rf linux-3.0
+ let N=$N+1
+ done
+}
+
+loop &
+loop &
+wait