File: lock

package info (click to toggle)
util-linux 2.25.2-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 60,764 kB
  • ctags: 11,189
  • sloc: ansic: 103,273; sh: 18,345; makefile: 322; python: 316; xml: 232; csh: 37; sed: 16
file content (39 lines) | stat: -rwxr-xr-x 948 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

# Copyright (C) 2010 Karel Zak <kzak@redhat.com>

TS_TOPDIR="${0%/*}/../.."
TS_DESC="lock"

. $TS_TOPDIR/functions.sh
ts_init "$*"

TESTPROG="$TS_HELPER_LIBMOUNT_LOCK"

[ -x $TESTPROG ] || ts_skip "test not compiled"

#
# 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
	ts_valgrind $TESTPROG --lock --synctime $SYNCTIME $TS_OUTPUT $NLOOPS >> $TS_OUTPUT.debug 2>&1 &
done

wait

ts_finalize