]> git.draconx.ca Git - cdecl99.git/commitdiff
Begin converting testsuite to Autotest.
authorNick Bowler <nbowler@draconx.ca>
Tue, 30 Jun 2020 04:59:55 +0000 (00:59 -0400)
committerNick Bowler <nbowler@draconx.ca>
Fri, 3 Jul 2020 03:19:15 +0000 (23:19 -0400)
This is better.  Port the static symbol check to Autotest.

.gitignore
Makefile.am
configure.ac
tests/general.at [new file with mode: 0644]
tests/libcdecl-static-symbols.sh [deleted file]
testsuite.at [new file with mode: 0644]

index 366ba2c87a2dcc97d886d22a4ada4c3e36a94781..911090e8a91553c29224e820d1bbfaf4487d7c31 100644 (file)
@@ -1,27 +1,33 @@
-*.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
index c5974991ac439556b50761d11389ed5d7d33b1b3..2efe6222d0420cfa39fe87057f4a4e4513d5632e 100644 (file)
@@ -1,4 +1,4 @@
-# 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.
@@ -76,8 +76,8 @@ TESTS_ENVIRONMENT = SHELL='$(SHELL)' LIBTOOL='$(LIBTOOL)' EXEEXT='$(EXEEXT)'
 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)
 
@@ -206,3 +206,4 @@ FLEX_V_0 = @printf '  %$(DX_ALIGN_V)s %s\n' 'FLEX    ' $<;
 
 include $(top_srcdir)/lib/gnulib.mk
 include $(top_srcdir)/common/snippet/glconfig.mk
+include $(top_srcdir)/common/snippet/autotest.mk
index 1aae33e2410fd381e5ff5a2c23a8c654f6c5b44c..eed1a1974ef7826944b1c3336d7f781309ee2e05 100644 (file)
@@ -1,4 +1,4 @@
-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.
@@ -71,6 +71,10 @@ AS_CASE([$with_gsl],
        [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
 ])
diff --git a/tests/general.at b/tests/general.at
new file mode 100644 (file)
index 0000000..337afdd
--- /dev/null
@@ -0,0 +1,31 @@
+# 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
diff --git a/tests/libcdecl-static-symbols.sh b/tests/libcdecl-static-symbols.sh
deleted file mode 100755 (executable)
index 66fca23..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/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
diff --git a/testsuite.at b/testsuite.at
new file mode 100644 (file)
index 0000000..93bc0ed
--- /dev/null
@@ -0,0 +1,25 @@
+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])