mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
771e69de67
While most tests use /bin/sh, they are dependent on /bin/sh being a bash shell. Convert all the tests to execute via /bin/bash as it is much, much simpler than trying to debug and remove all the bashisms throughout the test code. Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
74 lines
1.7 KiB
Plaintext
Executable File
74 lines
1.7 KiB
Plaintext
Executable File
##/bin/bash
|
|
#
|
|
# Copyright (c) 2002-2005 Silicon Graphics, Inc. All Rights Reserved.
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it would be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write the Free Software Foundation,
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#
|
|
|
|
#check dbench is installed
|
|
if [ "`whereis dbench`" == "dbench:"]; then
|
|
echo $0 error dbench not installed.
|
|
exit
|
|
fi
|
|
|
|
_run_dbench()
|
|
{
|
|
mkdir ./dbench || exit 1
|
|
cd dbench
|
|
dbench -x $1
|
|
status=$?
|
|
cd ..
|
|
rm -fr ./dbench
|
|
[ $status -ne 0 ] && exit 1
|
|
}
|
|
|
|
#
|
|
# Sample dbench output:
|
|
# "Throughput 40.6701 MB/sec (NB=50.8376 MB/sec 406.701 MBit/sec)"
|
|
#
|
|
|
|
# Output for a single-shot dbench run.
|
|
_format_header()
|
|
{
|
|
printf "%8s, %s\n" clients MB/sec
|
|
}
|
|
_filter_dbench()
|
|
{
|
|
clients=$1
|
|
perl -ne 'm/Throughput (\S+) MB\/sec/ &&
|
|
{ printf "%8u, %s\n", '$clients', $1 }'
|
|
}
|
|
|
|
# Output for a "multipass" dbench run.
|
|
_format_header_multipass()
|
|
{
|
|
while [ $# -gt 1 ]; do
|
|
printf "%4s::MB/sec," $1
|
|
shift
|
|
done
|
|
printf "%4s::MB/sec\n" $1
|
|
}
|
|
_filter_dbench_multipass()
|
|
{
|
|
perl -ne '
|
|
if (m/Throughput (\S+) MB\/sec/) {
|
|
$results[$count++] = $1;
|
|
}
|
|
END { for ($i = 0; $i < $count - 1; $i++) {
|
|
printf "%12.3f,", $results[$i];
|
|
}
|
|
printf "%12.3f\n", $results[$count-1];
|
|
}'
|
|
}
|