diff --git a/cmd/puffs-c/test.go b/cmd/puffs-c/test.go index c657c0ac..bb9e44ba 100644 --- a/cmd/puffs-c/test.go +++ b/cmd/puffs-c/test.go @@ -28,7 +28,7 @@ import ( func isStringList(s string) bool { for i := 0; i < len(s); i++ { c := s[i] - if c == ',' || c == '-' || c == '.' || ('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || + if c == ',' || c == '-' || c == '.' || c == '/' || ('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || c == '_' || ('a' <= c && c <= 'z') { continue } diff --git a/cmd/puffs/test.go b/cmd/puffs/test.go index 042e2140..7bfedea9 100644 --- a/cmd/puffs/test.go +++ b/cmd/puffs/test.go @@ -26,7 +26,7 @@ import ( func isStringList(s string) bool { for i := 0; i < len(s); i++ { c := s[i] - if c == ',' || c == '-' || c == '.' || ('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || + if c == ',' || c == '-' || c == '.' || c == '/' || ('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || c == '_' || ('a' <= c && c <= 'z') { continue } diff --git a/test/c/testlib/testlib.c b/test/c/testlib/testlib.c index c7b3a847..9df71d39 100644 --- a/test/c/testlib/testlib.c +++ b/test/c/testlib/testlib.c @@ -55,12 +55,25 @@ bool check_focus() { return true; } // On each iteration of the loop, set p and q so that p (inclusive) and q - // (exclusive) bracket the comma-separated elements of focus. + // (exclusive) bracket the interesting fragment of the comma-separated + // elements of focus. while (true) { - const char* q = p; - while ((*q != ',') && (*q != '\x00')) { - q++; + const char* r = p; + const char* q = NULL; + while ((*r != ',') && (*r != '\x00')) { + if ((*r == '/') && (q == NULL)) { + q = r; + } + r++; } + if (q == NULL) { + q = r; + } + // At this point, r points to the comma or NUL byte that ends this element + // of the comma-separated list. q points to the first slash in that + // element, or if there are no slashes, q equals r. + // + // The pointers are named so that (p <= q) && (q <= r). if (p == q) { // No-op. Skip empty focus targets, which makes it convenient to @@ -71,8 +84,6 @@ bool check_focus() { // and won't start with "Benchmark". Stripping lets us conveniently // copy/paste a string like "Benchmarkpuffs_gif_decode_10k/gcc" from the // "puffs bench std/gif" output. - // - // TODO: strip the "/gcc". if (!strncmp(p, "Benchmark", 9)) { p += 9; } @@ -94,10 +105,10 @@ bool check_focus() { } } - if (*q == '\x00') { + if (*r == '\x00') { break; } - p = q + 1; + p = r + 1; } return false; }