diff --git a/dev b/dev index a060e931f1c5..ae434916a0c5 100755 --- a/dev +++ b/dev @@ -8,7 +8,7 @@ fi set -euo pipefail # Bump this counter to force rebuilding `dev` on all machines. -DEV_VERSION=58 +DEV_VERSION=59 THIS_DIR=$(cd "$(dirname "$0")" && pwd) BINARY_DIR=$THIS_DIR/bin/dev-versions diff --git a/pkg/cmd/dev/testlogic.go b/pkg/cmd/dev/testlogic.go index 93accba482a1..a6f58404e1cb 100644 --- a/pkg/cmd/dev/testlogic.go +++ b/pkg/cmd/dev/testlogic.go @@ -247,7 +247,8 @@ func (d *dev) testlogic(cmd *cobra.Command, commandLine []string) error { } if files != "" || subtests != "" { - args = append(args, "--test_filter", munge(files)+"/"+subtests) + filesRegexp := spaceSeparatedRegexpsToRegexp(files) + args = append(args, "--test_filter", filesRegexp+"/"+subtests) args = append(args, "--test_sharding_strategy=disabled") } args = append(args, d.getTestOutputArgs(stress, verbose, showLogs, streamOutput)...) @@ -259,6 +260,21 @@ func (d *dev) testlogic(cmd *cobra.Command, commandLine []string) error { return nil } +// We know that the regular expressions for files should not contain whitespace +// because the file names do not contain whitespace. We support users passing +// whitespace separated regexps for multiple files. +func spaceSeparatedRegexpsToRegexp(s string) string { + s = munge(s) + split := strings.Fields(s) + if len(split) < 2 { + return s + } + for i, s := range split { + split[i] = "(" + s + ")" + } + return "(" + strings.Join(split, "|") + ")" +} + func munge(s string) string { if s == "" { return ".*"