From cc189e7daf95b91d22c585b2cdf6b787c8e3c3c6 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Wed, 30 Oct 2013 17:21:38 +1300 Subject: tests: use $SED throughout. Trust the user, and use $SED from TESTS_ENVIRONMENT uniformly. Hardcoding 'sed' for "simple" edits is a premature optimisation. * tests/cdemo.at, tests/cmdline_wrap.at, tests/cwrapper.at, tests/darwin.at, tests/demo.at, tests/duplicate_conv.at, tests/duplicate_members.at, tests/execute-mode.at, tests/export.at, tests/inherited_flags.at, tests/install.at, tests/libtoolize.at, tests/mdemo.at, tests/need_lib_prefix.at, tests/old-m4-iface.at, tests/sysroot.at, tests/tagdemo.at, tests/testsuite.at: Replace all hardcoded sed invocations with $SED. Signed-off-by: Gary V. Vaughan --- tests/cdemo.at | 2 +- tests/cmdline_wrap.at | 2 +- tests/cwrapper.at | 6 +++--- tests/darwin.at | 4 ++-- tests/demo.at | 6 +++--- tests/duplicate_conv.at | 2 +- tests/duplicate_members.at | 2 +- tests/execute-mode.at | 8 ++++---- tests/export.at | 2 +- tests/inherited_flags.at | 8 ++++---- tests/install.at | 2 +- tests/libtoolize.at | 3 --- tests/mdemo.at | 2 +- tests/need_lib_prefix.at | 2 +- tests/old-m4-iface.at | 2 +- tests/sysroot.at | 2 +- tests/tagdemo.at | 2 +- tests/testsuite.at | 8 ++++---- 18 files changed, 31 insertions(+), 34 deletions(-) (limited to 'tests') diff --git a/tests/cdemo.at b/tests/cdemo.at index 8f045ea4..47f69fcf 100644 --- a/tests/cdemo.at +++ b/tests/cdemo.at @@ -186,7 +186,7 @@ LT_AT_CHECK_CONFIG([--disable-static]) AT_CHECK([$EGREP "^allow_undefined_flag=.\{0,1\}unsupported.\{0,1\}$" libtool && (exit 77)], 1, [ignore]) -sed 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool +$SED 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool LT_AT_CHECK_EXECUTE([], [./cdemo]) diff --git a/tests/cmdline_wrap.at b/tests/cmdline_wrap.at index f5f5832d..526ae92c 100644 --- a/tests/cmdline_wrap.at +++ b/tests/cmdline_wrap.at @@ -33,7 +33,7 @@ AT_CHECK([test -z "$fail_list" || (exit 77)]) m4_ifdef([AT_CAPTURE_FILE], [AT_CAPTURE_FILE([testsuite.log])]) -sed 's|max_cmd_len=.*|max_cmd_len="24"|' < $LIBTOOL > libtool +$SED 's|max_cmd_len=.*|max_cmd_len="24"|' < $LIBTOOL > libtool chmod +x libtool LIBTOOL=`pwd`/libtool export LIBTOOL diff --git a/tests/cwrapper.at b/tests/cwrapper.at index 5588f26f..03b0e8c1 100644 --- a/tests/cwrapper.at +++ b/tests/cwrapper.at @@ -57,7 +57,7 @@ orig_CFLAGS=$CFLAGS orig_LIBTOOL=$LIBTOOL for restrictive_flags in '-Wall -Werror' '-std=c89 -Wall -Werror' '-std=c99 -Wall -Werror'; do CFLAGS="$orig_CFLAGS $restrictive_flags" - sed "s/LTCFLAGS=.*/&' $restrictive_flags'/" < "$orig_LIBTOOL" > ./libtool + $SED "s/LTCFLAGS=.*/&' $restrictive_flags'/" < "$orig_LIBTOOL" > ./libtool chmod +x libtool LIBTOOL=./libtool @@ -106,8 +106,8 @@ AT_CHECK([grep 'libtool wrapper' stderr], [0], [ignore], [ignore]) # if necessary -- even though the loop by design executes only once. for debugwrapper_flags in '-DLT_DEBUGWRAPPER'; do CFLAGS="$orig_CFLAGS $debugwrapper_flags" - sed -e "s/LTCFLAGS=.*/&' $debugwrapper_flags'/" \ - -e "s/^lt_option_debug=/lt_option_debug=1/" \ + $SED -e "s/LTCFLAGS=.*/&' $debugwrapper_flags'/" \ + -e "s/^lt_option_debug=/lt_option_debug=1/" \ < "$orig_LIBTOOL" > ./libtool LIBTOOL=./libtool diff --git a/tests/darwin.at b/tests/darwin.at index 3ace4937..0d6e9139 100644 --- a/tests/darwin.at +++ b/tests/darwin.at @@ -74,7 +74,7 @@ if test $# != 1; then exit 1 fi -echo $1 | sed "s|^.*/||" +echo $1 | $SED "s|^.*/||" ]]) chmod +x bin/basename @@ -114,7 +114,7 @@ cp bar.c baz.c objects= for obj in 1 2 3 4 5 6 7 8; do - sed "s/foo/foo$obj/" < foo.c > foo$obj.c + $SED "s/foo/foo$obj/" < foo.c > foo$obj.c AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c foo$obj.c], [], [ignore], [ignore]) objects="$objects foo$obj.lo" diff --git a/tests/demo.at b/tests/demo.at index c0a14861..6a7556d7 100644 --- a/tests/demo.at +++ b/tests/demo.at @@ -555,13 +555,13 @@ CLEANFILES = $(hardcode_tests) # Unfortunately, in order to test libtool thoroughly, we need access # to its private directory. -objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'` +objdir = `$(LIBTOOL) --config | $(SED) -n -e 's/^objdir=\(.*\)$$/\1/p'` # Test programs to see what gets hardcoded. .PHONY: hardcode hardcode: $(hardcode_tests) SET_HARDCODE_FLAGS = \ - eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'` + eval `$(LIBTOOL) --config | $(SED) -n -e '/^hardcode_.*=/p; /^wl=/p'` hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la @rm -f hc-direct @echo "You may ignore any linking errors from the following command:" @@ -668,7 +668,7 @@ for file in hc-*; do elif $FGREP "$objdir" $file > /dev/null 2>&1; then # We retry fgrep without tr, in case the above lead to a false negative. hardcoded=yes - elif (sed -e '1!d' $file | grep 'unsupported') >/dev/null 2>&1; then + elif ($SED -e '1!d' $file | grep 'unsupported') >/dev/null 2>&1; then hardcoded=unsupported fi diff --git a/tests/duplicate_conv.at b/tests/duplicate_conv.at index 2e7a3a41..d3449406 100644 --- a/tests/duplicate_conv.at +++ b/tests/duplicate_conv.at @@ -25,7 +25,7 @@ AT_SETUP([duplicate convenience archive names]) AT_KEYWORDS([libtool]) -eval `$LIBTOOL --config | sed -n '/^reload_cmds=/,/^$/p'` +eval `$LIBTOOL --config | $SED -n '/^reload_cmds=/,/^$/p'` # We create two convenience archives with the same name, and _also_ # containing an object with the same name. This is necessary to detect diff --git a/tests/duplicate_members.at b/tests/duplicate_members.at index 2555244f..c8483f52 100755 --- a/tests/duplicate_members.at +++ b/tests/duplicate_members.at @@ -27,7 +27,7 @@ AT_SETUP([duplicate members in archive tests]) AT_KEYWORDS([libtool]) # we don't want to use whole_archive_flag_spec, even if available -sed -e 's|^whole_archive_flag_spec=.*|whole_archive_flag_spec=|g' < $LIBTOOL > libtool +$SED -e 's|^whole_archive_flag_spec=.*|whole_archive_flag_spec=|g' < $LIBTOOL > libtool chmod +x ./libtool LIBTOOL=./libtool diff --git a/tests/execute-mode.at b/tests/execute-mode.at index 0b622384..e039b2da 100644 --- a/tests/execute-mode.at +++ b/tests/execute-mode.at @@ -194,20 +194,20 @@ do AT_CHECK([$LIBTOOL --mode=execute ./foo abc "$arg1" "$arg2" xyz], [], [stdout], [ignore]) AT_CHECK([$FGREP "$arg1" stdout], [], [ignore]) AT_CHECK([test -z "$arg2" || $FGREP "$arg2" stdout], [], [ignore]) - AT_CHECK([test `sed -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4]) + AT_CHECK([test `$SED -n '/^abc$/,/^xyz$/p' stdout | wc -l` -eq 4]) AT_CHECK([$LIBTOOL --mode=execute ./lt-wrapper abc "$arg1" "$arg2" xyz can-hide case $archive_expsym_cmds in *-retain-symbols-file*) echo false >can-hide ;; diff --git a/tests/inherited_flags.at b/tests/inherited_flags.at index ac97ec18..b132ce83 100644 --- a/tests/inherited_flags.at +++ b/tests/inherited_flags.at @@ -62,15 +62,15 @@ $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libboth.la both.lo -rpath mv libfoo.la libfoo.la.bak -sed -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_inlikely_existing_lib/g' < libfoo.la.bak > libfoo.la +$SED -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_inlikely_existing_lib/g' < libfoo.la.bak > libfoo.la rm libfoo.la.bak mv libbar.la libbar.la.bak -sed -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g' < libbar.la.bak > libbar.la +$SED -e 's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g' < libbar.la.bak > libbar.la rm libbar.la.bak mv libboth.la libboth.la.bak -sed -e "s/^inherited_linker_flags.*/inherited_linker_flags='-llt_inlikely_existing_lib -llt_unlikely_existing_lib'/g" < libboth.la.bak > libboth.la +$SED -e "s/^inherited_linker_flags.*/inherited_linker_flags='-llt_inlikely_existing_lib -llt_unlikely_existing_lib'/g" < libboth.la.bak > libboth.la rm libboth.la.bak AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la baz.lo -no-undefined -rpath /nonexistent ./libfoo.la ./libbar.la], @@ -102,7 +102,7 @@ AT_CHECK([grep 'lt_unlikely_existing_lib.*lt_unlikely_existing_lib' stdout], [1],[ignore],[ignore]) mv libboth.la libboth.la.bak -sed "s/^inherited_linker_flags.*/inherited_linker_flags='-framework Cocoa -framework ApplicationServices'/" < libboth.la.bak > libboth.la +$SED "s/^inherited_linker_flags.*/inherited_linker_flags='-framework Cocoa -framework ApplicationServices'/" < libboth.la.bak > libboth.la rm libboth.la.bak AT_CHECK([$LIBTOOL -n --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -framework Cocoa -framework ApplicationServices -o libbaz.la baz.lo libboth.la -no-undefined -rpath /nonexistent], diff --git a/tests/install.at b/tests/install.at index 3d1c1090..b9b2e84f 100644 --- a/tests/install.at +++ b/tests/install.at @@ -30,7 +30,7 @@ AT_KEYWORDS([libtool]) AT_CHECK([$LIBTOOL --features | grep 'enable shared libraries' || exit 77], [], [ignore]) -sed 's|^\(install_override_mode\)=.*|\1=755|' < $LIBTOOL > ./libtool +$SED 's|^\(install_override_mode\)=.*|\1=755|' < $LIBTOOL > ./libtool LIBTOOL=./libtool chmod a+rx $LIBTOOL diff --git a/tests/libtoolize.at b/tests/libtoolize.at index d9bab70e..eab6d842 100644 --- a/tests/libtoolize.at +++ b/tests/libtoolize.at @@ -790,9 +790,6 @@ LT_AT_ACLOCAL([-I $abs_top_srcdir/m4]) ## The following code is adapted (and simplified) from libtoolize.in #### -: ${GREP="grep"} -: ${SED="sed"} - basename='s|^.*/||' # func_grep expression filename diff --git a/tests/mdemo.at b/tests/mdemo.at index f182097b..55e73004 100644 --- a/tests/mdemo.at +++ b/tests/mdemo.at @@ -697,7 +697,7 @@ after=$objdir/temp/temp/after # Create a new libtool script that will enter dry run if the environment # variable force_dry_run is set -sed 's|^[[ ]]*opt_dry_run=.*$|opt_dry_run=$force_dry_run|' libtool > ltnew && mv ltnew libtool +$SED 's|^[[ ]]*opt_dry_run=.*$|opt_dry_run=$force_dry_run|' libtool > ltnew && mv ltnew libtool export force_dry_run # main.o is not compiled with libtool, but it depends on it, so make diff --git a/tests/need_lib_prefix.at b/tests/need_lib_prefix.at index 2102d6de..a0544ec4 100644 --- a/tests/need_lib_prefix.at +++ b/tests/need_lib_prefix.at @@ -161,7 +161,7 @@ eval libname=\"$libname_spec\" AT_CHECK([test lib = "$libname" || exit 77]) # Create our own libtool, forcing need_lib_prefix setting -sed 's|^\(need_lib_prefix\)=.*$|\1=unknown|' $LIBTOOL > ./libtool +$SED 's|^\(need_lib_prefix\)=.*$|\1=unknown|' $LIBTOOL > ./libtool LIBTOOL="$SHELL ./libtool" # Installation directory: diff --git a/tests/old-m4-iface.at b/tests/old-m4-iface.at index eab1192f..b5a0e482 100644 --- a/tests/old-m4-iface.at +++ b/tests/old-m4-iface.at @@ -94,7 +94,7 @@ LT_AT_EXEC_CHECK([./old], 0, [Hello, World!]) # Now, test that libtoolize doesn't mistakenly think the user called # any libtool macros if in fact she didn't. -sed '/AM_PROG_LIBTOOL/d' configure.in >configure.int +$SED '/AM_PROG_LIBTOOL/d' configure.in >configure.int mv -f configure.int configure.in AT_CHECK([$LIBTOOLIZE -n], [0], [stdout], [stderr]) # ensure no shell errors: diff --git a/tests/sysroot.at b/tests/sysroot.at index 08d2f422..f81a7abd 100644 --- a/tests/sysroot.at +++ b/tests/sysroot.at @@ -39,7 +39,7 @@ for i in crt0.o crt1.o crt2.o crti.o; do test $? = 0 || continue case $j in $gcc_sysroot*/lib/$i) - prefix=`echo "$j" | sed "s|^$gcc_sysroot\\(.*\\)/lib/$i\$|\\1|"` + prefix=`echo "$j" | $SED "s|^$gcc_sysroot\\(.*\\)/lib/$i\$|\\1|"` break ;; esac done diff --git a/tests/tagdemo.at b/tests/tagdemo.at index d7f94be3..37ea5f0e 100644 --- a/tests/tagdemo.at +++ b/tests/tagdemo.at @@ -388,7 +388,7 @@ LT_AT_BOOTSTRAP([], [-I m4], [], [--add-missing], [], [--disable-static], [ignore]) AT_CHECK([$GREP "^allow_undefined_flag=.\{0,1\}unsupported.\{0,1\}$" libtool && (exit 77)], 1, [ignore]) -sed 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool +$SED 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool LT_AT_CHECK_EXECUTE([], [./tagdemo]) diff --git a/tests/testsuite.at b/tests/testsuite.at index 31344772..6b2a550a 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -92,8 +92,8 @@ AT_KEYWORDS([libtoolize]) # --------------------------- # Fix the expected output of installed libtoolize in presence of --program-*. m4_define([_LIBTOOLIZE_TRANSFORM], -[lt_name=`$ECHO "$LIBTOOLIZE" | sed "s|^.*/||"` -sed "s/libtoolize/$lt_name/g +[lt_name=`$ECHO "$LIBTOOLIZE" | $SED "s|^.*/||"` +$SED "s/libtoolize/$lt_name/g s|/usr/local/share/aclocal/|${tst_aclocaldir-$abs_top_srcdir/libltdl/m4}/|" < $1 > $1.t mv -f $1.t $1 ])dnl @@ -298,8 +298,8 @@ esac]) # - location of the libtool script, # - error messages involving unstable temporary file names. m4_define([LT_AT_NORMALIZE_COMPILER_OUTPUT], -[_ltbase=`$ECHO "$LIBTOOL" | sed 's|^.*/||'` -[sed "/^distcc\[[0-9]*\]/d +[_ltbase=`$ECHO "$LIBTOOL" | $SED 's|^.*/||'` +[$SED "/^distcc\[[0-9]*\]/d /^$_ltbase: compile/d s/\(tmp\/\{1,\}cc\)\([a-zA-Z0-9_]\{1,\}\)/\1-normalized-tmpname/g" < $1 > $1.t] LT_AT_UNIFY_NL([$1.t], [m4_default([$2], [$1])])[]dnl -- cgit v1.2.1