From 6d89cbf4838083291d303ca0bccf5b024777bfae Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 27 Jan 2020 17:46:19 -0500 Subject: [PATCH] Add a test case which runs the GOB2_CHECK macro. The shipped macro is actually busted because the version in this git repo is 2.0.20a and the --version output parsing explodes badly. Before fixing the macro, let's add a test which runs a basic test of the macro against the just-compiled gob2 version. --- tests/general.at | 46 +++++++++++++++++++++++++++++++++++++++++++++- testsuite.at | 8 ++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/tests/general.at b/tests/general.at index 9e5fbcc..10f6f0f 100644 --- a/tests/general.at +++ b/tests/general.at @@ -1,4 +1,4 @@ -dnl Copyright © 2019 Nick Bowler +dnl Copyright © 2019-2020 Nick Bowler dnl License GPLv2+: GNU General Public License version 2 or any later version. dnl This is free software: you are free to change and redistribute it. dnl There is NO WARRANTY, to the extent permitted by law. @@ -266,3 +266,47 @@ AT_CHECK([./main], [0], [Hello, World! ]) AT_CLEANUP + +AT_SETUP([GOB2_CHECK min-version test]) + +AT_DATA([configure.ac], +[[AC_PREREQ([2.62]) +AC_INIT([test], [0]) +AC_OUTPUT +]]) +AT_CHECK([$AUTOCONF && test -f configure || exit 77], [0], [ignore], [ignore]) + +m4_define([MYVER], + m4_bpatsubst(m4_dquote(m4_defn([AT_PACKAGE_VERSION])), [[^][0-9.]])) +m4_if(m4_defn([MYVER]), m4_defn([AT_PACKAGE_VERSION]), [], [AT_XFAIL_IF([:])]) + +m4_define([MYVER_P1], m4_dquote(m4_reverse(m4_unquote( + m4_split(m4_defn([MYVER]), [[.]]))))) +m4_define([MYVER_P1], m4_join([.], m4_reverse( + m4_eval(m4_car(MYVER_P1)+1), m4_shift(MYVER_P1)))) + +AT_DATA([test.in], [[@GOB2@ +]]) + +cat >configure.ac <expout +AT_CHECK([cat test], [0], [expout], [ignore]) + +sed '/GOB2_CHECK/c\ +[GOB2_CHECK(]m4_dquote(m4_defn([MYVER_P1]))[)]' configure.ac >configure.new +mv -f configure.new configure.ac +AT_CHECK([$AUTOCONF --force]) +AT_CHECK([./configure], [1], [ignore], [ignore]) + +AT_CLEANUP diff --git a/testsuite.at b/testsuite.at index 97c0253..fccacb4 100644 --- a/testsuite.at +++ b/testsuite.at @@ -20,5 +20,13 @@ AT_INIT AT_COLOR_TESTS AT_TESTED([gob2]) +m4_divert_push([PREPARE_TESTS])dnl +:; { + AS_ECHO(["AUTOCONF = ${AUTOCONF=autoconf}"]) + command -v $AUTOCONF + (set -x; $AUTOCONF --version) 2>&1 + echo +} >&AS_MESSAGE_LOG_FD +m4_divert_pop([PREPARE_TESTS]) m4_include([tests/general.at]) -- 2.43.0