]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* tests/export.at: New test: expose -export-symbols failure
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 11 Feb 2007 16:47:53 +0000 (16:47 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 11 Feb 2007 16:47:53 +0000 (16:47 +0000)
when the input consists solely of convenience archives, and
failure to not export all symbols when the command line length
is exceeded.
* Makefile.am: Adjust.

ChangeLog
Makefile.am
tests/export.at [new file with mode: 0644]

index e10a48fdbf9dd30cb61a9cdb10c1e0f286e698a5..90ac70401962c46215f4e38aa7e546ef33f01d85 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-02-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       * tests/export.at: New test: expose -export-symbols failure
+       when the input consists solely of convenience archives, and
+       failure to not export all symbols when the command line length
+       is exceeded.
+       * Makefile.am: Adjust.
+
        * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): New substituted
        function `func_lo2o', saving two fork&exec with XSI shells.
        * libltdl/config/ltmain.m4sh (func_mode_compile)
index 32811fc9e0c008c38ad518614273890cf1c86553..93ef73c302b57c28c3a8116e928c72887b766cb9 100644 (file)
@@ -407,6 +407,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/fail.at \
                  tests/shlibpath.at \
                  tests/static.at \
+                 tests/export.at \
                  tests/search-path.at \
                  tests/destdir.at \
                  tests/old-m4-iface.at \
diff --git a/tests/export.at b/tests/export.at
new file mode 100644 (file)
index 0000000..097364c
--- /dev/null
@@ -0,0 +1,164 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Test symbol exports.
+
+AT_SETUP([Export test])
+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'`
+          test -n "$archive_expsym_cmds" || echo false >can-hide])
+can_hide=:
+test -s can-hide && can_hide=false
+
+LDFLAGS="$LDFLAGS -no-undefined"
+libdir=`pwd`/inst/lib
+mkdir inst inst/lib
+
+AT_DATA(a.c,
+[[/* all kinds of data items */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int v1;
+static int v2;
+int v3 = 0;
+int v4 = 1;
+extern const int v5, v6;
+extern const char *v7;
+extern const char v8[];
+extern int (*const v12) (void);
+const int v5 = 0;
+const int v6 = 1;
+const char* v7 = "\01foo";
+const char v8[] = "\01bar";
+int v9(void) { return v2 + 1; }
+int (*v10) (void);
+int (*v11) (void) = v9;
+int (*const v12) (void) = v9;
+
+typedef struct { int arr[1000]; } large;
+large v13;
+large v14 = { { 0 } };
+large v15 = { { 1 } };
+
+int w1 (void) { return 0; }
+
+#ifdef __cplusplus
+}
+#endif
+]])
+
+AT_DATA(asyms,
+[[v1
+v3
+v4
+v5
+v6
+v7
+v8
+v9
+v10
+v11
+v12
+v13
+v14
+v15
+]])
+
+AT_DATA(main.c,
+[[
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int v1;
+extern int v3, v4;
+extern const int v5, v6;
+extern const char* v7;
+extern const char v8[];
+extern int v9(void);
+extern int (*v10) (void);
+extern int (*v11) (void);
+extern int (*const v12) (void);
+#ifdef __cplusplus
+}
+#endif
+
+typedef struct { int arr[1000]; } large;
+extern large v13, v14, v15;
+
+int main (void)
+{
+  char s = v7[0] + v8[0];
+  return s + v1 + v3 + v4 + v5 + v6 + v9() + v11() + v12()
+          + v13.arr[0] + v14.arr[0] + v15.arr[0]
+           - 8;
+}
+]])
+
+AT_DATA([broken.c],
+[[
+/* these symbols should not be exported */
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int w1 (void);
+#ifdef __cplusplus
+}
+#endif
+int main (void)
+{
+  return w1 ();
+}
+]])
+
+AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],[0],[ignore],[ignore])
+AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c],[0],[ignore],[ignore])
+AT_CHECK([$CC $CPPFLAGS $CFLAGS -c broken.c],[0],[ignore],[ignore])
+
+for exportsyms in '' '-export-symbols-regex "v.*"' '-export-symbols asyms'
+do
+  # case 1: shared library built from object.
+  LT_AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \
+              -rpath $libdir' $exportsyms], [], [ignore], [ignore])
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT liba.la],
+          [], [ignore], [ignore])
+  LT_AT_EXEC_CHECK([./main])
+  if test -n "$exportsyms" && $can_hide; then
+    AT_CHECK([if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o broken broken.$OBJEXT liba.la
+             then (exit 1); else :; fi], [], [ignore], [ignore])
+  fi
+
+  # case 2: shared library built from convenience archive.
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libconv.la a.lo],
+          [], [ignore], [ignore])
+  LT_AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la libconv.la \
+              -rpath $libdir' $exportsyms], [], [ignore], [ignore])
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT liba.la],
+          [], [ignore], [ignore])
+  LT_AT_EXEC_CHECK([./main])
+  if test -n "$exportsyms" && $can_hide; then
+    AT_CHECK([if $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o broken broken.$OBJEXT liba.la
+             then (exit 1); else :; fi], [], [ignore], [ignore])
+  fi
+done
+
+AT_CLEANUP