]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
tests: use $SED throughout.
authorGary V. Vaughan <gary@gnu.org>
Wed, 30 Oct 2013 04:21:38 +0000 (17:21 +1300)
committerGary V. Vaughan <gary@gnu.org>
Wed, 1 Jan 2014 23:06:29 +0000 (12:06 +1300)
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 <gary@gnu.org>
18 files changed:
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

index 8f045ea4fc91cae756567809feb2ccd8e53d3c86..47f69fcf32bbe550a9924d070675cd97996d0d39 100644 (file)
@@ -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])
 
index f5f5832d180d3f51557f912e78aed34b9fd64d9a..526ae92c557110a272a18091facdbf8eefb9f646 100644 (file)
@@ -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
index 5588f26f43743a1d66c53bf4856cc1a8e05bc6ad..03b0e8c1489512df4ced6d81ecf2a1a73ce59791 100644 (file)
@@ -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
 
index 3ace493705807b3941dab8a1ffb06ce7a074c10f..0d6e91398a464952a93b9581c43765e5b350133e 100644 (file)
@@ -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"
index c0a148611efb0cfac4264674d53c0cbbb130f893..6a7556d7158f0f05e009baf7b4b92b39618e8dbf 100644 (file)
@@ -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
 
index 2e7a3a41fa204f64a4622a5fa8ff0e26ce21e08e..d3449406310af6aa3c221dc292be0f53ff7b5e76 100644 (file)
@@ -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
index 2555244ffc3142960a72b6bc2aed8490966a2aa2..c8483f522700910c5646a4f6b7ad8282bafc8c94 100755 (executable)
@@ -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
index 0b6223843e99269319492fe035f3837d6d3f304f..e039b2da5c74ffb37b163e087f4e22a090ff06a3 100644 (file)
@@ -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 </dev/null], [], [stdout])
   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 ./foo lt-wrapper abc "$arg1" "$arg2" xyz], [], [stdout])
   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 ./main$EXEEXT abc "$arg1" "$arg2" xyz], [], [stdout])
   AT_CHECK([$FGREP "$arg1" stdout], [], [ignore])
   AT_CHECK([test -z "$arg2" || $FGREP "$arg2" stdout], [], [ignore])
   # Do not match EOL here, cross setups may have an extra \r here.
-  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])
   arg1=
 done
 
index e79105fb4a43dd3d1cd9b3ea0581310944b90c7d..029656b5aaa11fe64ab5caaf68881dcca5054659 100644 (file)
@@ -27,7 +27,7 @@ AT_KEYWORDS([libtool])
 
 AT_CHECK([$LIBTOOL --features | grep 'disable shared libraries' && (exit 77)],
         [1], [ignore])
-AT_CHECK([eval `$LIBTOOL --config | sed -n '/^archive_expsym_cmds=/,/^$/p'`
+AT_CHECK([eval `$LIBTOOL --config | $SED -n '/^archive_expsym_cmds=/,/^$/p'`
          test -n "$archive_expsym_cmds" || echo false >can-hide
          case $archive_expsym_cmds in
          *-retain-symbols-file*) echo false >can-hide ;;
index ac97ec18f18377d36d18614fe783a67fcf7d6723..b132ce833b311b84d71ea5496b9b0be8845b6bb8 100644 (file)
@@ -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],
index 3d1c109021fb9e20e6f9b7d70486ea37e18abada..b9b2e84f933d551f4153aeaff71ea925d9183338 100644 (file)
@@ -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
 
index d9bab70edcb98f82e8e37e3207b26bbb56d662f1..eab6d842e8f00dbfd5ac0a1e2148502dae595f5a 100644 (file)
@@ -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
index f182097b5c35f46a941b24d5e4e8cdad4d5bb2ad..55e730045d2f784ea50492fc51c4588e95f2e184 100644 (file)
@@ -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
index 2102d6dee3c0fe4fe5227291cc3008c4e54ffdff..a0544ec4b9acfe95c77de892f670a883af0cfdd4 100644 (file)
@@ -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:
index eab1192f1085baf0c392382071018b9658ea1781..b5a0e482aece49fd212dbefbcec0cc9d1a51874b 100644 (file)
@@ -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:
index 08d2f4229cf02331b9a61ceb65798bb9cbb732b9..f81a7abd2d16e0076870743feef55b6dc382c0bb 100644 (file)
@@ -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
index d7f94be3f6f9e9aad3df85146277b610c669b673..37ea5f0ef213d4024e513ffc3341d793044dcce3 100644 (file)
@@ -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])
 
 
index 31344772c40144f4c0cde638acb8d3fa6eda93c4..6b2a550a08ab1344d3440fd07f25c35d21fefb11 100644 (file)
@@ -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