Added fnmatch conditional for Windows portability
This commit is contained in:
parent
cde5fed6d4
commit
e9f0dfb572
3 changed files with 15 additions and 1 deletions
|
@ -20,6 +20,8 @@ AC_PROG_LN_S
|
|||
AC_PROG_MAKE_SET
|
||||
AC_SUBST([LIBTOOL_DEPS])
|
||||
|
||||
AC_FUNC_FNMATCH
|
||||
|
||||
AC_ARG_ENABLE([gcov],
|
||||
[AS_HELP_STRING([--enable-gcov],
|
||||
[Compile the project with converage enabled])],
|
||||
|
|
|
@ -112,7 +112,9 @@ int main(int argc, char *argv[]) {
|
|||
{"list", no_argument, 0, 'l'},
|
||||
{"ascii", no_argument, 0, 'k'},
|
||||
{"fail-fast", no_argument, 0, 'f'},
|
||||
#ifdef HAVE_FNMATCH
|
||||
{"pattern", required_argument, 0, 'p'},
|
||||
#endif
|
||||
{"always-succeed", no_argument, 0, 'y'},
|
||||
{"no-early-exit", no_argument, 0, 'z'},
|
||||
{0, 0, 0, 0 }
|
||||
|
@ -124,7 +126,9 @@ int main(int argc, char *argv[]) {
|
|||
.fail_fast = !strcmp("1", getenv("CRITERION_FAIL_FAST") ?: "0"),
|
||||
.use_ascii = !strcmp("1", getenv("CRITERION_USE_ASCII") ?: "0"),
|
||||
.logging_threshold = atoi(getenv("CRITERION_VERBOSITY_LEVEL") ?: "2"),
|
||||
#ifdef HAVE_FNMATCH
|
||||
.pattern = getenv("CRITERION_TEST_PATTERN"),
|
||||
#endif
|
||||
.output_provider = NORMAL_LOGGING,
|
||||
};
|
||||
|
||||
|
@ -140,7 +144,9 @@ int main(int argc, char *argv[]) {
|
|||
case 'z': criterion_options.no_early_exit = true; break;
|
||||
case 'k': criterion_options.use_ascii = true; break;
|
||||
case 'f': criterion_options.fail_fast = true; break;
|
||||
#ifdef HAVE_FNMATCH
|
||||
case 'p': criterion_options.pattern = optarg; break;
|
||||
#endif
|
||||
case 't': use_tap = true; break;
|
||||
case 'l': do_list_tests = true; break;
|
||||
case 'v': do_print_version = true; break;
|
||||
|
|
|
@ -24,13 +24,17 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fnmatch.h>
|
||||
#include "criterion/types.h"
|
||||
#include "criterion/stats.h"
|
||||
#include "criterion/logging.h"
|
||||
#include "criterion/options.h"
|
||||
#include "criterion/ordered-set.h"
|
||||
#include "report.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_FNMATCH
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
|
||||
#define IMPL_CALL_REPORT_HOOKS(Kind) \
|
||||
IMPL_SECTION_LIMITS(f_report_hook, crit_ ## Kind); \
|
||||
|
@ -53,6 +57,7 @@ __attribute__((always_inline))
|
|||
static inline void nothing() {}
|
||||
|
||||
IMPL_REPORT_HOOK(PRE_ALL)(struct criterion_test_set *set) {
|
||||
#ifdef HAVE_FNMATCH
|
||||
if (criterion_options.pattern) {
|
||||
FOREACH_SET(struct criterion_suite_set *s, set->suites) {
|
||||
if ((s->suite.data && s->suite.data->disabled) || !s->tests)
|
||||
|
@ -64,6 +69,7 @@ IMPL_REPORT_HOOK(PRE_ALL)(struct criterion_test_set *set) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
log(pre_all, set);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue