tests: pass all arguments to ts_init, add ts_has_option function

This patch:
	- replaces "$1" with "$*" for ts_init function
	- add ts_has_option function
	- removes some tailing white-spaces

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2007-06-11 14:45:32 +02:00
parent 883fff9f85
commit 1d9acab1c1
31 changed files with 81 additions and 70 deletions

View File

@ -3,6 +3,7 @@ TS_TOPDIR=$TOPDIR/tests
# helpers
TS_HELPER_SYSINFO="$TS_TOPDIR/helpers/mnt_test_sysinfo"
TS_HELPER_LIBPRELOAD_TIME="$TS_TOPDIR/helpers/.libs/libpreload-time.so"
# external commands
TS_ECMD_BLKID="@BLKID@"
@ -26,8 +27,11 @@ TS_CMD_COL=${TS_CMD_COL:-"$TOPDIR/text-utils/col"}
TS_CMD_NAMEI=${TS_CMD_NAMEI-"$TOPDIR/misc-utils/namei"}
TS_CMD_LOOK=${TS_CMD_LOOK-"$TOPDIR/misc-utils/look"}
TS_CMD_CAL=${TS_CMD_CAL-"$TOPDIR/misc-utils/cal"}
TS_CMD_CHECKTTY=${TS_CMD_CHECKTTY-"$TOPDIR/login-utils/checktty_test"}
TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"$TOPDIR/hwclock/hwclock"}

View File

