summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-23 01:23:29 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-23 01:23:29 +0000
commit3f36c56313e3694e079494690adf610f484d59b8 (patch)
treeacf127476de69e235ca00662c4dab486bba18040
parent5df3a3730011a367c5c8a65c3c9c7e986a0f7a87 (diff)
downloadglibc-3f36c56313e3694e079494690adf610f484d59b8.tar.gz
Update.
2000-07-22 Ulrich Drepper <drepper@redhat.com> * grp/Makefile: Change Makefiles and tests to run only when necessary. * malloc/Makefile: Likewise. * malloc/tst-mtrace.sh: Likewise. * posix/Makefile: Likewise. * posix/globtest.sh: Likewise. * posix/wordexp-tst.sh: Likewise. * string/Makefile: Likewise.
-rw-r--r--ChangeLog10
-rw-r--r--grp/Makefile7
-rw-r--r--malloc/Makefile5
-rwxr-xr-xmalloc/tst-mtrace.sh8
-rw-r--r--posix/Makefile12
-rwxr-xr-xposix/globtest.sh237
-rwxr-xr-xposix/wordexp-tst.sh69
-rw-r--r--string/Makefile4
8 files changed, 290 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c43b47c42..ff9d11c312 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-07-22 Ulrich Drepper <drepper@redhat.com>
+
+ * grp/Makefile: Change Makefiles and tests to run only when necessary.
+ * malloc/Makefile: Likewise.
+ * malloc/tst-mtrace.sh: Likewise.
+ * posix/Makefile: Likewise.
+ * posix/globtest.sh: Likewise.
+ * posix/wordexp-tst.sh: Likewise.
+ * string/Makefile: Likewise.
+
2000-07-22 Mark Kettenis <kettenis@gnu.org>
* locale/findlocale.c (locale_file_list): Use __LC_LAST as array
diff --git a/grp/Makefile b/grp/Makefile
index c4274ed531..286e443911 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -55,9 +55,8 @@ endif
ifeq (no,$(cross-compiling))
# tst_fgetgrent currently only works with shared libraries
ifeq (yes,$(build-shared))
-.PHONY: do-tst-fgetgrent
-tests: do-tst-fgetgrent
-do-tst-fgetgrent: $(objpfx)tst_fgetgrent
+tests: $(objpfx)tst_fgetgrent.out
+$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
$(SHELL) -e tst_fgetgrent.sh $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name)
diff --git a/malloc/Makefile b/malloc/Makefile
index 7831240e3c..7497908707 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -92,9 +92,8 @@ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
lib: $(objpfx)libmcheck.a
ifeq (yes,$(build-shared))
-.PHONY: do-tst-mtrace
-tests: do-tst-mtrace
-do-tst-mtrace: tst-mtrace.sh $(objpfx)tst-mtrace
+tests: $(objpfx)tst-mtrace.out
+$(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace
$(SHELL) -e $< $(common-objpfx)
endif
diff --git a/malloc/tst-mtrace.sh b/malloc/tst-mtrace.sh
index c0c8458e6d..8e12dd08ea 100755
--- a/malloc/tst-mtrace.sh
+++ b/malloc/tst-mtrace.sh
@@ -21,15 +21,19 @@
common_objpfx=$1; shift
status=0
+trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
-MALLOC_TRACE=${common_objpfx}tst-mtrace.out \
+MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${common_objpfx}malloc/tst-mtrace || status=1
if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
${common_objpfx}malloc/mtrace ${common_objpfx}malloc/tst-mtrace \
- ${common_objpfx}tst-mtrace.out || status=1
+ ${common_objpfx}malloc/tst-mtrace.leak \
+ > ${common_objpfx}malloc/tst-mtrace.out|| status=1
fi
+rm -f ${common_objpfx}malloc/tst-mtrace.leak
+
exit $status
diff --git a/posix/Makefile b/posix/Makefile
index eaaa8dd6fa..46c1fed620 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -88,12 +88,11 @@ include ../Rules
ifeq (no,$(cross-compiling))
# globtest and wordexp-test currently only works with shared libraries
ifeq (yes,$(build-shared))
-.PHONY: do-globtest do-wordexp-test
-tests: do-globtest do-wordexp-test
-do-globtest: $(objpfx)globtest
+tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out
+$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
$(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name)
-do-wordexp-test: $(objpfx)wordexp-test
+$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
$(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name)
endif
@@ -160,9 +159,10 @@ endif
# Run a test on the header files we use.
# XXX Please note that for now we ignore the result of this test.
-tests: $(objpfx)annexc
+tests: $(objpfx)annexc.out
+$(objpfx)annexc.out: $(objpfx)annexc
-$(dir $<)$(notdir $<) '$(CC)' \
- '-I../include -I.. $(+sysdep-includes)' > $<.out
+ '-I../include -I.. $(+sysdep-includes)' > $@
$(objpfx)annexc: annexc.c
$(native-compile)
diff --git a/posix/globtest.sh b/posix/globtest.sh
index 956a5e6bb1..92f3e3c488 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -3,6 +3,7 @@
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+logfile=$common_objpfx/posix/globtest.out
# We have to make the paths `common_objpfx' absolute.
case "$common_objpfx" in
@@ -46,12 +47,14 @@ echo 1_2 > $testdir/dir1/file1_2
# Run some tests.
result=0
+rm -f $logfile
# Normal test
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`*file6'
`-file3'
`dir1'
@@ -61,12 +64,17 @@ cat <<"EOF" | cmp - $testout || result=1
`noread'
`~file4'
EOF
+if test $failed -ne 0; then
+ echo "Normal test failed" >> $logfile
+ result=1
+fi
# Don't let glob sort it
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -s "$testdir" "*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`*file6'
`-file3'
`dir1'
@@ -76,12 +84,17 @@ cat <<"EOF" | cmp - $testout || result=1
`noread'
`~file4'
EOF
+if test $failed -ne 0; then
+ echo "No sort test failed" >> $logfile
+ result=1
+fi
# Mark directories
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -m "$testdir" "*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`*file6'
`-file3'
`dir1/'
@@ -91,12 +104,17 @@ cat <<"EOF" | cmp - $testout || result=1
`noread/'
`~file4'
EOF
+if test $failed -ne 0; then
+ echo "Mark directories test failed" >> $logfile
+ result=1
+fi
# Find files starting with .
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -p "$testdir" "*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`*file6'
`-file3'
`.'
@@ -109,207 +127,336 @@ cat <<"EOF" | cmp - $testout || result=1
`noread'
`~file4'
EOF
+if test $failed -ne 0; then
+ echo "Leading period test failed" >> $logfile
+ result=1
+fi
# Test braces
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`file1'
`file2'
EOF
+if test $failed -ne 0; then
+ echo "Braces test failed" >> $logfile
+ result=1
+fi
# Test NOCHECK
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -c "$testdir" "abc" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`abc'
EOF
+if test $failed -ne 0; then
+ echo "No check test failed" >> $logfile
+ result=1
+fi
# Test NOMAGIC without magic characters
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -g "$testdir" "abc" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`abc'
EOF
+if test $failed -ne 0; then
+ echo "No magic test failed" >> $logfile
+ result=1
+fi
# Test NOMAGIC with magic characters
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -g "$testdir" "abc*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "No magic w/ magic chars test failed" >> $logfile
+ result=1
+fi
# Test subdirs correctly
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
`dir1/file1_2'
EOF
+if test $failed -ne 0; then
+ echo "Subdirs test failed" >> $logfile
+ result=1
+fi
# Test subdirs for invalid names
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/1" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Invalid subdir test failed" >> $logfile
+ result=1
+fi
# Test subdirs with wildcard
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
EOF
+if test $failed -ne 0; then
+ echo "Wildcard subdir test failed" >> $logfile
+ result=1
+fi
# Test subdirs with ?
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
`dir1/file1_2'
EOF
+if test $failed -ne 0; then
+ echo "Wildcard2 subdir test failed" >> $logfile
+ result=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
EOF
+if test $failed -ne 0; then
+ echo "Wildcard3 subdir test failed" >> $logfile
+ result=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*-/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Wildcard4 subdir test failed" >> $logfile
+ result=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*-" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Wildcard5 subdir test failed" >> $logfile
+ result=1
+fi
# Test subdirs with ?
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/*?_?" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
`dir1/file1_2'
EOF
+if test $failed -ne 0; then
+ echo "Wildcard6 subdir test failed" >> $logfile
+ result=1
+fi
# Test subdirs with [ .. ]
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
`dir1/file1_2'
EOF
+if test $failed -ne 0; then
+ echo "Brackets test failed" >> $logfile
+ result=1
+fi
# Test ']' inside bracket expression
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
`dir1/file1_2'
EOF
+if test $failed -ne 0; then
+ echo "Brackets2 test failed" >> $logfile
+ result=1
+fi
# Test tilde expansion
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -q -t "$testdir" "~" |
sort >$testout
-echo ~ | cmp - $testout || result=1
+echo ~ | cmp - $testout >> $logfile || failed=1
+if test $failed -ne 0; then
+ echo "Tilde test failed" >> $logfile
+ result=1
+fi
# Test tilde expansion with trailing slash
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
sort > $testout
# Some shell incorrectly(?) convert ~/ into // if ~ expands to /.
if test ~/ = //; then
- echo / | cmp - $testout || result=1
+ echo / | cmp - $testout >> $logfile || failed=1
else
- echo ~/ | cmp - $testout || result=1
+ echo ~/ | cmp - $testout >> $logfile || failed=1
+fi
+if test $failed -ne 0; then
+ echo "Tilde2 test failed" >> $logfile
+ result=1
fi
# Test tilde expansion with username
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
sort > $testout
-eval echo ~$USER | cmp - $testout || result=1
+eval echo ~$USER | cmp - $testout >> $logfile || failed=1
+if test $failed -ne 0; then
+ echo "Tilde3 test failed" >> $logfile
+ result=1
+fi
# Tilde expansion shouldn't match a file
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -T "$testdir" "~file4" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Tilde4 test failed" >> $logfile
+ result=1
+fi
# Matching \** should only find *file6
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "\**" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`*file6'
EOF
+if test $failed -ne 0; then
+ echo "Star test failed" >> $logfile
+ result=1
+fi
# ... unless NOESCAPE is used, in which case it shouldn't match anything.
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -e "$testdir" "\**" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Star2 test failed" >> $logfile
+ result=1
+fi
# Matching \*file6 should find *file6
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "\*file6" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`*file6'
EOF
+if test $failed -ne 0; then
+ echo "Star3 test failed" >> $logfile
+ result=1
+fi
# Try a recursive failed search
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -e "$testdir" "a*/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Star4 test failed" >> $logfile
+ result=1
+fi
# ... with GLOB_ERR
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -E "$testdir" "a*/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Star5 test failed" >> $logfile
+ result=1
+fi
# Try a recursive search in unreadable directory
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "noread/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Star6 test failed" >> $logfile
+ result=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "noread*/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_NOMATCH
EOF
+if test $failed -ne 0; then
+ echo "Star6 test failed" >> $logfile
+ result=1
+fi
# The following tests will fail if run as root.
user=`id -un 2> /dev/null`
@@ -321,52 +468,72 @@ if test "$user" != root; then
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -E "$testdir" "noread/*" |
sort > $testout
- cat <<"EOF" | cmp - $testout || result=1
+ cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_ABORTED
EOF
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -E "$testdir" "noread*/*" |
sort > $testout
- cat <<"EOF" | cmp - $testout || result=1
+ cat <<"EOF" | cmp - $testout >> $logfile || failed=1
GLOB_ABORTED
EOF
+if test $failed -ne 0; then
+ echo "GLOB_ERR test failed" >> $logfile
+ result=1
+fi
fi # not run as root
# Try multiple patterns (GLOB_APPEND)
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest "$testdir" "file1" "*/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/file1_1'
`dir1/file1_2'
`file1'
EOF
+if test $failed -ne 0; then
+ echo "GLOB_APPEND test failed" >> $logfile
+ result=1
+fi
# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS)
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`abc'
`dir1/file1_1'
`dir1/file1_2'
`file1'
EOF
+if test $failed -ne 0; then
+ echo "GLOB_APPEND2 test failed" >> $logfile
+ result=1
+fi
# Test NOCHECK with non-existing file in subdir.
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" |
sort > $testout
-cat <<"EOF" | cmp - $testout || result=1
+cat <<"EOF" | cmp - $testout >> $logfile || failed=1
`dir1/blahblah'
`dir2/blahblah'
`noread/blahblah'
EOF
+if test $failed -ne 0; then
+ echo "No check2 test failed" >> $logfile
+ result=1
+fi
if test $result -eq 0; then
chmod 777 $testdir/noread
rm -fr $testdir $testout
+ echo "All OK." > $logfile
fi
exit $result
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index 43dc0a5ac9..8fe697e07d 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -7,11 +7,13 @@
common_objpfx=$1; shift
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
+logfile=$common_objpfx/posix/wordexp-tst.out
: ${TMPDIR=${common_objpfx}posix}
testout=$TMPDIR/wordexp-test-result
-failed=0
+result=0
+rm -f $logfile
# This is written in this funny way so that there is no trailing whitespace.
# The first line contains a space followed by a tab.
IFS=" \
@@ -19,77 +21,122 @@ IFS=" \
"
export IFS
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
-cat <<"EOF" | cmp - ${testout}1 || failed=1
+cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "$*"
EOF
+if test $failed -ne 0; then
+ echo '$* test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
-cat <<"EOF" | cmp - ${testout}2 || failed=1
+cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "${*}"
we_wordv[1] = "unquoted"
EOF
+if test $failed -ne 0; then
+ echo '${*} test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
-cat <<"EOF" | cmp - ${testout}3 || failed=1
+cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "$@"
we_wordv[1] = "unquoted"
EOF
+if test $failed -ne 0; then
+ echo '$@ test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
-cat <<"EOF" | cmp - ${testout}4 || failed=1
+cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = ""$* quoted" param quoted"
EOF
+if test $failed -ne 0; then
+ echo '$* quoted test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
-cat <<"EOF" | cmp - ${testout}5 || failed=1
+cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = ""$@ quoted""
we_wordv[1] = "param quoted"
EOF
+if test $failed -ne 0; then
+ echo '$@ quoted test failed'
+ status=1
+fi
# Why? Because bash does it that way..
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
-cat <<"EOF" | cmp - ${testout}6 || failed=1
+cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "5"
EOF
+if test $failed -ne 0; then
+ echo '$# test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
-cat <<"EOF" | cmp - ${testout}7 || failed=1
+cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "2nd"
we_wordv[1] = "3rd"
we_wordv[2] = "4"
we_wordv[3] = "th"
EOF
+if test $failed -ne 0; then
+ echo '$2 ${3} $4 test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
-cat <<"EOF" | cmp - ${testout}8 || failed=1
+cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "11"
EOF
+if test $failed -ne 0; then
+ echo '${11} test failed'
+ status=1
+fi
+failed=0
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
-cat <<"EOF" | cmp - ${testout}9 || failed=1
+cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
wordexp returned 0
we_wordv[0] = "a "a $@ b""
we_wordv[1] = "c"
we_wordv[2] = "d b"
EOF
+if test $failed -ne 0; then
+ echo '"a $@ b" test failed'
+ status=1
+fi
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
@@ -105,4 +152,4 @@ we_wordv[6] = "3"
we_wordv[7] = "4*"
EOF
-exit $failed
+exit $result
diff --git a/string/Makefile b/string/Makefile
index 478ee90758..1ec547e9fb 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -62,5 +62,7 @@ CFLAGS-test-ffs.c = -fno-builtin
ifeq ($(cross-compiling),no)
tests: $(objpfx)tst-svc.out
- cmp tst-svc.expect $(objpfx)tst-svc.out
+$(objpfx)tst-svc.out: $(objpfx)tst-svc
+ $(built-program-cmd) $< > $@
+ -cmp tst-svc.expect $(objpfx)tst-svc.out
endif