kyua-testers: update to 0.2.

This commit is contained in:
Juan RP 2013-12-08 15:35:49 +01:00
parent 56058ad261
commit 53b80a7931
2 changed files with 3 additions and 340 deletions

View File

@ -1,337 +0,0 @@
From 97d47392460ad5c820f0b316a7012104b5cd6168 Mon Sep 17 00:00:00 2001
From: Julio Merino <jmmv@google.com>
Date: Tue, 12 Mar 2013 16:07:26 -0400
Subject: [PATCH 1/4] Cache configure results for custom tests
Add caching of the results of most of our custom tests -- particularly
to those that need to execute a test program to determine the outcome
of the result.
This is to aid cross-build environments to pass the expected result of
these configure tests, as they cannot execute the tests themselves.
---
m4/compiler-features.m4 | 77 +++++++++++++++++++++++++++++--------------------
m4/fs.m4 | 24 +++++++--------
m4/getopt.m4 | 55 ++++++++++++++++++++---------------
m4/signals.m4 | 26 ++++++++---------
4 files changed, 102 insertions(+), 80 deletions(-)
diff --git a/m4/compiler-features.m4 b/m4/compiler-features.m4
index 1e1980d..6ed3de9 100644
--- m4/compiler-features.m4
+++ m4/compiler-features.m4
@@ -35,13 +35,13 @@ dnl does not allow it.
dnl
AC_DEFUN([KYUA_REQUIRE_CXX], [
AC_CACHE_CHECK([whether the C++ compiler works],
- [atf_cv_prog_cxx_works],
+ [kyua_cv_prog_cxx_works],
[AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
- [atf_cv_prog_cxx_works=yes],
- [atf_cv_prog_cxx_works=no])
+ [kyua_cv_prog_cxx_works=yes],
+ [kyua_cv_prog_cxx_works=no])
AC_LANG_POP([C++])])
- if test "${atf_cv_prog_cxx_works}" = no; then
+ if test "${kyua_cv_prog_cxx_works}" = no; then
AC_MSG_ERROR([C++ compiler cannot create executables])
fi
])
@@ -96,20 +96,25 @@ AC_DEFUN([KYUA_ATTRIBUTE_NORETURN], [
dnl Sun's cc does support the noreturn attribute but CC (the C++
dnl compiler) does not. And in that case, CC just raises a warning
dnl during compilation, not an error.
- AC_MSG_CHECKING(whether __attribute__((noreturn)) is supported)
- AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
+ AC_CACHE_CHECK(
+ [whether __attribute__((noreturn)) is supported],
+ [kyua_cv_attribute_noreturn], [
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
#if ((__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || __GNUC__ > 2)
return 0;
#else
return 1;
#endif
- ])],
- [AC_MSG_RESULT(yes)
- value="__attribute__((noreturn))"],
- [AC_MSG_RESULT(no)
- value=""]
- )
- AC_SUBST([ATTRIBUTE_NORETURN], [${value}])
+ ])],
+ [kyua_cv_attribute_noreturn=yes],
+ [kyua_cv_attribute_noreturn=no])
+ ])
+ if test "${kyua_cv_attribute_noreturn}" = yes; then
+ attribute_value="__attribute__((noreturn))"
+ else
+ attribute_value=""
+ fi
+ AC_SUBST([ATTRIBUTE_NORETURN], [${attribute_value}])
])
@@ -119,9 +124,11 @@ dnl
dnl Checks if the current compiler has a way to mark functions as pure.
dnl
AC_DEFUN([KYUA_ATTRIBUTE_PURE], [
- AC_MSG_CHECKING(whether __attribute__((__pure__)) is supported)
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
+ AC_CACHE_CHECK(
+ [whether __attribute__((__pure__)) is supported],
+ [kyua_cv_attribute_pure], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
static int function(int, int) __attribute__((__pure__));
static int
@@ -131,12 +138,15 @@ function(int a, int b)
}], [
return function(3, 4);
])],
- [AC_MSG_RESULT(yes)
- value="__attribute__((__pure__))"],
- [AC_MSG_RESULT(no)
- value=""]
- )
- AC_SUBST([ATTRIBUTE_PURE], [${value}])
+ [kyua_cv_attribute_pure=yes],
+ [kyua_cv_attribute_pure=no])
+ ])
+ if test "${kyua_cv_attribute_pure}" = yes; then
+ attribute_value="__attribute__((__pure__))"
+ else
+ attribute_value=""
+ fi
+ AC_SUBST([ATTRIBUTE_PURE], [${attribute_value}])
])
@@ -147,9 +157,11 @@ dnl Checks if the current compiler has a way to mark parameters as unused
dnl so that the -Wunused-parameter warning can be avoided.
dnl
AC_DEFUN([KYUA_ATTRIBUTE_UNUSED], [
- AC_MSG_CHECKING(whether __attribute__((__unused__)) is supported)
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
+ AC_CACHE_CHECK(
+ [whether __attribute__((__unused__)) is supported],
+ [kyua_cv_attribute_unused], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
static void
function(int a __attribute__((__unused__)))
{
@@ -157,10 +169,13 @@ function(int a __attribute__((__unused__)))
function(3);
return 0;
])],
- [AC_MSG_RESULT(yes)
- value="__attribute__((__unused__))"],
- [AC_MSG_RESULT(no)
- value=""]
- )
- AC_SUBST([ATTRIBUTE_UNUSED], [${value}])
+ [kyua_cv_attribute_unused=yes],
+ [kyua_cv_attribute_unused=no])
+ ])
+ if test "${kyua_cv_attribute_unused}" = yes; then
+ attribute_value="__attribute__((__unused__))"
+ else
+ attribute_value=""
+ fi
+ AC_SUBST([ATTRIBUTE_UNUSED], [${attribute_value}])
])
diff --git a/m4/fs.m4 b/m4/fs.m4
index 94b42f0..e4a27e8 100644
--- m4/fs.m4
+++ m4/fs.m4
@@ -43,9 +43,10 @@ dnl nice to detect if lchmod(3) works at run time to prevent side-effects of
dnl this test but doing so means we will keep receiving a noisy compiler
dnl warning.
AC_DEFUN([KYUA_FS_LCHMOD], [
- AC_MSG_CHECKING([for a working lchmod])
- working_lchmod=no
- AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <sys/stat.h>
+ AC_CACHE_CHECK(
+ [for a working lchmod],
+ [kyua_cv_lchmod_works], [
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -59,15 +60,14 @@ AC_DEFUN([KYUA_FS_LCHMOD], [
return lchmod("conftest.txt", 0640) != -1 ? EXIT_SUCCESS : EXIT_FAILURE;
])],
- [AC_MSG_RESULT([yes])
- AC_DEFINE_UNQUOTED([HAVE_WORKING_LCHMOD], [1],
- [Define to 1 if your lchmod works])],
- [if test ! -f conftest.txt; then
- AC_MSG_RESULT([failed; assuming no])
- else
- rm -f conftest.txt
- AC_MSG_RESULT([no])
- fi])
+ [kyua_cv_lchmod_works=yes],
+ [kyua_cv_lchmod_works=no])
+ ])
+ rm -f conftest.txt
+ if test "${kyua_cv_lchmod_works}" = yes; then
+ AC_DEFINE_UNQUOTED([HAVE_WORKING_LCHMOD], [1],
+ [Define to 1 if your lchmod works])
+ fi
])
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index 534de39..9e6c04e 100644
--- m4/getopt.m4
+++ m4/getopt.m4
@@ -34,8 +34,10 @@ dnl the beginning of the options string to request POSIX behavior.
dnl
dnl Defines HAVE_GETOPT_GNU if a + sign is supported.
AC_DEFUN([_KYUA_GETOPT_GNU], [
- AC_MSG_CHECKING([whether getopt allows a + sign for POSIX behavior])
- AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
+ AC_CACHE_CHECK(
+ [whether getopt allows a + sign for POSIX behavior optreset],
+ [kyua_cv_getopt_gnu], [
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
#include <string.h>
#include <unistd.h>], [
int argc = 4;
@@ -67,11 +69,13 @@ AC_DEFUN([_KYUA_GETOPT_GNU], [
return (seen_a && !seen_plus) ? EXIT_SUCCESS : EXIT_FAILURE;
])],
- [getopt_allows_plus=yes
- AC_DEFINE([HAVE_GETOPT_GNU], [1],
- [Define to 1 if getopt allows a + sign for POSIX behavior])],
- [getopt_allows_plus=no])
- AC_MSG_RESULT(${getopt_allows_plus})
+ [kyua_cv_getopt_gnu=yes],
+ [kyua_cv_getopt_gnu=no])
+ ])
+ if test "${kyua_cv_getopt_gnu}" = yes; then
+ AC_DEFINE([HAVE_GETOPT_GNU], [1],
+ [Define to 1 if getopt allows a + sign for POSIX behavior])
+ fi
])
dnl Checks if optreset exists to reset the processing of getopt(3) options.
@@ -82,9 +86,10 @@ dnl is only present in the BSD versions of getopt(3).
dnl
dnl Defines HAVE_GETOPT_WITH_OPTRESET if optreset exists.
AC_DEFUN([_KYUA_GETOPT_WITH_OPTRESET], [
- AC_MSG_CHECKING([whether getopt has optreset])
-
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ AC_CACHE_CHECK(
+ [whether getopt has optreset],
+ [kyua_cv_getopt_optreset], [
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h>
#include <unistd.h>
@@ -95,12 +100,13 @@ main(void)
return EXIT_SUCCESS;
}
])],
- [getopt_optreset=yes
- AC_DEFINE([HAVE_GETOPT_WITH_OPTRESET], [1],
- [Define to 1 if getopt has optreset])],
- [getopt_optreset=no])
-
- AC_MSG_RESULT([${getopt_optreset}])
+ [kyua_cv_getopt_optreset=yes],
+ [kyua_cv_getopt_optreset=no])
+ ])
+ if test "${kyua_cv_getopt_optreset}" = yes; then
+ AC_DEFINE([HAVE_GETOPT_WITH_OPTRESET], [1],
+ [Define to 1 if getopt has optreset])
+ fi
])
@@ -114,9 +120,10 @@ dnl
dnl Sets the GETOPT_OPTIND_RESET_VALUE macro to the integer value that has to
dnl be passed to optind to reset option processing.
AC_DEFUN([_KYUA_GETOPT_OPTIND_RESET_VALUE], [
- AC_MSG_CHECKING([for the optind value to reset getopt processing])
-
- AC_RUN_IFELSE([AC_LANG_SOURCE([
+ AC_CACHE_CHECK(
+ [for the optind value to reset getopt processing],
+ [kyua_cv_getopt_optind_reset_value], [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -189,12 +196,12 @@ main(void)
return EXIT_SUCCESS;
}
])],
- [optind_reset_value=0],
- [optind_reset_value=1])
-
- AC_DEFINE_UNQUOTED([GETOPT_OPTIND_RESET_VALUE], [${optind_reset_value}],
+ [kyua_cv_getopt_optind_reset_value=0],
+ [kyua_cv_getopt_optind_reset_value=1])
+ ])
+ AC_DEFINE_UNQUOTED([GETOPT_OPTIND_RESET_VALUE],
+ [${kyua_cv_getopt_optind_reset_value}],
[Define to the optind value to reset getopt processing])
- AC_MSG_RESULT([${optind_reset_value}])
])
diff --git a/m4/signals.m4 b/m4/signals.m4
index e1d689c..8ceff43 100644
--- m4/signals.m4
+++ m4/signals.m4
@@ -32,8 +32,10 @@ dnl
dnl Detect the last valid signal number.
dnl
AC_DEFUN([KYUA_LAST_SIGNO], [
- AC_MSG_CHECKING(for the last valid signal)
- AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <err.h>
+ AC_CACHE_CHECK(
+ [for the last valid signal],
+ [kyua_cv_signals_lastno], [
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
@@ -75,16 +77,14 @@ AC_DEFUN([KYUA_LAST_SIGNO], [
return EXIT_SUCCESS;
])],
- [if test ! -f conftest.cnt; then
- last_signo=15
- AC_MSG_RESULT(failed; assuming ${last_signo})
- else
- last_signo=$(cat conftest.cnt)
- rm -f conftest.cnt
- AC_MSG_RESULT(${last_signo})
- fi],
- [last_signo=15
- AC_MSG_RESULT(failed; assuming ${last_signo})])
- AC_DEFINE_UNQUOTED([LAST_SIGNO], [${last_signo}],
+ [if test ! -f conftest.cnt; then
+ kyua_cv_signals_lastno=15
+ else
+ kyua_cv_signals_lastno=$(cat conftest.cnt)
+ rm -f conftest.cnt
+ fi],
+ [kyua_cv_signals_lastno=15])
+ ])
+ AC_DEFINE_UNQUOTED([LAST_SIGNO], [${kyua_cv_signals_lastno}],
[Define to the last valid signal number])
])
--
1.8.4.1

View File

@ -1,7 +1,7 @@
# Template file for 'kyua-testers'
pkgname=kyua-testers
version=0.1
revision=3
version=0.2
revision=1
build_style=gnu-configure
configure_args="
kyua_cv_attribute_noreturn=yes kyua_cv_lchmod_works=no
@ -15,7 +15,7 @@ maintainer="Juan RP <xtraeme@gmail.com>"
license="BSD"
homepage="http://code.google.com/p/kyua"
distfiles="https://kyua.googlecode.com/files/${pkgname}-${version}.tar.gz"
checksum=08f30eef2c967c5451f858ed63c0c4647899d634fcb32dc5fe5fbdb3e0170e49
checksum=8e788d9f6a1b86bcf3b436e870cbc801cf7650fa3f0f82da8b025e36ffe84feb
long_desc="
Kyua (pronounced Q.A.) is a testing framework for both developers and users.
Kyua is different from most other testing frameworks in that it puts the end