libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch 15/19] 299-gary-refactor-autotests.diff Queue


From: Gary V. Vaughan
Subject: [patch 15/19] 299-gary-refactor-autotests.diff Queue
Date: Mon, 10 Oct 2005 11:26:39 +0100
User-agent: quilt/0.42-1

 tests/old-m4-iface.at |   64 ++++-------------------------------
 tests/standalone.at   |   80 +------------------------------------------
 tests/subproject.at   |   85 ----------------------------------------------
 tests/testsuite.at    |   91 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 102 insertions(+), 218 deletions(-)

Index: libtool--devo--1.0/tests/old-m4-iface.at
===================================================================
--- libtool--devo--1.0.orig/tests/old-m4-iface.at
+++ libtool--devo--1.0/tests/old-m4-iface.at
@@ -91,8 +91,11 @@ AT_CLEANUP
 
 AT_SETUP([AC_WITH_LTDL])
 
+_LTDL_PROJECT_FILES
+rm -f Makefile
+
 AT_DATA([configure.in],
-[[AC_INIT(old.c)
+[[AC_INIT([main.c])
 AC_PROG_MAKE_SET
 AM_PROG_LIBTOOL
 AC_WITH_LTDL
@@ -108,7 +111,7 @@ LTLINK              = @LIBTOOL@ --mode=link @CC@ -no
 SHELL          = @SHELL@
 @SET_MAKE@
 
-TARGETS    = libltdl/libltdlc.la module.la address@hidden@
+TARGETS    = libltdl/libltdlc.la module.la address@hidden@
 
 all: $(TARGETS)
 
@@ -118,8 +121,8 @@ libltdl/libltdlc.la:
 module.la: module.lo
        $(LTLINK) module.lo -module -avoid-version -rpath /dev/null
 
address@hidden@: address@hidden@
-       $(LTLINK) address@hidden@ -dlopen module.la @LIBLTDL@
address@hidden@: address@hidden@
+       $(LTLINK) address@hidden@ -dlopen module.la @LIBLTDL@
 
 .SUFFIXES:
 .SUFFIXES: .c address@hidden@ .lo
@@ -131,63 +134,12 @@ address@hidden@: address@hidden@
        $(LTCOMPILE) -c -o $@ $<
 ]])
 
-AT_DATA([old.c],
-[[#include <stdio.h>
-#include "ltdl.h"
-
-int main (int argc, char **argv)
-{
-  lt_dlhandle module;
-  const char *(*foo) (const char *) = 0;
-  int status = 1;
-
-  LTDL_SET_PRELOADED_SYMBOLS();
-  if (lt_dlinit() != 0) {
-    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
-    return 1;
-  }
-
-  module = lt_dlopen("module.la");
-  if (!module) {
-    fprintf (stderr, "error dlopening module.la: %s\n", lt_dlerror());
-    goto finish;
-  }
-
-  foo = (const char *(*)(const char *)) lt_dlsym (module, "foo");
-  if (!foo) {
-    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
-    goto finish;
-  }
-
-  printf ("%s", (*foo) ("foo bar"));
-  status = 0;
-
-finish:
-  if (lt_dlexit() != 0) {
-    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
-    status = 1;
-  }
-
-  return status;
-}
-]])
-
-AT_DATA([module.c],
-[[const char *
-foo (const char *str)
-{
-  while (*str++ != ' ')
-    ;
-  return str;
-}
-]])
-
 LT_AT_LIBTOOLIZE([--ltdl --install])
 LT_AT_ACLOCAL([-I libltdl/m4])
 LT_AT_AUTOCONF([--force])
 LT_AT_CONFIGURE
 LT_AT_MAKE
 
-LT_AT_EXEC_CHECK([./old], 0, [bar])
+LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
 
 AT_CLEANUP
Index: libtool--devo--1.0/tests/standalone.at
===================================================================
--- libtool--devo--1.0.orig/tests/standalone.at
+++ libtool--devo--1.0/tests/standalone.at
@@ -73,84 +73,8 @@ AT_CLEANUP
 
 AT_SETUP([linking libltdl without autotools])
 
-AT_DATA([module.c],
-[[const char *
-hello (void)
-{
-  return "Hello!";
-}
-]])
-
-AT_DATA([main.c],
-[[#include <stdio.h>
-#include "ltdl.h"
-
-int
-main (int argc, char **argv)
-{
-  lt_dlhandle handle;
-  const char *(*func) (void) = 0;
-  int status = 1;
-
-  LTDL_SET_PRELOADED_SYMBOLS();
-  if (lt_dlinit() != 0) {
-    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
-    return 1;
-  }
-
-  handle = lt_dlopen("module.la");
-  if (!handle) {
-    fprintf (stderr, "error dlopening module.la: %s\n", lt_dlerror());
-    goto finish;
-  }
-
-  func = (const char *(*)(void)) lt_dlsym (handle, "hello");
-  if (!func) {
-    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
-    goto finish;
-  }
-
-  printf ("%s\n", (*func) ());
-  status = 0;
-
-finish:
-  lt_dlexit();
-
-  return status;
-}
-]])
-
-AT_DATA([Makefile],
-[[LIBTOOL      = ./libltdl/libtool
-INCLUDES       = -I./libltdl
-MODFLAGS       = -module -avoid-version -no-undefined
-
-LTCOMPILE = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
-        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LTLINK    = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link \
-        $(CC) $(CFLAGS) $(LDFLAGS)
-
-TARGETS                = libltdl/libltdlc.la module.la ltdldemo$(EXEEXT)
-
-all: $(TARGETS)
-
-$(LIBTOOL) libltdl/libltdlc.la:
-       cd libltdl && ./configure $(CONFIGURE_OPTIONS) && $(MAKE)
-
-ltdldemo$(EXEEXT): $(LIBTOOL) module.la libltdl/libltdlc.la main.lo
-       $(LTLINK) -o ltdldemo main.lo -dlopen module.la ./libltdl/libltdlc.la
-
-main.lo: $(LIBTOOL) main.c
-       $(LTCOMPILE) -c main.c
-
-module.la: $(LIBTOOL) module.lo
-       $(LTLINK) -o module.la module.lo $(MODFLAGS) -rpath /dev/null
-
-module.lo: $(LIBTOOL) module.c
-       $(LTCOMPILE) -c module.c
-]])
-
-LT_AT_LIBTOOLIZE([--copy --ltdl])
+_LTDL_PROJECT_FILES
+LT_AT_LIBTOOLIZE([--copy --ltdl=sub/ltdl])
 LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" \
         CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
        CONFIGURE_OPTIONS="$configure_options"])
Index: libtool--devo--1.0/tests/subproject.at
===================================================================
--- libtool--devo--1.0.orig/tests/subproject.at
+++ libtool--devo--1.0/tests/subproject.at
@@ -104,90 +104,7 @@ AT_CLEANUP
 
 AT_SETUP([linking libltdl without autotools])
 
-AT_DATA([module.c],
-[[const char *
-hello (void)
-{
-  return "Hello!";
-}
-]])
-
-AT_DATA([main.c],
-[[#include <stdio.h>
-#include "ltdl.h"
-
-int
-main (int argc, char **argv)
-{
-  lt_dlhandle module;
-  const char *(*func) (void) = 0;
-  int status = 1;
-
-  LTDL_SET_PRELOADED_SYMBOLS();
-  if (lt_dlinit() != 0) {
-    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
-    return 1;
-  }
-
-  module = lt_dlopen("module.la");
-  if (!module) {
-    fprintf (stderr, "error dlopening module.la: %s\n", lt_dlerror());
-    goto finish;
-  }
-
-  func = (const char *(*)(void)) lt_dlsym (module, "hello");
-  if (!func) {
-    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
-    goto finish;
-  }
-
-  printf ("%s\n", (*func) ());
-  status = 0;
-
-finish:
-  if (lt_dlexit() != 0) {
-    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
-    status = 1;
-  }
-
-  return status;
-}
-]])
-
-AT_DATA([Makefile],
-[[top_builddir = .
-LIBTOOL                = ./sub/ltdl/libtool
-INCLUDES       = -I./sub/ltdl
-MODFLAGS       = -module -avoid-version -no-undefined
-
-LTCOMPILE = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
-        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LTLINK    = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link \
-        $(CC) $(CFLAGS) $(LDFLAGS)
-
-TARGETS                = sub/ltdl/libltdlc.la module.la ltdldemo$(EXEEXT)
-
-all: $(TARGETS)
-
-$(LIBTOOL) sub/ltdl/libltdlc.la: sub/ltdl/Makefile
-       cd sub/ltdl && $(MAKE)
-
-sub/ltdl/Makefile:
-       cd sub/ltdl && ./configure $(CONFIGURE_OPTIONS)
-
-ltdldemo$(EXEEXT): $(LIBTOOL) module.la sub/ltdl/libltdlc.la main.lo
-       $(LTLINK) -o ltdldemo main.lo -dlopen module.la ./sub/ltdl/libltdlc.la
-
-main.lo: $(LIBTOOL) main.c
-       $(LTCOMPILE) -c main.c
-
-module.la: $(LIBTOOL) module.lo
-       $(LTLINK) -o module.la module.lo $(MODFLAGS) -rpath /dev/null
-
-module.lo: $(LIBTOOL) module.c
-       $(LTCOMPILE) -c module.c
-]])
-
+_LTDL_PROJECT_FILES
 LT_AT_LIBTOOLIZE([--copy --ltdl=sub/ltdl])
 LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS"  \
      CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" MAKE="${MAKE-make}" \
Index: libtool--devo--1.0/tests/testsuite.at
===================================================================
--- libtool--devo--1.0.orig/tests/testsuite.at
+++ libtool--devo--1.0/tests/testsuite.at
@@ -119,6 +119,97 @@ AT_CHECK([test -n "[$]$1" || (exit 77)])
 ])
 
 
+## ------------------------------- ##
+## Files for a small ltdl project. ##
+## ------------------------------- ##
+
+m4_define([_LTDL_PROJECT_FILES],
+[AT_DATA([module.c],
+[[const char *
+hello (void)
+{
+  return "Hello!";
+}
+]])
+
+AT_DATA([main.c],
+[[#include <stdio.h>
+#include "ltdl.h"
+
+int
+main (int argc, char **argv)
+{
+  lt_dlhandle module;
+  const char *(*func) (void) = 0;
+  int status = 1;
+
+  LTDL_SET_PRELOADED_SYMBOLS();
+  if (lt_dlinit() != 0) {
+    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  module = lt_dlopen("module.la");
+  if (!module) {
+    fprintf (stderr, "error dlopening module.la: %s\n", lt_dlerror());
+    goto finish;
+  }
+
+  func = (const char *(*)(void)) lt_dlsym (module, "hello");
+  if (!func) {
+    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
+    goto finish;
+  }
+
+  printf ("%s\n", (*func) ());
+  status = 0;
+
+finish:
+  if (lt_dlexit() != 0) {
+    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
+    status = 1;
+  }
+
+  return status;
+}
+]])
+
+AT_DATA([Makefile],
+[[top_builddir = .
+LIBTOOL                = ./sub/ltdl/libtool
+INCLUDES       = -I./sub/ltdl
+MODFLAGS       = -module -avoid-version -no-undefined
+
+LTCOMPILE = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
+        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+LTLINK    = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link \
+        $(CC) $(CFLAGS) $(LDFLAGS)
+
+TARGETS                = sub/ltdl/libltdlc.la module.la ltdldemo$(EXEEXT)
+
+all: $(TARGETS)
+
+$(LIBTOOL) sub/ltdl/libltdlc.la: sub/ltdl/Makefile
+       cd sub/ltdl && $(MAKE)
+
+sub/ltdl/Makefile:
+       cd sub/ltdl && ./configure $(CONFIGURE_OPTIONS)
+
+ltdldemo$(EXEEXT): $(LIBTOOL) module.la sub/ltdl/libltdlc.la main.lo
+       $(LTLINK) -o ltdldemo main.lo -dlopen module.la ./sub/ltdl/libltdlc.la
+
+main.lo: $(LIBTOOL) main.c
+       $(LTCOMPILE) -c main.c
+
+module.la: $(LIBTOOL) module.lo
+       $(LTLINK) -o module.la module.lo $(MODFLAGS) -rpath /dev/null
+
+module.lo: $(LIBTOOL) module.c
+       $(LTCOMPILE) -c module.c
+]])
+])# _LTDL_PROJECT_FILES
+
+
 # We use `dnl' in zillions of places...
 m4_pattern_allow([^dnl$])
 

--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook




reply via email to

[Prev in Thread] Current Thread [Next in Thread]