tests: move getopt to separate directory

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2016-04-22 13:39:31 +02:00
parent d08b58c491
commit b6782d8697
33 changed files with 40 additions and 65 deletions

View File

@ -16,7 +16,7 @@
# file in misc/ directory.
TS_TOPDIR="${0%/*}/../.."
TS_DESC="getopt"
TS_DESC="basic"
. $TS_TOPDIR/functions.sh
ts_init "$*"

View File

@ -13,7 +13,7 @@
# GNU General Public License for more details.
TS_TOPDIR="${0%/*}/../.."
TS_DESC="getopt2"
TS_DESC="options"
. $TS_TOPDIR/functions.sh
@ -190,4 +190,42 @@ echo "exit value: $?" >> $TS_OUTPUT
gnu_getopt_clean
ts_finalize_subtest
ts_init_subtest compatible
$TS_CMD_GETOPT >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
GETOPT_COMPATIBLE='' $TS_CMD_GETOPT >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
sed -i '1,1s/.*\///' $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest sh
$TS_CMD_GETOPT --shell=sh -o ab:c:: --long a-long,b-long:,c-long:: -n 'example.sh' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest csh
$TS_CMD_GETOPT --shell=csh -o ab:c:: --long a-long,b-long:,c-long:: -n 'example.csh' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest no-arguments
$TS_CMD_GETOPT >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
sed -i '1,1s/.*\///' $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest posix_correctly
$TS_CMD_GETOPT -o +ab:c:: --long a-long,b-long:,c-long:: -n 'example' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar xyxxy --a-long >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
POSIXLY_CORRECT='' $TS_CMD_GETOPT -o ab:c:: --long a-long,b-long:,c-long:: -n 'example' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar xyxxy --a-long >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest non-option
$TS_CMD_GETOPT -o +a:b: -- -a x y -b z w >> $TS_OUTPUT 2>&1
$TS_CMD_GETOPT -o a:b: -- -a x y -b z w >> $TS_OUTPUT 2>&1
$TS_CMD_GETOPT -o -a:b: -- -a x y -b z w >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_finalize

View File

@ -1,63 +0,0 @@
#!/bin/bash
# This file is part of util-linux.
#
# 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, or
# (at your option) any later version.
#
# 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
# GNU General Public License for more details.
TS_TOPDIR="${0%/*}/../.."
TS_DESC="getopt3"
. $TS_TOPDIR/functions.sh
ts_init "$*"
ts_check_test_command "$TS_CMD_GETOPT"
export LANG=C
ts_init_subtest compatible
$TS_CMD_GETOPT >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
GETOPT_COMPATIBLE='' $TS_CMD_GETOPT >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
sed -i '1,1s/.*\///' $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest sh
$TS_CMD_GETOPT --shell=sh -o ab:c:: --long a-long,b-long:,c-long:: -n 'example.sh' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest csh
$TS_CMD_GETOPT --shell=csh -o ab:c:: --long a-long,b-long:,c-long:: -n 'example.csh' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest no-arguments
$TS_CMD_GETOPT >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
sed -i '1,1s/.*\///' $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest posix_correctly
$TS_CMD_GETOPT -o +ab:c:: --long a-long,b-long:,c-long:: -n 'example' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar xyxxy --a-long >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
POSIXLY_CORRECT='' $TS_CMD_GETOPT -o ab:c:: --long a-long,b-long:,c-long:: -n 'example' -- -a -b 1 -c2 --a-long --b-long 3 --c-long foo bar xyxxy --a-long >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest non-option
$TS_CMD_GETOPT -o +a:b: -- -a x y -b z w >> $TS_OUTPUT 2>&1
$TS_CMD_GETOPT -o a:b: -- -a x y -b z w >> $TS_OUTPUT 2>&1
$TS_CMD_GETOPT -o -a:b: -- -a x y -b z w >> $TS_OUTPUT 2>&1
echo "exit value: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_finalize