SVN revision: 46742devs/devilhorns/wayland_egl
parent
1b9235aa1f
commit
bf8b3ce2a3
9 changed files with 348 additions and 1 deletions
@ -0,0 +1,62 @@ |
||||
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr> |
||||
dnl That code is public domain and can be freely used or copied. |
||||
|
||||
dnl Macro that check if coverage support is wanted and, if yes, if |
||||
dnl lcov is available. |
||||
|
||||
dnl Usage: EFL_CHECK_COVERAGE(tests [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
||||
dnl The parameter 'tests' is used if a dependency is needed. If set to "yes", |
||||
dnl the dependency is available. |
||||
dnl Defines EFL_COVERAGE_CFLAGS and EFL_COVERAGE_LIBS variables |
||||
dnl Defines the automake conditionnal EFL_ENABLE_COVERAGE |
||||
|
||||
AC_DEFUN([EFL_CHECK_COVERAGE], |
||||
[ |
||||
|
||||
dnl configure option |
||||
|
||||
AC_ARG_ENABLE([coverage], |
||||
[AC_HELP_STRING([--enable-coverage], [enable coverage profiling instrumentation @<:@default=disabled@:>@])], |
||||
[ |
||||
if test "x${enableval}" = "xyes" ; then |
||||
_efl_enable_coverage="yes" |
||||
else |
||||
_efl_enable_coverage="no" |
||||
fi |
||||
], |
||||
[_efl_enable_coverage="no"]) |
||||
|
||||
AC_MSG_CHECKING([whether to use profiling instrumentation]) |
||||
AC_MSG_RESULT([$_efl_enable_coverage]) |
||||
|
||||
dnl lcov check |
||||
|
||||
if test "x$_efl_enable_coverage" = "xyes" && test ! "x$1" = "xyes" ; then |
||||
AC_MSG_WARN([Coverage report requested but tests not being built, disable profiling instrumentation.]) |
||||
AC_MSG_WARN([Run configure with --enable-tests]) |
||||
_efl_enable_coverage="no" |
||||
fi |
||||
|
||||
if test "x$_efl_enable_coverage" = "xyes" ; then |
||||
AC_CHECK_PROG(have_lcov, [lcov], [yes], [no]) |
||||
if test "x$have_lcov" = "xyes" ; then |
||||
EFL_COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" |
||||
EFL_COVERAGE_LIBS="-lgcov" |
||||
# remove any optimisation flag and force debug symbols |
||||
EFL_DEBUG_CFLAGS="-g -O0 -DDEBUG" |
||||
else |
||||
AC_MSG_WARN([lcov is not found, disable profiling instrumentation]) |
||||
_efl_enable_coverage="no" |
||||
fi |
||||
fi |
||||
|
||||
dnl Substitution |
||||
AC_SUBST(EFL_COVERAGE_CFLAGS) |
||||
AC_SUBST(EFL_COVERAGE_LIBS) |
||||
|
||||
AM_CONDITIONAL(EFL_ENABLE_COVERAGE, test "x${_efl_enable_coverage}" = "xyes") |
||||
|
||||
AS_IF([test "x$_efl_enable_coverage" = "xyes"], [$2], [$3]) |
||||
]) |
||||
|
||||
dnl End of efl_coverage.m4 |
@ -0,0 +1,43 @@ |
||||
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr> |
||||
dnl That code is public domain and can be freely used or copied. |
||||
|
||||
dnl Macro that check if tests programs are wanted and if yes, if |
||||
dnl the Check library is available. |
||||
|
||||
dnl Usage: EFL_CHECK_TESTS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
||||
dnl Define the automake conditionnal EFL_ENABLE_TESTS |
||||
|
||||
AC_DEFUN([EFL_CHECK_TESTS], |
||||
[ |
||||
|
||||
dnl configure option |
||||
|
||||
AC_ARG_ENABLE([tests], |
||||
[AC_HELP_STRING([--enable-tests], [enable tests @<:@default=disabled@:>@])], |
||||
[ |
||||
if test "x${enableval}" = "xyes" ; then |
||||
_efl_enable_tests="yes" |
||||
else |
||||
_efl_enable_tests="no" |
||||
fi |
||||
], |
||||
[_efl_enable_tests="no"]) |
||||
|
||||
AC_MSG_CHECKING([whether tests are built]) |
||||
AC_MSG_RESULT([${_efl_enable_tests}]) |
||||
|
||||
AC_REQUIRE([PKG_PROG_PKG_CONFIG]) |
||||
|
||||
if test "x${_efl_enable_tests}" = "xyes" ; then |
||||
PKG_CHECK_MODULES([CHECK], |
||||
[check >= 0.9.5], |
||||
[dummy="yes"], |
||||
[_efl_enable_tests="no"]) |
||||
fi |
||||
|
||||
AM_CONDITIONAL(EFL_ENABLE_TESTS, test "x${_efl_enable_tests}" = "xyes") |
||||
|
||||
AS_IF([test "x$_efl_enable_tests" = "xyes"], [$1], [$2]) |
||||
]) |
||||
|
||||
dnl End of efl_tests.m4 |
@ -0,0 +1,103 @@ |
||||
#ifdef HAVE_CONFIG_H |
||||
# include <config.h> |
||||
#endif |
||||
|
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
#include <Efreet.h> |
||||
|
||||
#include "efreet_suite.h" |
||||
|
||||
typedef struct _Efreet_Test_Case Efreet_Test_Case; |
||||
|
||||
struct _Efreet_Test_Case |
||||
{ |
||||
const char *test_case; |
||||
void (*build)(TCase *tc); |
||||
}; |
||||
|
||||
static const Efreet_Test_Case etc[] = { |
||||
{ "Efreet", efreet_test_efreet }, |
||||
{ "Efreet Cache", efreet_test_efreet_cache }, |
||||
{ NULL, NULL } |
||||
}; |
||||
|
||||
static void |
||||
_list_tests(void) |
||||
{ |
||||
const Efreet_Test_Case *itr; |
||||
|
||||
itr = etc; |
||||
fputs("Available Test Cases:\n", stderr); |
||||
for (; itr->test_case != NULL; itr++) |
||||
fprintf(stderr, "\t%s\n", itr->test_case); |
||||
} |
||||
|
||||
static Eina_Bool |
||||
_use_test(int argc, const char **argv, const char *test_case) |
||||
{ |
||||
if (argc < 1) |
||||
return 1; |
||||
|
||||
for (; argc > 0; argc--, argv++) |
||||
if (strcmp(test_case, *argv) == 0) |
||||
return 1; |
||||
return 0; |
||||
} |
||||
|
||||
static Suite * |
||||
efreet_suite_build(int argc, const char **argv) |
||||
{ |
||||
TCase *tc; |
||||
Suite *s; |
||||
int i; |
||||
|
||||
s = suite_create("Efreet"); |
||||
|
||||
for (i = 0; etc[i].test_case != NULL; ++i) |
||||
{ |
||||
if (!_use_test(argc, argv, etc[i].test_case)) continue; |
||||
tc = tcase_create(etc[i].test_case); |
||||
|
||||
etc[i].build(tc); |
||||
|
||||
suite_add_tcase(s, tc); |
||||
tcase_set_timeout(tc, 0); |
||||
} |
||||
|
||||
return s; |
||||
} |
||||
|
||||
int |
||||
main(int argc, char **argv) |
||||
{ |
||||
Suite *s; |
||||
SRunner *sr; |
||||
int i, failed_count; |
||||
|
||||
for (i = 1; i < argc; i++) |
||||
if ((strcmp(argv[i], "-h") == 0) || |
||||
(strcmp(argv[i], "--help") == 0)) |
||||
{ |
||||
fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n", |
||||
argv[0]); |
||||
_list_tests(); |
||||
return 0; |
||||
} |
||||
else if ((strcmp(argv[i], "-l") == 0) || |
||||
(strcmp(argv[i], "--list") == 0)) |
||||
{ |
||||
_list_tests(); |
||||
return 0; |
||||
} |
||||
|
||||
s = efreet_suite_build(argc - 1, (const char **)argv + 1); |
||||
sr = srunner_create(s); |
||||
|
||||
srunner_run_all(sr, CK_NORMAL); |
||||
failed_count = srunner_ntests_failed(sr); |
||||
srunner_free(sr); |
||||
|
||||
return (failed_count == 0) ? 0 : 255; |
||||
} |
@ -0,0 +1,10 @@ |
||||
#ifndef _EFREET_SUITE_H |
||||
#define _EFREET_SUITE_H |
||||
|
||||
#include <check.h> |
||||
|
||||
void efreet_test_efreet(TCase *tc); |
||||
void efreet_test_efreet_cache(TCase *tc); |
||||
|
||||
|
||||
#endif /* _EFREET_SUITE_H */ |
@ -0,0 +1,25 @@ |
||||
#ifdef HAVE_CONFIG_H |
||||
# include <config.h> |
||||
#endif |
||||
|
||||
#include <Efreet.h> |
||||
|
||||
#include "efreet_suite.h" |
||||
|
||||
|
||||
START_TEST(efreet_test_efreet_init) |
||||
{ |
||||
int ret; |
||||
|
||||
ret = efreet_init(); |
||||
fail_if(ret != 1); |
||||
|
||||
ret = efreet_shutdown(); |
||||
fail_if(ret != 0); |
||||
} |
||||
END_TEST |
||||
|
||||
void efreet_test_efreet(TCase *tc) |
||||
{ |
||||
tcase_add_test(tc, efreet_test_efreet_init); |
||||
} |
@ -0,0 +1,31 @@ |
||||
#ifdef HAVE_CONFIG_H |
||||
# include <config.h> |
||||
#endif |
||||
|
||||
#include <Efreet.h> |
||||
|
||||
#include "efreet_suite.h" |
||||
|
||||
|
||||
START_TEST(efreet_test_efreet_cache_init) |
||||
{ |
||||
int ret; |
||||
|
||||
ret = efreet_init(); |
||||
fail_if(ret != 1); |
||||
|
||||
ret = efreet_util_init(); |
||||
fail_if(ret != 1); |
||||
|
||||
ret = efreet_util_shutdown(); |
||||
fail_if(ret != 0); |
||||
|
||||
ret = efreet_shutdown(); |
||||
fail_if(ret != 0); |
||||
} |
||||
END_TEST |
||||
|
||||
void efreet_test_efreet_cache(TCase *tc) |
||||
{ |
||||
tcase_add_test(tc, efreet_test_efreet_cache_init); |
||||
} |
Loading…
Reference in new issue