mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
[REGEX] matcher_t unit test now takes a flag to turn on fingerprinting
This commit is contained in:
parent
8d2d4f1fa0
commit
45035ffa1a
@ -109,9 +109,18 @@ int main(int argc, char **argv)
|
|||||||
char **regex;
|
char **regex;
|
||||||
int nregex;
|
int nregex;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int want_finger_print = 0, i;
|
||||||
|
const char *pattern_file = NULL;
|
||||||
|
|
||||||
if (argc < 2) {
|
for (i = 1; i < argc; i++)
|
||||||
fprintf(stderr, "Usage : %s <pattern_file>\n", argv[0]);
|
if (!strcmp(argv[i], "--fingerprint"))
|
||||||
|
want_finger_print = 1;
|
||||||
|
|
||||||
|
else
|
||||||
|
pattern_file = argv[i];
|
||||||
|
|
||||||
|
if (!pattern_file) {
|
||||||
|
fprintf(stderr, "Usage : %s [--fingerprint] <pattern_file>\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +132,7 @@ int main(int argc, char **argv)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_read_spec(argv[1], ®ex, &nregex)) {
|
if (!_read_spec(pattern_file, ®ex, &nregex)) {
|
||||||
fprintf(stderr, "Couldn't read the lex specification\n");
|
fprintf(stderr, "Couldn't read the lex specification\n");
|
||||||
ret = 3;
|
ret = 3;
|
||||||
goto err;
|
goto err;
|
||||||
@ -135,7 +144,8 @@ int main(int argc, char **argv)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("fingerprint: %x\n", dm_regex_fingerprint(scanner));
|
if (want_finger_print)
|
||||||
|
printf("fingerprint: %x\n", dm_regex_fingerprint(scanner));
|
||||||
_scan_input(scanner, regex);
|
_scan_input(scanner, regex);
|
||||||
_free_regex(regex, nregex);
|
_free_regex(regex, nregex);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user