This is better. Port the static symbol check to Autotest.
-*.o
-*.lo
*.la
-.libs
+*.lo
+*.o
.deps
.dirstamp
-Makefile
-Makefile.in
-/config.*
-/configure
+.libs
+/ABOUT-NLS
/aclocal.m4
-/libtool
-/missing
+/atconfig
/autom4te.cache
-/ltmain.sh
-/depcomp
-/missing
+/cdecl99
/compile
-/stamp-h1
+/config.*
+/configure
+/depcomp
+/exported.sh
/install-sh
/lib
-/cdecl99
-/ABOUT-NLS
-/exported.sh
+/libtool
+/ltmain.sh
+/missing
+/missing
+/package.m4
/snippet
+/stamp-h1
/test-driver
/test-suite.log
+/testsuite
+/testsuite.deps
+/testsuite.dir
+/testsuite.log
+Makefile
+Makefile.in
-# Copyright © 2011-2013,2019 Nick Bowler
+# Copyright © 2011-2013,2019-2020 Nick Bowler
#
# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
# This is free software: you are free to do what the fuck you want to.
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
-TESTS = tests/libcdecl-static-symbols.sh tests/randomdecl-sanity.sh \
- tests/crossparse-c-random.sh tests/cdecl99-c-invalid.sh
+TESTS = tests/randomdecl-sanity.sh tests/crossparse-c-random.sh \
+ tests/cdecl99-c-invalid.sh
dist_check_SCRIPTS = tests/randomdecl-sanity.sed $(TESTS)
include $(top_srcdir)/lib/gnulib.mk
include $(top_srcdir)/common/snippet/glconfig.mk
+include $(top_srcdir)/common/snippet/autotest.mk
-dnl Copyright © 2011-2012 Nick Bowler
+dnl Copyright © 2011-2013, 2020 Nick Bowler
dnl
dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
dnl This is free software: you are free to do what the fuck you want to.
[DX_CHECK_GSL([1.0], [have_gsl=yes], [have_gsl=no])])
AM_CONDITIONAL([HAVE_GSL], [test x"$have_gsl" = x"yes"])
+AC_CONFIG_TESTDIR([.])
+DX_PROG_AUTOTEST
+AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
+
AC_CONFIG_FILES([
Makefile
])
--- /dev/null
+# Copyright © 2012, 2020 Nick Bowler
+#
+# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.
+
+m4_define([LIBTOOL_VARS],
+ [eval `sed -n[]m4_foreach([var], m4_cdr($@), [ -e '/^var='/p]) <$1`])
+
+dnl Verify that all symbols in the static library are properly prefixed.
+AT_SETUP([libcdecl static symbol prefixes])
+
+AT_CHECK([{ $LIBTOOL --config || exit 99; } >libtool.cfg])
+LIBTOOL_VARS([libtool.cfg], [objdir], [build_old_libs])
+AT_SKIP_IF([test x"$build_old_libs" = x"no"])
+
+LIBTOOL_VARS([$builddir/libcdecl.la], [old_library])
+archive="$builddir/$objdir/$old_library"
+AT_CHECK([$SHELL "$builddir/exported.sh" "$archive" || exit 99], [0], [stdout])
+AT_CHECK([sed '/^cdecl_/d' stdout])
+
+AT_CLEANUP
+++ /dev/null
-#!/bin/sh
-#
-# Copyright © 2012 Nick Bowler
-#
-# Verify that a static library does not export any unprefixed symbols.
-#
-# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
-# This is free software: you are free to do what the fuck you want to.
-# There is NO WARRANTY, to the extent permitted by law.
-
-ltlib=libcdecl.la
-sym_prefix=cdecl_
-
-eval `$LIBTOOL --config | sed -n \
- -e '/^objdir=/p' \
- -e '/^build_old_libs=/p'` || exit 1
-eval `< $ltlib sed -ne '/^old_library=/p'` || exit 1
-
-if test x"$build_old_libs" = x"no"; then
- # Not building static libs.
- exit 77
-fi
-
-lib=`expr "$ltlib" : '\(.*\)/'`
-lib="$lib${lib:+/}$objdir/$old_library"
-
-found_sym=no
-bad_sym=no
-
-for i in `$SHELL exported.sh "$lib"`
-do
- if expr "$i" : "$sym_prefix" >/dev/null; then
- # Record that we found at least one exported symbol.
- found_sym=yes
- else
- printf 'unprefixed global symbol: %s\n' "$i" 1>&2
- bad_sym=yes
- fi
-done
-
-test x"$bad_sym" = x"yes" && exit 1
-
-if test x"$found_sym" = x"no"; then
- printf 'no exported symbols found\n' 1>&2
- exit 1
-fi
-
-exit 0
--- /dev/null
+AT_COPYRIGHT([Copyright © 2020 Nick Bowler])
+#
+# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.
+
+AT_INIT
+AT_COLOR_TESTS
+
+AT_TESTED([cdecl99])
+
+m4_divert_push([PREPARE_TESTS])dnl
+: ${LIBTOOL="$SHELL $builddir/libtool"}
+m4_divert_pop([PREPARE_TESTS])
+
+m4_include([tests/general.at])