Commit 05712adc authored by Pekka Pessi's avatar Pekka Pessi

Check for new _tcase_add_test() API.

parent c7184cc9
...@@ -108,6 +108,7 @@ PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no") ...@@ -108,6 +108,7 @@ PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes") AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
if test x"$have_check" = "xyes"; then if test x"$have_check" = "xyes"; then
AC_DEFINE([HAVE_CHECK], 1, [Define to 1 if check library is available]) AC_DEFINE([HAVE_CHECK], 1, [Define to 1 if check library is available])
SAC_NEW_TCASE_ADD_TEST
fi fi
AC_CHECK_HEADERS([fnmatch.h]) AC_CHECK_HEADERS([fnmatch.h])
......
...@@ -403,3 +403,19 @@ if test $ac_cv_dev_urandom = yes; then ...@@ -403,3 +403,19 @@ if test $ac_cv_dev_urandom = yes; then
[Define to the random number source name.]) [Define to the random number source name.])
fi fi
]) ])
dnl ======================================================================
dnl Check for internal check API
dnl ======================================================================
AC_DEFUN([SAC_NEW_TCASE_ADD_TEST],[
CFLAGS_save=$CFLAGS CFLAGS="$CFLAGS $CHECK_CFLAGS"
AC_COMPILE_IFELSE([#include <check.h>
void tcase_add_ss1_test(TCase *tc, TFun tf, char const *name)
{
/* prototype with allowed_exit_value */
_tcase_add_test(tc, tf, name, 0, 0, 0, 1);
}
], [AC_DEFINE([HAVE_NEW_TCASE_ADD_TEST], [1],
[tcase_add_test() with allowed_exit_value argument])])
CFLAGS=$CFLAGS_save])
...@@ -57,7 +57,11 @@ void s2_tcase_add_test(TCase *tc, TFun tf, char const *name, ...@@ -57,7 +57,11 @@ void s2_tcase_add_test(TCase *tc, TFun tf, char const *name,
if (strcmp(*patterns, "*")) { if (strcmp(*patterns, "*")) {
printf("%s: selected\n", name); printf("%s: selected\n", name);
} }
#if HAVE_NEW_TCASE_ADD_TEST
_tcase_add_test(tc, tf, name, signo, start, end, 0);
#else
_tcase_add_test(tc, tf, name, signo, start, end); _tcase_add_test(tc, tf, name, signo, start, end);
#endif
return; return;
} }
} }
...@@ -67,7 +71,11 @@ void s2_tcase_add_test(TCase *tc, TFun tf, char const *name, ...@@ -67,7 +71,11 @@ void s2_tcase_add_test(TCase *tc, TFun tf, char const *name,
if (strcmp(*patterns, "*")) { if (strcmp(*patterns, "*")) {
printf("%s: selected\n", name); printf("%s: selected\n", name);
} }
#if HAVE_NEW_TCASE_ADD_TEST
_tcase_add_test(tc, tf, name, signo, start, end, 0);
#else
_tcase_add_test(tc, tf, name, signo, start, end); _tcase_add_test(tc, tf, name, signo, start, end);
#endif
return; return;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment