summaryrefslogtreecommitdiffstats
path: root/tests/ts-mount-mtablock
diff options
context:
space:
mode:
authorKarel Zak2007-03-28 18:43:03 +0200
committerKarel Zak2007-03-28 18:43:03 +0200
commit2cd72ac0e054bb070cad880d0cc9366ebf08b3eb (patch)
tree8e7c3f873dddf4e33dd63008142a6176afc90025 /tests/ts-mount-mtablock
parenttests: make clean need to remove diffs and outputs (diff)
downloadkernel-qcow2-util-linux-2cd72ac0e054bb070cad880d0cc9366ebf08b3eb.tar.gz
kernel-qcow2-util-linux-2cd72ac0e054bb070cad880d0cc9366ebf08b3eb.tar.xz
kernel-qcow2-util-linux-2cd72ac0e054bb070cad880d0cc9366ebf08b3eb.zip
tests: add lock_mtab() performance and reliability test
The test starts concurrently many processes that use lock_mtab() as lock for access to same file. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts-mount-mtablock')
-rwxr-xr-xtests/ts-mount-mtablock35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ts-mount-mtablock b/tests/ts-mount-mtablock
new file mode 100755
index 000000000..44834dc30
--- /dev/null
+++ b/tests/ts-mount-mtablock
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. commands.sh
+. functions.sh
+
+TS_COMPONENT="mount"
+TS_DESC="mtablock"
+
+#
+# Be careful with number of processes. Don't forget that there is time limit
+# when the mount waits on the mtab lock. If you define too much processes some
+# of them will fail with timeout.
+#
+# Note: the original version (< 2.13) of util-linux is completely useless for
+# this test (maximum for this old version is NLOOPS=10 and NPROCESSES=5 (2-way
+# 2GHz machine)). It has terrible performance due a bad timeouts implemntation
+# in lock_mtab().
+#
+NLOOPS=10
+NPROCESSES=5
+
+ts_init
+
+> $TS_OUTPUT.debug
+echo 0 > $TS_OUTPUT
+SYNCTIME=$(( $(date +%s) + 10 ))
+
+for id in $(seq 0 $(( $NPROCESSES - 1 ))); do
+ $TS_CMD_MTABLOCK $id $SYNCTIME $TS_OUTPUT $NLOOPS >> $TS_OUTPUT.debug 2>&1 &
+done
+
+wait
+
+ts_finalize
+