diff --git a/cmd/puffs-c/main.go b/cmd/puffs-c/main.go index 09e4c5fb..6e42b672 100644 --- a/cmd/puffs-c/main.go +++ b/cmd/puffs-c/main.go @@ -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` diff --git a/cmd/puffs/main.go b/cmd/puffs/main.go index 8bdd0f80..72d4c6fa 100644 --- a/cmd/puffs/main.go +++ b/cmd/puffs/main.go @@ -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"` diff --git a/test/c/testlib/testlib.c b/test/c/testlib/testlib.c index 62822a82..9888f28f 100644 --- a/test/c/testlib/testlib.c +++ b/test/c/testlib/testlib.c @@ -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; }