diff options
author | Karel Zak | 2007-06-11 14:45:32 +0200 |
---|---|---|
committer | Karel Zak | 2007-06-11 14:45:32 +0200 |
commit | 1d9acab1c14a4464a757dbd5d68a1bf1dca117b2 (patch) | |
tree | 01ee619146c1bc907775381ef08be7c88e6931e2 /tests | |
parent | docs: clean up TODO file and add a new resuest for 2.14 (diff) | |
download | kernel-qcow2-util-linux-1d9acab1c14a4464a757dbd5d68a1bf1dca117b2.tar.gz kernel-qcow2-util-linux-1d9acab1c14a4464a757dbd5d68a1bf1dca117b2.tar.xz kernel-qcow2-util-linux-1d9acab1c14a4464a757dbd5d68a1bf1dca117b2.zip |
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>
Diffstat (limited to 'tests')
31 files changed, 81 insertions, 70 deletions
diff --git a/tests/commands.sh.in b/tests/commands.sh.in index 26c777918..86f3d11ad 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -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"} + + diff --git a/tests/functions.sh b/tests/functions.sh index ed435092c..a33b885bc 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -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" diff --git a/tests/ts-col-multibyte b/tests/ts-col-multibyte index 00ebb2b3a..4ca11ccb9 100755 --- a/tests/ts-col-multibyte +++ b/tests/ts-col-multibyte @@ -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 diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs index c2d6c131a..4d7ca23dd 100755 --- a/tests/ts-cramfs-mkfs +++ b/tests/ts-cramfs-mkfs @@ -23,7 +23,7 @@ TS_COMPONENT="mkfs.cramfs" TS_DESC="mkfs" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-fstab-devname b/tests/ts-fstab-devname index 30e2414ac..64ab8e577 100755 --- a/tests/ts-fstab-devname +++ b/tests/ts-fstab-devname @@ -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 diff --git a/tests/ts-fstab-devname2label b/tests/ts-fstab-devname2label index 9b7926bad..96ce9acd3 100755 --- a/tests/ts-fstab-devname2label +++ b/tests/ts-fstab-devname2label @@ -27,7 +27,7 @@ TS_DESC="devname2label" LABEL="testMountD2L" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-fstab-devname2uuid b/tests/ts-fstab-devname2uuid index 602ab59f1..e81897e4c 100755 --- a/tests/ts-fstab-devname2uuid +++ b/tests/ts-fstab-devname2uuid @@ -25,7 +25,7 @@ TS_COMPONENT="fstab" TS_DESC="devname2uuid" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-fstab-label b/tests/ts-fstab-label index 8edb342fb..b6be12df6 100755 --- a/tests/ts-fstab-label +++ b/tests/ts-fstab-label @@ -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 diff --git a/tests/ts-fstab-label2devname b/tests/ts-fstab-label2devname index 92497c593..569e0a0dc 100755 --- a/tests/ts-fstab-label2devname +++ b/tests/ts-fstab-label2devname @@ -27,7 +27,7 @@ TS_DESC="label2devname" LABEL="testMountL2D" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-fstab-label2uuid b/tests/ts-fstab-label2uuid index 5467b4602..9579a426d 100755 --- a/tests/ts-fstab-label2uuid +++ b/tests/ts-fstab-label2uuid @@ -27,7 +27,7 @@ TS_DESC="label2uuid" LABEL="testMountL2U" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-fstab-uuid b/tests/ts-fstab-uuid index 0cd7f4dbb..f8a8d5c44 100755 --- a/tests/ts-fstab-uuid +++ b/tests/ts-fstab-uuid @@ -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 diff --git a/tests/ts-fstab-uuid2devname b/tests/ts-fstab-uuid2devname index 531623490..da0e03c0c 100755 --- a/tests/ts-fstab-uuid2devname +++ b/tests/ts-fstab-uuid2devname @@ -25,7 +25,7 @@ TS_COMPONENT="fstab" TS_DESC="uuid2devname" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-fstab-uuid2label b/tests/ts-fstab-uuid2label index 9fa4f6cf6..7f4c0afe2 100755 --- a/tests/ts-fstab-uuid2label +++ b/tests/ts-fstab-uuid2label @@ -27,7 +27,7 @@ TS_DESC="uuid2label" LABEL="testMountU2L" -ts_init "$1" +ts_init "$*" ts_skip_nonroot set -o pipefail diff --git a/tests/ts-hwclock-systohc b/tests/ts-hwclock-systohc index 2bbe9ce1c..63758647d 100755 --- a/tests/ts-hwclock-systohc +++ b/tests/ts-hwclock-systohc @@ -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" diff --git a/tests/ts-ipcs-headers b/tests/ts-ipcs-headers index b8728d6c9..601bea808 100755 --- a/tests/ts-ipcs-headers +++ b/tests/ts-ipcs-headers @@ -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 diff --git a/tests/ts-ipcs-limits b/tests/ts-ipcs-limits index 98656b685..33624de66 100755 --- a/tests/ts-ipcs-limits +++ b/tests/ts-ipcs-limits @@ -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 diff --git a/tests/ts-ipcs-limits2 b/tests/ts-ipcs-limits2 index 05256f97b..1c8307f68 100755 --- a/tests/ts-ipcs-limits2 +++ b/tests/ts-ipcs-limits2 @@ -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 diff --git a/tests/ts-login-checktty b/tests/ts-login-checktty index a79b02d0a..f31efab31 100755 --- a/tests/ts-login-checktty +++ b/tests/ts-login-checktty @@ -6,7 +6,7 @@ TS_COMPONENT="login" TS_DESC="checktty" -ts_init "$1" +ts_init "$*" $TS_CMD_CHECKTTY >> $TS_OUTPUT ts_finalize diff --git a/tests/ts-look-separator b/tests/ts-look-separator index c6f6ed4c6..0a43df8d9 100755 --- a/tests/ts-look-separator +++ b/tests/ts-look-separator @@ -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" diff --git a/tests/ts-mount-devname b/tests/ts-mount-devname index a2ebb332e..cf7450cf0 100755 --- a/tests/ts-mount-devname +++ b/tests/ts-mount-devname @@ -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 diff --git a/tests/ts-mount-label b/tests/ts-mount-label index 2861d531e..f5d0bef5c 100755 --- a/tests/ts-mount-label +++ b/tests/ts-mount-label @@ -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 diff --git a/tests/ts-mount-move b/tests/ts-mount-move index 3b182658a..522b63437 100755 --- a/tests/ts-mount-move +++ b/tests/ts-mount-move @@ -10,7 +10,7 @@ TS_COMPONENT="mount" TS_DESC="move " -ts_init "$1" +ts_init "$*" ts_skip_nonroot PWD=$(pwd) diff --git a/tests/ts-mount-mtablock b/tests/ts-mount-mtablock index 87f807700..edcf723ea 100755 --- a/tests/ts-mount-mtablock +++ b/tests/ts-mount-mtablock @@ -6,7 +6,7 @@ TS_COMPONENT="mount" TS_DESC="mtablock" -ts_init "$1" +ts_init "$*" ts_skip_nonroot # diff --git a/tests/ts-mount-paths b/tests/ts-mount-paths index fe3ef920d..7a8e9ff7d 100755 --- a/tests/ts-mount-paths +++ b/tests/ts-mount-paths @@ -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 diff --git a/tests/ts-mount-remount b/tests/ts-mount-remount index b293572a4..8a2e59edc 100755 --- a/tests/ts-mount-remount +++ b/tests/ts-mount-remount @@ -9,7 +9,7 @@ TS_COMPONENT="mount" TS_DESC="remount" -ts_init "$1" +ts_init "$*" ts_skip_nonroot # mountpoint diff --git a/tests/ts-mount-special b/tests/ts-mount-special index bcdec248f..aeffc2501 100755 --- a/tests/ts-mount-special +++ b/tests/ts-mount-special @@ -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... # diff --git a/tests/ts-mount-uuid b/tests/ts-mount-uuid index cb004e917..64d934c63 100755 --- a/tests/ts-mount-uuid +++ b/tests/ts-mount-uuid @@ -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 diff --git a/tests/ts-namei-logic b/tests/ts-namei-logic index 0a4693c46..2c44c6015 100755 --- a/tests/ts-namei-logic +++ b/tests/ts-namei-logic @@ -6,7 +6,7 @@ TS_COMPONENT="namei" TS_DESC="logic" -ts_init "$1" +ts_init "$*" SANDBOX="$TS_OUTDIR/namei" diff --git a/tests/ts-swapon-devname b/tests/ts-swapon-devname index f8552a6e3..4193fb002 100755 --- a/tests/ts-swapon-devname +++ b/tests/ts-swapon-devname @@ -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 diff --git a/tests/ts-swapon-label b/tests/ts-swapon-label index 0d7dc93a8..0f79340d7 100755 --- a/tests/ts-swapon-label +++ b/tests/ts-swapon-label @@ -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 diff --git a/tests/ts-swapon-uuid b/tests/ts-swapon-uuid index 6e2a90fae..14d79caf3 100755 --- a/tests/ts-swapon-uuid +++ b/tests/ts-swapon-uuid @@ -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 |