Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: allow --rewrite when testing many targets with /... #82471

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/cmd/dev/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error {
}

var target string
if strings.Contains(pkg, ":") {
if strings.Contains(pkg, ":") || strings.HasSuffix(pkg, "/...") {
// For parity with bazel, we allow specifying named build targets.
target = pkg
} else {
Expand Down Expand Up @@ -336,6 +336,9 @@ func (d *dev) getStressArgs(stressCmdArg string, timeout time.Duration) []string

func getDirectoryFromTarget(target string) string {
target = strings.TrimPrefix(target, "//")
if strings.HasSuffix(target, "/...") {
return strings.TrimSuffix(target, "/...")
}
colon := strings.LastIndex(target, ":")
if colon < 0 {
return target
Expand Down
10 changes: 8 additions & 2 deletions pkg/cmd/dev/testdata/datadriven/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bazel test pkg/util/tracing:all --test_env=GOTRACEBACK=all --test_output errors
exec
dev test pkg/util/tracing/...
----
bazel test pkg/util/tracing/...:all --test_env=GOTRACEBACK=all --test_output errors
bazel test pkg/util/tracing/... --test_env=GOTRACEBACK=all --test_output errors

exec
dev test pkg/util/tracing -f TestStartChild*
Expand Down Expand Up @@ -114,7 +114,7 @@ bazel test //pkg:all_tests --test_env=GOTRACEBACK=all --test_output errors
exec
dev test pkg/spanconfig/... pkg/ccl/spanconfigccl/...
----
bazel test pkg/spanconfig/...:all pkg/ccl/spanconfigccl/...:all --test_env=GOTRACEBACK=all --test_output errors
bazel test pkg/spanconfig/... pkg/ccl/spanconfigccl/... --test_env=GOTRACEBACK=all --test_output errors

exec
dev test pkg/sql/schemachanger --rewrite -v
Expand All @@ -127,3 +127,9 @@ dev test pkg/sql/opt/xform --rewrite
----
bazel info workspace --color=no
bazel test pkg/sql/opt/xform:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/opt/xform --sandbox_writable_path=crdb-checkout/pkg/sql/opt/testutils/opttester/testfixtures --test_sharding_strategy=disabled --test_output errors

exec
dev test pkg/sql/... --rewrite
----
bazel info workspace --color=no
bazel test pkg/sql/... --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql --test_sharding_strategy=disabled --test_output errors