Make focus's "test_" or "bench_" prefix optional.

This commit is contained in:
Nigel Tao committed 2017-11-04 10:05:37 +11:00
1 parent 7e654ba652
commit c62aa518a5
3 files changed
+16 -2

No files matched your search

+1 -1
View File
@@ -52,7 +52,7 @@ const (
ccompilersUsage = `comma-separated list of C compilers, e.g. "clang,gcc"`
focusDefault = ""
focusUsage = `comma-separated list of tests or benchmarks (name prefixes) to focus on, e.g. "bench_puffs_gif_decode"`
focusUsage = `comma-separated list of tests or benchmarks (name prefixes) to focus on, e.g. "puffs_gif_decode"`
mimicDefault = false
mimicUsage = `whether to compare Puffs' output with other libraries' output`
+1 -1
View File
@@ -122,7 +122,7 @@ const (
ccompilersUsage = `comma-separated list of C compilers, e.g. "clang,gcc"`
focusDefault = ""
focusUsage = `comma-separated list of tests or benchmarks (name prefixes) to focus on, e.g. "bench_puffs_gif_decode"`
focusUsage = `comma-separated list of tests or benchmarks (name prefixes) to focus on, e.g. "puffs_gif_decode"`
langsDefault = "c"
langsUsage = `comma-separated list of target languages (file extensions), e.g. "c,go,rs"`
+14
View File
@@ -61,9 +61,23 @@ bool check_focus() {
while ((*q != ',') && (*q != '\x00')) {
q++;
}
// See if proc_funcname (with or without a "test_" or "bench_" prefix)
// starts with the [p, q) string.
if (!strncmp(proc_funcname, p, q - p)) {
return true;
}
const char* unprefixed_proc_funcname = NULL;
if (!strncmp(proc_funcname, "test_", 5)) {
unprefixed_proc_funcname = proc_funcname + 5;
} else if (!strncmp(proc_funcname, "bench_", 6)) {
unprefixed_proc_funcname = proc_funcname + 6;
}
if (unprefixed_proc_funcname &&
!strncmp(unprefixed_proc_funcname, p, q - p)) {
return true;
}
if (*q == '\x00') {
break;
}