xfstests: add local.config example
[xfstests-dev.git] / common.bonnie
1 ##/bin/bash
2 #
3 # Copyright (c) 2002-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it would be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write the Free Software Foundation,
16 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 #
18
19 #check bonnie is installed
20 if [ "`whereis bonnie++`" == "bonnie++:"]; then
21         echo $0 error bonnie not installed.
22         exit
23 fi
24
25 run_bonnie()
26 {
27         # dir, no hostname, quiet, fast (no per-char), ram (no sz checks)
28         tmp=/var/tmp
29
30         mkdir ./bonnie || exit 1
31         defaults="-d ./bonnie -q -f -r 0"
32         defaults="$defaults -u "`id -u`" -g "`id -g`
33         bonnie++ -m '' $defaults $@ >$tmp/$$.bonnie.stdout 2>$tmp/$$.bonnie.stderr
34         status=$?
35         rm -fr ./bonnie
36         [ $status -ne 0 ] && exit 1
37         filter_stdout < $tmp/$$.bonnie.stdout
38         filter_stderr < $tmp/$$.bonnie.stderr 1>&2
39         rm -f $tmp/$$.bonnie.stdout $tmp/$$.bonnie.stderr
40         exit 0
41 }