Added string identifier precompilation to avoid dynamic generation in pattern matching
This commit is contained in:
parent
2faf341c9d
commit
576dc9d97e
3 changed files with 3 additions and 5 deletions
|
@ -17,6 +17,7 @@
|
|||
# define Test_(Category, Name, ...) \
|
||||
TEST_PROTOTYPE_(Category, Name); \
|
||||
struct criterion_test_extra_data IDENTIFIER_(Category, Name, extra) = { \
|
||||
.identifier_ = #Category "/" #Name, \
|
||||
.file_ = __FILE__, \
|
||||
.line_ = __LINE__, \
|
||||
__VA_ARGS__ \
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
struct criterion_test_extra_data {
|
||||
int sentinel_;
|
||||
const char *const identifier_;
|
||||
const char *const file_;
|
||||
const unsigned line_;
|
||||
void (*init)(void);
|
||||
|
|
|
@ -59,12 +59,8 @@ IMPL_REPORT_HOOK(PRE_ALL)(struct criterion_test_set *set) {
|
|||
continue;
|
||||
|
||||
FOREACH_SET(struct criterion_test *test, s->tests) {
|
||||
char *name = NULL;
|
||||
asprintf(&name, "%s/%s", s->suite.name, test->name);
|
||||
if (fnmatch(criterion_options.pattern, name, 0))
|
||||
if (fnmatch(criterion_options.pattern, test->data->identifier_, 0))
|
||||
test->data->disabled = true;
|
||||
|
||||
free(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue