[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: refactor autotests [299]
From: |
Gary V. Vaughan |
Subject: |
FYI: refactor autotests [299] |
Date: |
Mon, 7 Nov 2005 15:38:55 +0000 (GMT) |
User-agent: |
mailnotify/0.7 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Applied to HEAD.
* looking for address@hidden/libtool--devo--1.0--patch-363 to compare with
* comparing to address@hidden/libtool--devo--1.0--patch-363
M tests/old-m4-iface.at
M ChangeLog
M tests/standalone.at
M tests/testsuite.at
M tests/subproject.at
* modified files
Index: Changelog
from Gary V. Vaughan <address@hidden>
* tests/testsuite.at (_LTDL_PROJECT_FILES): Factored out from
common code to build a basic libltdl using project.
* tests/old-m4-iface.at, tests/standalone.at, tests/subproject.at:
Use it.
--- orig/tests/old-m4-iface.at
+++ mod/tests/old-m4-iface.at
@@ -91,8 +91,10 @@
AT_SETUP([AC_WITH_LTDL])
+_LTDL_PROJECT_FILES
+
AT_DATA([configure.in],
-[[AC_INIT(old.c)
+[[AC_INIT([main.c])
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
AC_WITH_LTDL
@@ -108,7 +110,7 @@
SHELL = @SHELL@
@SET_MAKE@
-TARGETS = libltdl/libltdlc.la module.la address@hidden@
+TARGETS = libltdl/libltdlc.la module.la address@hidden@
all: $(TARGETS)
@@ -118,8 +120,8 @@
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 +133,12 @@
$(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
--- orig/tests/standalone.at
+++ mod/tests/standalone.at
@@ -73,83 +73,7 @@
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
-]])
-
+_LTDL_PROJECT_FILES([libltdl])
LT_AT_LIBTOOLIZE([--copy --ltdl])
LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" \
CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
--- orig/tests/subproject.at
+++ mod/tests/subproject.at
@@ -116,90 +116,7 @@
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([sub/ltdl])
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}" \
--- orig/tests/testsuite.at
+++ mod/tests/testsuite.at
@@ -133,6 +133,104 @@
])
+## ------------------------------- ##
+## Files for a small ltdl project. ##
+## ------------------------------- ##
+
+# _LTDL_PROJECT_FILES([LTDL-DIR])
+# -------------------------------
+# LTDL-DIR is needed to generate a correct Makefile. If the argument
+# is omitted, then no Makefile is created.
+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;
+}
+]])
+
+m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$]))
+m4_ifval([$1],
+[AT_DATA([Makefile],
+[[top_builddir = .
+LIBTOOL = ./]_ARG_DIR[/libtool
+INCLUDES = -I./]_ARG_DIR[
+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 = ]_ARG_DIR[/libltdlc.la module.la ltdldemo$(EXEEXT)
+
+all: $(TARGETS)
+
+$(LIBTOOL) ]_ARG_DIR[/libltdlc.la: ]_ARG_DIR[/Makefile
+ cd ]_ARG_DIR[ && $(MAKE)
+
+]_ARG_DIR[/Makefile:
+ cd ]_ARG_DIR[ && ./configure $(CONFIGURE_OPTIONS)
+
+ltdldemo$(EXEEXT): $(LIBTOOL) module.la ]_ARG_DIR[/libltdlc.la main.lo
+ $(LTLINK) -o ltdldemo main.lo -dlopen module.la ./]_ARG_DIR[/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
+]])])
+m4_popdef([_ARG_DIR])
+])# _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
_________________________________________________________
This patch notification generated by tlaapply version 1.0
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--tla--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFDb3UOFRMICSmD1gYRAv7OAJ9enclxHBz27GZn0Jv9ypvTW/taDgCeJNlj
y49JoTqPCB0oBa6OMp76rI4=
=JIqn
-----END PGP SIGNATURE-----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: refactor autotests [299],
Gary V. Vaughan <=