]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
tests: DRYing out `tests/sh.test'.
authorGary V. Vaughan <gary@gnu.org>
Sun, 26 Sep 2010 11:19:18 +0000 (18:19 +0700)
committerGary V. Vaughan <gary@vaughan.pe>
Sun, 14 Aug 2011 22:24:06 +0000 (05:24 +0700)
* Makefile.am (libtool_m4): Canonical location of libtool.m4 file.
(lt_aclocal_m4_deps): Use it.
(check_scripts): New variable for list of scripts to be checked
by `tests/sh.test'.
(legacy_tests_edit): New sed script to substitute `libtool_m4'
and `check_scripts' into `tests/defs'.
(tests/defs.in): Use it.
* tests/defs.m4sh (scripts): Calculate absolute paths of each
entry in `check_scripts' before changing directories.
(libtool_m4): Save location of `libtool.m4'.
(macro_dir, aux_dir): Removed. No longer required by any test.
* tests/sh.test: Remove loop around just `$macro_dir/libtool.m4'
in favour of a single reference to `$libtool_m4' from above.

ChangeLog
Makefile.am
tests/defs.m4sh
tests/sh.test

index 5825b4c927951dee49917d3c00aea345290e6cdd..91fa8a824e554c49e1ee09b60b1dd09da5bb6b55 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-26  Gary V. Vaughan  <gary@gnu.org>
+
+       tests: DRYing out `tests/sh.test'.
+       * Makefile.am (libtool_m4): Canonical location of libtool.m4 file.
+       (lt_aclocal_m4_deps): Use it.
+       (check_scripts): New variable for list of scripts to be checked
+       by `tests/sh.test'.
+       (legacy_tests_edit): New sed script to substitute `libtool_m4'
+       and `check_scripts' into `tests/defs'.
+       (tests/defs.in): Use it.
+       * tests/defs.m4sh (scripts): Calculate absolute paths of each
+       entry in `check_scripts' before changing directories.
+       (libtool_m4): Save location of `libtool.m4'.
+       (macro_dir, aux_dir): Removed. No longer required by any test.
+       * tests/sh.test: Remove loop around just `$macro_dir/libtool.m4'
+       in favour of a single reference to `$libtool_m4' from above.
+
 2010-09-23  Gary V. Vaughan  <gary@gnu.org>
 
        maint: pass directory declarations in configure.ac into Makefile.
index 121badc63b4cab35dcff0e262cc2836f0fa9b77d..f06eb844e6a6ba69646f5319de7bb82a5223880a 100644 (file)
@@ -89,6 +89,7 @@ CLEANFILES     += libtool libtoolize
 configure_ac   = $(srcdir)/configure.ac
 libtoolize_in  = $(srcdir)/libtoolize.in
 ltmain_sh      = $(aux_dir)/ltmain.sh
+libtool_m4     = $(macro_dir)/libtool.m4
 ltversion_in   = $(macro_dir)/ltversion.in
 ltversion_m4   = $(macro_dir)/ltversion.m4
 
@@ -337,7 +338,7 @@ $(stamp_mk): $(lt_Makefile_in)
 lt_aclocal_m4_deps = \
        $(lt_obsolete_m4) \
        $(ltversion_m4) \
-       $(macro_dir)/libtool.m4 \
+       $(libtool_m4) \
        $(macro_dir)/ltoptions.m4 \
        $(macro_dir)/ltdl.m4 \
        $(macro_dir)/ltsugar.m4 \
@@ -957,11 +958,17 @@ TESTS = $(NONINTERACTIVE_TESTS) $(INTERACTIVE_TESTS)
 defs           = tests/defs
 defs_in                = $(tests_dir)/defs.in
 
+check_scripts  = $(ltmain_m4sh) $(libtoolize_m4sh)
+
 EXTRA_DIST     += $(defs_in) $(defs_m4sh) \
                  $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) $(FC_TESTS) \
                  $(INTERACTIVE_TESTS)
 DIST_SUBDIRS   += $(CONF_SUBDIRS)
 
+legacy_tests_edit = $(SED) \
+       -e 's,@check_scripts\@,$(check_scripts),g' \
+       -e 's,@libtool_m4\@,$(libtool_m4),g'
+
 # The defs script shouldn't be recreated whenever the Makefile is
 # regenerated since the source tree can be read-only.
 check-recursive: $(defs)
@@ -971,7 +978,7 @@ $(defs): $(defs_in)
 
 $(defs_in): $(defs_m4sh) $(general_m4sh) Makefile.am
        rm -f '$@'
-       $(LT_M4SH) '$(defs_m4sh)' > '$@'
+       $(LT_M4SH) '$(defs_m4sh)' | $(legacy_tests_edit) > '$@'
 
 # We need to remove any files that the above tests created.
 clean-local-legacy:
index 6a4807914bd6d57590a5ea3bdcb926305e9c10df..28717a90d486ee2ad4ca7c4f6d591b8be85845a4 100644 (file)
@@ -342,9 +342,20 @@ func_exec ()
 # Shared global variables for test scripts
 prefix=./_inst-`echo "$0" | sed 's,.*/,,; s,-.*,,'`
 srcdir=`cd $srcdir && pwd`
-macro_dir=$srcdir/libltdl/m4
-aux_dir=$srcdir/libltdl/config
-scripts="$aux_dir/ltmain.m4sh $srcdir/libtoolize.m4sh"
+
+# sh.test does some checks on libtool.m4.
+func_dirname_and_basename '@libtool_m4@'
+libtool_m4="`cd $func_dirname_result && pwd`/$func_basename_result"
+
+# sh.test does lots of checks on the contests of $scripts.
+scripts=
+sep=
+for script in @check_scripts@
+do
+  func_dirname_and_basename "$script"
+  scripts="$scripts$sep`cd $func_dirname_result && pwd`/$func_basename_result"
+  sep=' '
+done
 
 # Unset some MAKE... variables that may cause $MAKE to act like a
 # recursively invoked sub-make.  Any $MAKE invocation in a test is
index 4fd3bb3e63a534f95f80039fbb384b495fb0d8e2..9fd589963a803b0e5447fb988937ad248fac7200 100755 (executable)
@@ -121,14 +121,11 @@ done
 
 # Check for correct usage of $cc_basename.
 # redirect stderr so we also barf when sed issues diagnostics.
-for s in "$macro_dir/libtool.m4"
-do
-  if $SED -n '/case \$cc_basename in/,/esac/ {
-             /^[       ]*[a-zA-Z][a-zA-Z0-9+]*[^*][    ]*)/p
-             }'  $s 2>&1 | $EGREP .; then
-    echo "\$cc_basename matches should include a trailing \`*' in $s."
-    status=$EXIT_FAILURE
-  fi
-done
+if $SED -n '/case \$cc_basename in/,/esac/ {
+           /^[         ]*[a-zA-Z][a-zA-Z0-9+]*[^*][    ]*)/p
+           }'  $libtool_m4 2>&1 | $EGREP .; then
+  echo "\$cc_basename matches should include a trailing \`*' in $libtool_m4."
+  status=$EXIT_FAILURE
+fi
 
 exit $status