diff options
author | Karel Zak | 2010-10-19 14:30:07 +0200 |
---|---|---|
committer | Karel Zak | 2011-01-03 12:28:45 +0100 |
commit | 9e10ad3d5035686e4676c208c7d88f55f1c1a05c (patch) | |
tree | f21962320d8425ac036fa608d031a8508ad0aaca /tests | |
parent | tests: add libmount utils.c tests (diff) | |
download | kernel-qcow2-util-linux-9e10ad3d5035686e4676c208c7d88f55f1c1a05c.tar.gz kernel-qcow2-util-linux-9e10ad3d5035686e4676c208c7d88f55f1c1a05c.tar.xz kernel-qcow2-util-linux-9e10ad3d5035686e4676c208c7d88f55f1c1a05c.zip |
tests: add libmount lock test
Signed-off-by: Karel Zak <kzak@redhat.com>
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 d5e166bdf..bcb428d4a 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 000000000..d7e318d98 --- /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 000000000..1230e5cc5 --- /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 |