diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/commands.sh.in | 1 | ||||
-rw-r--r-- | tests/expected/libmount/lock | 1 | ||||
-rwxr-xr-x | tests/ts/libmount/lock | 37 |
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/commands.sh.in b/tests/commands.sh.in index d5e166bd..bcb428d4 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -19,6 +19,7 @@ TS_HELPER_CPUSET="$top_builddir/lib/test_cpuset" TS_HELPER_LIBMOUNT_OPTSTR="$top_builddir/shlibs/mount/src/test_optstr" TS_HELPER_LIBMOUNT_TAB="$top_builddir/shlibs/mount/src/test_tab" TS_HELPER_LIBMOUNT_UTILS="$top_builddir/shlibs/mount/src/test_utils" +TS_HELPER_LIBMOUNT_LOCK="$top_builddir/shlibs/mount/src/test_lock" # TODO: use partx TS_HELPER_PARTITIONS="$top_builddir/shlibs/blkid/samples/partitions" diff --git a/tests/expected/libmount/lock b/tests/expected/libmount/lock new file mode 100644 index 00000000..d7e318d9 --- /dev/null +++ b/tests/expected/libmount/lock @@ -0,0 +1 @@ +50000
\ No newline at end of file diff --git a/tests/ts/libmount/lock b/tests/ts/libmount/lock new file mode 100755 index 00000000..1230e5cc --- /dev/null +++ b/tests/ts/libmount/lock @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright (C) 2010 Karel Zak <kzak@redhat.com> + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="lock" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +TESTPROG="$TS_HELPER_LIBMOUNT_LOCK" + +# +# 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=1000 +NPROCESSES=50 + + +> $TS_OUTPUT.debug +echo 0 > $TS_OUTPUT +SYNCTIME=$(( $(date +%s) + 5 )) + +for id in $(seq 0 $(( $NPROCESSES - 1 ))); do + $TESTPROG --lock --synctime $SYNCTIME $TS_OUTPUT $NLOOPS >> $TS_OUTPUT.debug 2>&1 & +done + +wait + +ts_finalize |