@ -42,6 +42,12 @@ function ts_log {
[ "$TS_VERBOSE" == "yes" ] && echo "$1"
}
function ts_has_option {
NAME="$1"
ALL="$2"
echo -n $ALL | sed 's/ //g' | gawk 'BEGIN { FS="="; RS="--" } /('$NAME'$|'$NAME'=)/ { print "yes" }'
}
function ts_init {
export LANG="en_US.UTF-8":
TS_NAME=$(basename $0)
@ -51,7 +57,8 @@ function ts_init {
if [ ! -d $TS_DIFFDIR ]; then
mkdir -p $TS_DIFFDIR
fi
[ "$1" == "--verbose" ] && TS_VERBOSE="yes"
TS_VERBOSE=$( ts_has_option "verbose" "$*")
TS_OUTPUT="$TS_OUTDIR/$TS_NAME"
TS_DIFF="$TS_DIFFDIR/$TS_NAME"
TS_EXPECTED="$TS_EXPECTEDDIR/$TS_NAME"

View File

@ -6,7 +6,7 @@
TS_COMPONENT="col"
TS_DESC="multibyte"
ts_init "$1"
ts_init "$*"
cat $TS_INPUT | $TS_CMD_COL > /dev/null 2> $TS_OUTPUT

View File

@ -23,7 +23,7 @@
TS_COMPONENT="mkfs.cramfs"
TS_DESC="mkfs"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
TS_COMPONENT="fstab"
TS_DESC="devname"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -27,7 +27,7 @@ TS_DESC="devname2label"
LABEL="testMountD2L"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -25,7 +25,7 @@
TS_COMPONENT="fstab"
TS_DESC="devname2uuid"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -23,7 +23,7 @@ TS_DESC="label"
LABEL="testFstabLabel"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail
@ -31,7 +31,7 @@ set -o pipefail
DEVICE=$(ts_device_init)
[ "$?" == 0 ] || ts_die "Cannot init device"
mkfs.ext3 -L $LABEL $DEVICE &> /dev/null
mkfs.ext3 -L $LABEL $DEVICE &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has "LABEL" $LABEL $DEVICE

View File

@ -27,7 +27,7 @@ TS_DESC="label2devname"
LABEL="testMountL2D"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -27,7 +27,7 @@ TS_DESC="label2uuid"
LABEL="testMountL2U"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
TS_COMPONENT="fstab"
TS_DESC="uuid"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail
@ -29,7 +29,7 @@ set -o pipefail
DEVICE=$(ts_device_init)
[ "$?" == 0 ] || ts_die "Cannot init device"
mkfs.ext3 $DEVICE &> /dev/null
mkfs.ext3 $DEVICE &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has_uuid $DEVICE

View File

@ -25,7 +25,7 @@
TS_COMPONENT="fstab"
TS_DESC="uuid2devname"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -27,7 +27,7 @@ TS_DESC="uuid2label"
LABEL="testMountU2L"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -25,7 +25,7 @@ TS_DESC="systohc"
NTP_SERVER="0.fedora.pool.ntp.org"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
[ -x "/usr/sbin/ntpdate" ] || ts_skip "cannot found ntpdate command"

View File

@ -6,7 +6,7 @@
TS_COMPONENT="ipcs"
TS_DESC="headers"
ts_init "$1"
ts_init "$*"
ts_log "test: shm headers"
$TS_CMD_IPCS -m -t | grep --after-context=1 "^---" >> $TS_OUTPUT

View File

@ -7,19 +7,19 @@ TS_COMPONENT="ipcs"
TS_DESC="limits overflow"
if [ $UID != 0 ]; then
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
fi
. ts-ipcs.sh
ts_init "$1"
ts_init "$*"
ts_log "load original values"
for i in $IPCS_IDX; do
SHM_ORG[$i]=$(cat ${IPCS_PROCFILES[$i]})
done >> $TS_OUTPUT
ts_log "check for difference between kernel and IPC"
ipcs_limits_check >> $TS_OUTPUT

View File

@ -8,7 +8,7 @@ TS_DESC="basic limits"
. ts-ipcs.sh
ts_init "$1"
ts_init "$*"
ts_log "check for difference between kernel and IPC"
ipcs_limits_check >> $TS_OUTPUT

View File

@ -6,7 +6,7 @@
TS_COMPONENT="login"
TS_DESC="checktty"
ts_init "$1"
ts_init "$*"
$TS_CMD_CHECKTTY >> $TS_OUTPUT
ts_finalize

View File

@ -18,7 +18,7 @@
TS_COMPONENT="look"
TS_DESC="separator"
ts_init "$1"
ts_init "$*"
[ -f "/usr/share/dict/words" ] || ts_skip "/usr/share/dict/words not such file"

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
TS_COMPONENT="mount"
TS_DESC="devname"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail
@ -29,7 +29,7 @@ set -o pipefail
DEVICE=$(ts_device_init)
[ "$?" == 0 ] || ts_die "Cannot init device"
mkfs.ext3 $DEVICE &> /dev/null
mkfs.ext3 $DEVICE &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has "TYPE" "ext3" $DEVICE

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -23,7 +23,7 @@ TS_DESC="label"
LABEL="testMountLabel"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail
@ -31,7 +31,7 @@ set -o pipefail
DEVICE=$(ts_device_init)
[ "$?" == 0 ] || ts_die "Cannot init device"
mkfs.ext3 -L $LABEL $DEVICE &> /dev/null
mkfs.ext3 -L $LABEL $DEVICE &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has "LABEL" $LABEL $DEVICE

View File

@ -10,7 +10,7 @@
TS_COMPONENT="mount"
TS_DESC="move "
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
PWD=$(pwd)

View File

@ -6,7 +6,7 @@
TS_COMPONENT="mount"
TS_DESC="mtablock"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
#

View File

@ -6,7 +6,7 @@
TS_COMPONENT="mount"
TS_DESC="basic paths"
ts_init "$1"
ts_init "$*"
$TS_CMD_MOUNT -n -f -v -v -v /dev/dummy /mnt &> $TS_OUTPUT

View File

@ -9,7 +9,7 @@
TS_COMPONENT="mount"
TS_DESC="remount"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
# mountpoint

View File

@ -12,11 +12,11 @@ TS_DESC="special program"
MOUNTER="/sbin/mount.mytest"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
cat > $MOUNTER << EOF
#!/bin/bash
#!/bin/bash
# This util-linux-ng regression test component
# It's safe to remove me...
#

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
TS_COMPONENT="mount"
TS_DESC="uuid"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail
@ -29,7 +29,7 @@ set -o pipefail
DEVICE=$(ts_device_init)
[ "$?" == 0 ] || ts_die "Cannot init device"
mkfs.ext3 $DEVICE &> /dev/null
mkfs.ext3 $DEVICE &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has_uuid $DEVICE

View File

@ -6,7 +6,7 @@
TS_COMPONENT="namei"
TS_DESC="logic"
ts_init "$1"
ts_init "$*"
SANDBOX="$TS_OUTDIR/namei"

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
TS_COMPONENT="swapon"
TS_DESC="devname"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -23,7 +23,7 @@ TS_DESC="label"
LABEL="testSwapLabel"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail

View File

@ -1,14 +1,14 @@
#!/bin/bash
#
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
#
# This file is part of util-linux-ng.
#
#
# This file 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; either version 2 of the License.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
TS_COMPONENT="swapon"
TS_DESC="uuid"
ts_init "$1"
ts_init "$*"
ts_skip_nonroot
set -o pipefail