/ABOUT-NLS
/aclocal.m4
/atconfig
+/atlocal
/autom4te.cache
/cdecl99
/compile
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
-TESTS = tests/randomdecl-sanity.sh tests/crossparse-c-random.sh
+TESTS = tests/crossparse-c-random.sh
-dist_check_SCRIPTS = tests/randomdecl-sanity.sed $(TESTS)
+dist_check_SCRIPTS = $(TESTS)
src/parse.lo: src/scan.h
src/scan.lo: src/parse.h
$(MAKE) $(AM_MAKEFLAGS) $<; \
fi
+atlocal: config.status
+ $(AM_V_GEN) :; { \
+ printf ': "$${%s=%s}"\n' \
+ EXEEXT '$(EXEEXT)' \
+ check_PROGRAMS '$(check_PROGRAMS)' \
+ ; } >$@.tmp
+ $(AM_V_at) mv -f $@.tmp $@
+check_DATA = atlocal
+CLEANFILES += atlocal
+
include $(top_srcdir)/lib/gnulib.mk
include $(top_srcdir)/common/snippet/glconfig.mk
include $(top_srcdir)/common/snippet/autotest.mk
[DX_CHECK_GSL([1.0], [have_gsl=yes], [have_gsl=no])])
AM_CONDITIONAL([HAVE_GSL], [test x"$have_gsl" = x"yes"])
-AC_CONFIG_TESTDIR([.])
+AC_CONFIG_TESTDIR([.], [test:.])
DX_PROG_AUTOTEST
AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
+++ /dev/null
-#n
-# Checks for key bits in English declarations. This file is itself parsed
-# to determine the things checked for: lines containing "=yes" are assumed
-# to be variables to be tested, and must be followed by a # and a comment
-# stating the feature being tested.
-#
-# Copyright © 2012 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.
-# There is NO WARRANTY, to the extent permitted by law.
-10000q
-/^declare/i\
-declaration=yes # declaration of an identifier
-/^type/i\
-abstract=yes # type name
-/inline/i\
-inline=yes # inline function
-/inline inline/i\
-redundant_funcspec=yes # redundant function specifiers
-/function ([[:alnum:]_]* as/i\
-named_parameter=yes # named function parameter
-/function (void)/i\
-empty_prototype=yes # empty prototype declaration
-/function returning/i\
-non_prototype=yes # non-prototype function declaration.
-/\.\.\.)/i\
-variadic=yes # variadic function
-/const/i\
-const=yes # const qualifier
-/volatile/i\
-volatile=yes # volatile qualifier
-/restrict/i\
-restrict=yes # restrict qualifier
-/const const/i\
-redundant_qualifier=yes # redundant type qualifiers
-/variable-length array/i\
-vla=yes # variable-length array
-/static/i\
-static=yes # static storage-class specifier
-/extern/i\
-extern=yes # extern storage-class specifier
-/typedef/i\
-typedef=yes # typedef storage-class specifier
-/auto/i\
-auto=yes # auto storage-class specifier
-/register/i\
-register=yes # register storage-class specifier
-/void/i\
-void=yes # void type specifier
-/char/i\
-char=yes # char type specifier
-/short/i\
-short=yes # short type specifier
-/int/i\
-int=yes # int type specifier
-/long/i\
-long=yes # long type specifier
-/float/i\
-float=yes # float type specifier
-/double/i\
-double=yes # double type specifier
-/signed/i\
-signed=yes # signed type specifier
-/unsigned/i\
-unsigned=yes # unsigned type specifier
-/_Bool/i\
-bool=yes # _Bool type specifier
-/_Complex/i\
-complex=yes # _Complex type specifier
-/_Imaginary/i\
-imaginary=yes # _Imaginary type specifier
-/struct/i\
-struct=yes # struct type specifier
-/union/i\
-union=yes # union type specifier
-/enum/i\
-enum=yes # enum type specifier
-/pointer to array/i\
-pointer_to_array=yes # pointer to an array
-/pointer to function/i\
-pointer_to_function=yes # pointer to a function
+++ /dev/null
-#!/bin/sh
-#
-# Copyright © 2012 Nick Bowler
-#
-# Check randomdecl's output to make sure it actually generates a variety
-# of declarations.
-#
-# 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.
-
-randomdecl=test/randomdecl$EXEEXT
-test -x $randomdecl || exit 77
-
-proc() {
- sed -f "$srcdir/tests/randomdecl-sanity.sed" \
- || { echo "result=fail"; return 1; }
-}
-
-printf '%s: randomized test using RANDOMSEED=%d\n' "$0" "$RANDOMSEED"
-
-result=pass
-eval_cmd=`exec 3>&1
- { $randomdecl -E -s "$RANDOMSEED" 3>&-
- echo gen_status=$? >&3
- } | proc >&3`
-eval "$eval_cmd"
-
-eval_cmd=`sed -ne 's/^\(.*\)=yes #\(.*\)$/\
- test x"$\1" = x"yes" || { echo no \2; result=fail; }/p' \
- tests/randomdecl-sanity.sed`
-eval "$eval_cmd"
-
-if test x"$result" != x"pass"; then
- printf '%s: test failed\n' "$0"
- exit 1
-fi
--- /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/>.
+
+AT_BANNER([Randomized tests])
+
+dnl Verify that randomdecl actually produces all keywords and a variety
+dnl of different declarations.
+AT_SETUP([randomdecl sanity])
+
+TEST_NEED_PROGRAM([randomdecl])
+
+m4_define([sanity_tests], [dnl
+ [[^declare], [declaration of an identifier]],
+ [[^type], [type name]],
+ [[inline], [inline function specifier]],
+ [[inline inline], [redundant function specifiers]],
+ [[function (@<:@@<:@:alnum:@:>@_@:>@* as], [named function parameter]],
+ [[function (void)], [empty prototype declaration]],
+ [[function returning], [non-prototype function declaration]],
+ [[\.\.\.], [variadic function]],
+ [[const], [const qualifier]],
+ [[volatile], [volatile qualifier]],
+ [[restrict], [restrict qualifier]],
+ [[const const], [redundant type qualifiers]],
+ [[variable-length array], [variable-length array]],
+ [[static], [static storage-class specifier]],
+ [[extern], [extern storage-class specifier]],
+ [[typedef], [typedef storage-class specifier]],
+ [[auto], [auto storage-class specifier]],
+ [[register], [register storage-class specifier]],
+ [[void], [void type specifier]],
+ [[char], [char type specifier]],
+ [[short], [short type specifier]],
+ [[int], [int type specifier]],
+ [[long], [long type specifier]],
+ [[float], [float type specifier]],
+ [[double], [double type specifier]],
+ [[signed], [signed type specifier]],
+ [[unsigned], [unsigned type specifier]],
+ [[_Bool], [_Bool type specifier]],
+ [[_Complex], [_Complex type specifier]],
+ [[_Imaginary], [_Imaginary type specifier]],
+ [[union], [union type specifier]],
+ [[enum], [enum type specifier]],
+ [[pointer to array], [pointer to an array]],
+ [[pointer to function], [pointer to a function]],
+])
+
+m4_define([sanity_sed], [/$1/i\
+AS_TR_SH([$2])=:])
+AT_DATA([sanity.sed], [#n
+m4_map_sep([sanity_sed], [m4_newline], [sanity_tests])
+])
+
+printf 'Using seed %d\n' "$random_seed" >&AS_MESSAGE_LOG_FD
+AT_CHECK([randomdecl -En 10000 -s "$random_seed" >decls], [0], [ignore-nolog])
+AT_CHECK([sed -f sanity.sed decls], [0], [stdout-nolog])
+sort -u stdout >decls.chk
+
+exec 3<decls.chk
+while read var <&3; do
+ eval "$var"
+done
+exec 3<&-
+
+m4_define([sanity_check], [AT_CHECK([$AS_TR_SH([$2]) false])])
+m4_map([sanity_check], [sanity_tests])
+
+AT_CLEANUP
AT_TESTED([cdecl99])
+AT_ARG_OPTION_ARG([random-seed],
+ [AS_HELP_STRING([--random-seed=ARG],
+ [Integer seed for randomized testing (default: auto)])],
+ [random_seed=$at_optarg], [random_seed=$RANDOM$$])
+
m4_divert_push([PREPARE_TESTS])dnl
: ${LIBTOOL="$SHELL $builddir/libtool"}
+random_seed=`printf '%s' "$random_seed" | tr -cd '@<:@:digit:@:>@'`
+random_seed=${random_seed:-0}
m4_divert_pop([PREPARE_TESTS])
+m4_define([TEST_NEED_PROGRAM], [AT_KEYWORDS([$1])dnl
+AT_CHECK([for arg in $check_PROGRAMS; do
+test x"${arg##*/}" != x"$1$EXEEXT" || exit 0
+done
+exit 77])])
+
m4_include([tests/general.at])
m4_include([tests/decl-good.at])
m4_include([tests/decl-bad.at])
+m4_include([tests/stress.at])