summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/install/basic-1.sh10
-rw-r--r--tests/local.mk3
-rwxr-xr-xtests/misc/coreutils.sh36
-rwxr-xr-xtests/misc/env.sh15
-rwxr-xr-xtests/misc/help-version.sh2
5 files changed, 56 insertions, 10 deletions
diff --git a/tests/install/basic-1.sh b/tests/install/basic-1.sh
index 9835d463e..0c0d1de86 100755
--- a/tests/install/basic-1.sh
+++ b/tests/install/basic-1.sh
@@ -46,13 +46,17 @@ is not readable, so skipping the remaining tests in this file."
cp "$just_built_dd" . || fail=1
cp $dd $dd2 || fail=1
-strip $dd2 \
- || warn_ "WARNING!!! Your strip command doesn't seem to work,
+strip=-s
+if ! strip $dd2; then
+ ! test -e $abs_top_builddir/src/coreutils \
+ && warn_ "WARNING!!! Your strip command doesn't seem to work,
so skipping the test of install's --strip option."
+ strip=
+fi
# This test would fail with 3.16s when using versions of strip that
# don't work on read-only files (the one from binutils works fine).
-ginstall -s -c -m 555 $dd $dir || fail=1
+ginstall $strip -c -m 555 $dd $dir || fail=1
# Make sure the source file is still around.
test -f $dd || fail=1
diff --git a/tests/local.mk b/tests/local.mk
index 86050dc79..e0f1f84ee 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -65,7 +65,7 @@ TESTS_ENVIRONMENT = \
abs_top_builddir='$(abs_top_builddir)' \
abs_top_srcdir='$(abs_top_srcdir)' \
abs_srcdir='$(abs_srcdir)' \
- built_programs='$(built_programs)' \
+ built_programs='$(built_programs) $(single_binary_progs)' \
host_os=$(host_os) \
host_triplet='$(host_triplet)' \
srcdir='$(srcdir)' \
@@ -249,6 +249,7 @@ all_tests = \
tests/pr/pr-tests.pl \
tests/misc/pwd-option.sh \
tests/misc/chcon-fail.sh \
+ tests/misc/coreutils.sh \
tests/misc/cut.pl \
tests/misc/cut-huge-range.sh \
tests/misc/wc.pl \
diff --git a/tests/misc/coreutils.sh b/tests/misc/coreutils.sh
new file mode 100755
index 000000000..a22bc9f64
--- /dev/null
+++ b/tests/misc/coreutils.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Verify behavior of separate coreutils multicall binary
+
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ coreutils
+
+test -s "$abs_top_builddir/src/coreutils.h" \
+ || skip_ "multicall binary is disabled"
+
+# Yes outputs all its params so is good to verify argv manipulations
+echo 'y' > exp
+coreutils --coreutils-prog=yes | head -n10 | uniq > out
+compare exp out || fail=1
+
+# Ensure if incorrect program passed, we diagnose
+echo "coreutils: unknown program 'blah'" > exp
+coreutils --coreutils-prog='blah' --help 2>err && fail=1
+compare exp err || fail=1
+
+Exit $fail
diff --git a/tests/misc/env.sh b/tests/misc/env.sh
index c4b97377a..883c58f54 100755
--- a/tests/misc/env.sh
+++ b/tests/misc/env.sh
@@ -20,6 +20,10 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ env
+# A simple shebang program to call "echo" from symlinks like "./-u" or "./--".
+echo "#!$abs_top_builddir/src/echo simple_echo" > simple_echo \
+ || framework_failure_
+chmod a+x simple_echo || framework_failure_
# Verify clearing the environment
a=1
@@ -105,9 +109,10 @@ export PATH
# Use -- to end options (but not variable assignments).
# On some systems, execve("-i") invokes a shebang script ./-i on PATH as
# '/bin/sh -i', rather than '/bin/sh -- -i', which doesn't do what we want.
-# Avoid the issue by using an executable rather than a script.
+# Avoid the issue by using a shebang to 'echo' passing a second parameter
+# before the '-i'. See the definition of simple_echo before.
# Test -u, rather than -i, to minimize PATH problems.
-ln -s "$abs_top_builddir/src/echo" ./-u || framework_failure_
+ln -s "simple_echo" ./-u || framework_failure_
case $(env -u echo echo good) in
good) ;;
*) fail=1 ;;
@@ -117,16 +122,16 @@ case $(env -u echo -- echo good) in
*) fail=1 ;;
esac
case $(env -- -u pass) in
- pass) ;;
+ *pass) ;;
*) fail=1 ;;
esac
# After options have ended, the first argument not containing = is a program.
env a=b -- true
test $? = 127 || fail=1
-ln -s "$abs_top_builddir/src/echo" ./-- || framework_failure_
+ln -s "simple_echo" ./-- || framework_failure_
case $(env a=b -- true || echo fail) in
- true) ;;
+ *true) ;;
*) fail=1 ;;
esac
diff --git a/tests/misc/help-version.sh b/tests/misc/help-version.sh
index b4939f7af..0598557f2 100755
--- a/tests/misc/help-version.sh
+++ b/tests/misc/help-version.sh
@@ -239,7 +239,7 @@ parted_setup () { args="-s $tmp_in mklabel gpt"
# something more than --help or --version.
for i in $built_programs; do
# Skip these.
- case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
+ case $i in chroot|stty|tty|false|chcon|runcon|coreutils) continue;; esac
rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out $bigZ_in $zin $zin2
echo z |gzip > $zin