summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2010-03-19 12:27:45 +0100
committerJim Meyering <meyering@redhat.com>2010-03-19 13:13:08 +0100
commit3dcbcf98f427f8ab6ceafd27396adae4b2276bb8 (patch)
tree2a97cd0989dbc0848404bf9a8d1c3d67570ce949
parentdd9df4ab02e523502ecda57512caa3984e3d43dd (diff)
downloadcoreutils-3dcbcf98f427f8ab6ceafd27396adae4b2276bb8.tar.xz
tests: change help-version to per-program functions
* help-version: Change each *_args variable to a *_setup function.
-rwxr-xr-xtests/misc/help-version156
1 files changed, 82 insertions, 74 deletions
diff --git a/tests/misc/help-version b/tests/misc/help-version
index 063c3ebf8..976d18a31 100755
--- a/tests/misc/help-version
+++ b/tests/misc/help-version
@@ -115,107 +115,111 @@ tmp_out=out-$$
mkdir $tmp || fail=1
cd $tmp || fail=1
-comm_args="$tmp_in $tmp_in"
-csplit_args="$tmp_in //"
-cut_args='-f 1'
-join_args="$tmp_in $tmp_in"
-tr_args='a a'
+comm_setup () { args="$tmp_in $tmp_in"; }
+csplit_setup () { args="$tmp_in //"; }
+cut_setup () { args='-f 1'; }
+join_setup () { args="$tmp_in $tmp_in"; }
+tr_setup () { args='a a'; }
-chmod_args="a+x $tmp_in"
+chmod_setup () { args="a+x $tmp_in"; }
# Punt on these.
-chgrp_args=--version
-chown_args=--version
-mkfifo_args=--version
-mknod_args=--version
+chgrp_setup () { args=--version; }
+chown_setup () { args=--version; }
+mkfifo_setup () { args=--version; }
+mknod_setup () { args=--version; }
# Punt on uptime, since it fails (e.g., failing to get boot time)
# on some systems, and we shouldn't let that stop `make check'.
-uptime_args=--version
+uptime_setup () { args=--version; }
# Create a file in the current directory, not in $TMPDIR.
-mktemp_args=mktemp.XXXX
+mktemp_setup () { args=mktemp.XXXX; }
-cmp_args="$tmp_in $tmp_in2"
+cmp_setup () { args="$tmp_in $tmp_in2"; }
# Tell dd not to print the line with transfer rate and total.
# The transfer rate would vary between runs.
-dd_args=status=noxfer
-
-zdiff_args="$zin $zin2"
-zcmp_args="$zin $zin2"
-zcat_args=$zin
-gunzip_args=$zin
-zmore_args=$zin
-zless_args=$zin
-znew_args=$bigZ_in
-zforce_args=$zin
-zgrep_args="z $zin"
-zegrep_args="z $zin"
-zfgrep_args="z $zin"
-gzexe_args=$tmp_in
+dd_setup () { args=status=noxfer; }
+
+zdiff_setup () { args="$zin $zin2"; }
+zcmp_setup () { args="$zin $zin2"; }
+zcat_setup () { args=$zin; }
+gunzip_setup () { args=$zin; }
+zmore_setup () { args=$zin; }
+zless_setup () { args=$zin; }
+znew_setup () { args=$bigZ_in; }
+zforce_setup () { args=$zin; }
+zgrep_setup () { args="z $zin"; }
+zegrep_setup () { args="z $zin"; }
+zfgrep_setup () { args="z $zin"; }
+gzexe_setup () { args=$tmp_in; }
# We know that $tmp_in contains a "0"
-grep_args="0 $tmp_in"
-egrep_args="0 $tmp_in"
-fgrep_args="0 $tmp_in"
-
-diff_args="$tmp_in $tmp_in2"
-sdiff_args="$tmp_in $tmp_in2"
-diff3_args="$tmp_in $tmp_in2 $tmp_in2"
-cp_args="$tmp_in $tmp_in2"
-ln_args="$tmp_in ln-target"
-ginstall_args="$tmp_in $tmp_in2"
-mv_args="$tmp_in $tmp_in2"
-mkdir_args=$tmp_dir/subdir
-rmdir_args=$tmp_dir
-rm_args=$tmp_in
-shred_args=$tmp_in
-touch_args=$tmp_in2
-truncate_args="--reference=$tmp_in $tmp_in2"
-
-basename_args=$tmp_in
-dirname_args=$tmp_in
-expr_args=foo
+grep_setup () { args="0 $tmp_in"; }
+egrep_setup () { args="0 $tmp_in"; }
+fgrep_setup () { args="0 $tmp_in"; }
+
+diff_setup () { args="$tmp_in $tmp_in2"; }
+sdiff_setup () { args="$tmp_in $tmp_in2"; }
+diff3_setup () { args="$tmp_in $tmp_in2 $tmp_in2"; }
+cp_setup () { args="$tmp_in $tmp_in2"; }
+ln_setup () { args="$tmp_in ln-target"; }
+ginstall_setup () { args="$tmp_in $tmp_in2"; }
+mv_setup () { args="$tmp_in $tmp_in2"; }
+mkdir_setup () { args=$tmp_dir/subdir; }
+rmdir_setup () { args=$tmp_dir; }
+rm_setup () { args=$tmp_in; }
+shred_setup () { args=$tmp_in; }
+touch_setup () { args=$tmp_in2; }
+truncate_setup () { args="--reference=$tmp_in $tmp_in2"; }
+
+basename_setup () { args=$tmp_in; }
+dirname_setup () { args=$tmp_in; }
+expr_setup () { args=foo; }
# Punt, in case GNU `id' hasn't been installed yet.
-groups_args=--version
-
-pathchk_args=$tmp_in
-yes_args=--version
-logname_args=--version
-nohup_args=--version
-printf_args=foo
-seq_args=10
-sleep_args=0
-su_args=--version
-stdbuf_args="-oL true"
-timeout_args=--version
+groups_setup () { args=--version; }
+
+pathchk_setup () { args=$tmp_in; }
+yes_setup () { args=--version; }
+logname_setup () { args=--version; }
+nohup_setup () { args=--version; }
+printf_setup () { args=foo; }
+seq_setup () { args=10; }
+sleep_setup () { args=0; }
+su_setup () { args=--version; }
+stdbuf_setup () { args="-oL true"; }
+timeout_setup () { args=--version; }
# I'd rather not run sync, since it spins up disks that I've
# deliberately caused to spin down (but not unmounted).
-sync_args=--version
+sync_setup () { args=--version; }
-test_args=foo
+test_setup () { args=foo; }
# This is necessary in the unusual event that there is
# no valid entry in /etc/mtab.
-df_args=/
+df_setup () { args=/; }
# This is necessary in the unusual event that getpwuid (getuid ()) fails.
-id_args=-u
+id_setup () { args=-u; }
# Use env to avoid invoking built-in sleep of Solaris 11's /bin/sh.
-env sleep 10m &
-kill_args=$!
+kill_setup () {
+ env sleep 10m &
+ args=$!
+}
-link_args="$tmp_in link-target"
-unlink_args=$tmp_in
+link_setup () { args="$tmp_in link-target"; }
+unlink_setup () { args=$tmp_in; }
-ln -s . slink
-readlink_args=slink
+readlink_setup () {
+ ln -s . slink
+ args=slink;
+}
-stat_args=$tmp_in
-unlink_args=$tmp_in
-lbracket_args=": ]"
+stat_setup () { args=$tmp_in; }
+unlink_setup () { args=$tmp_in; }
+lbracket_setup () { args=": ]"; }
# Ensure that each program "works" (exits successfully) when doing
# something more than --help or --version.
@@ -237,7 +241,11 @@ for i in $built_programs; do
mkdir $tmp_dir
# echo ================== $i
test $i = [ && prog=lbracket || prog=$i
- eval "args=\$${prog}_args"
+ if type ${prog}_setup > /dev/null 2>&1; then
+ ${prog}_setup
+ else
+ args=
+ fi
if env $i $args < $tmp_in > $tmp_out; then
: # ok
else