diff --git a/dev b/dev index a6aab8d50c0c..9dcac5df35b2 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=84 +DEV_VERSION=85 THIS_DIR=$(cd "$(dirname "$0")" && pwd) BINARY_DIR=$THIS_DIR/bin/dev-versions diff --git a/pkg/cmd/dev/test.go b/pkg/cmd/dev/test.go index 65bb1f3b1702..61578b01688f 100644 --- a/pkg/cmd/dev/test.go +++ b/pkg/cmd/dev/test.go @@ -119,7 +119,7 @@ pkg/kv/kvserver:kvserver_test) instead.`, // visible. testCmd.Flags().BoolP(vFlag, "v", false, "show testing process output") testCmd.Flags().Bool(changedFlag, false, "automatically determine tests to run. This is done on a best-effort basis by asking git which files have changed. Only .go files and files in testdata/ directories are factored into this analysis.") - testCmd.Flags().Int(countFlag, 1, "run test the given number of times") + testCmd.Flags().Int(countFlag, 0, "run test the given number of times") testCmd.Flags().BoolP(showLogsFlag, "", false, "show crdb logs in-line") testCmd.Flags().Bool(stressFlag, false, "run tests under stress") testCmd.Flags().Bool(raceFlag, false, "run tests using race builds") @@ -281,9 +281,6 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error { } args = append(args, testTargets...) - if ignoreCache { - args = append(args, "--nocache_test_results") - } args = append(args, "--test_env=GOTRACEBACK=all") if rewrite { @@ -336,7 +333,7 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error { } if stress { - if count == 1 { + if count == 0 { // Default to 1000 unless a different count was provided. count = 1000 } @@ -362,7 +359,9 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error { if showLogs { args = append(args, "--test_arg", "-show-logs") } - if count != 1 { + if count == 1 { + ignoreCache = true + } else if count != 0 { args = append(args, fmt.Sprintf("--runs_per_test=%d", count)) } if vModule != "" { @@ -379,6 +378,10 @@ func (d *dev) test(cmd *cobra.Command, commandLine []string) error { args = append(args, "--test_sharding_strategy=disabled") } + if ignoreCache { + args = append(args, "--nocache_test_results") + } + if len(goTags) > 0 { args = append(args, "--define", "gotags=bazel,gss,"+strings.Join(goTags, ",")) } diff --git a/pkg/cmd/dev/testdata/datadriven/test b/pkg/cmd/dev/testdata/datadriven/test index d711eb05c3ce..230fd20a018c 100644 --- a/pkg/cmd/dev/testdata/datadriven/test +++ b/pkg/cmd/dev/testdata/datadriven/test @@ -21,7 +21,7 @@ bazel test pkg/util/tracing:all --test_env=GOTRACEBACK=all '--test_filter=TestSt exec dev test pkg/util/tracing -f TestStartChild* --ignore-cache ---- -bazel test pkg/util/tracing:all --nocache_test_results --test_env=GOTRACEBACK=all '--test_filter=TestStartChild*' --test_sharding_strategy=disabled --test_output errors --build_event_binary_file=/tmp/path +bazel test pkg/util/tracing:all --test_env=GOTRACEBACK=all '--test_filter=TestStartChild*' --test_sharding_strategy=disabled --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path exec dev test //pkg/testutils --timeout=10s @@ -62,7 +62,7 @@ exec dev test pkg/cmd/dev -f TestDataDriven/test --rewrite -v ---- bazel info workspace --color=no -bazel test pkg/cmd/dev:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/cmd/dev --test_filter=TestDataDriven/test --test_arg -test.v --test_sharding_strategy=disabled --test_output all --build_event_binary_file=/tmp/path +bazel test pkg/cmd/dev:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/cmd/dev --test_filter=TestDataDriven/test --test_arg -test.v --test_sharding_strategy=disabled --nocache_test_results --test_output all --build_event_binary_file=/tmp/path exec dev test pkg/server -f=TestSpanStatsResponse -v --count=5 --vmodule=raft=1 @@ -84,7 +84,7 @@ exec dev test pkg/ccl/logictestccl -f=TestTenantLogic/3node-tenant/system -v --rewrite ---- bazel info workspace --color=no -bazel test pkg/ccl/logictestccl:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/ccl/logictestccl --sandbox_writable_path=crdb-checkout/pkg/sql/logictest --sandbox_writable_path=crdb-checkout/pkg/sql/opt/exec/execbuilder --test_filter=TestTenantLogic/3node-tenant/system --test_arg -test.v --test_sharding_strategy=disabled --test_output all --build_event_binary_file=/tmp/path +bazel test pkg/ccl/logictestccl:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/ccl/logictestccl --sandbox_writable_path=crdb-checkout/pkg/sql/logictest --sandbox_writable_path=crdb-checkout/pkg/sql/opt/exec/execbuilder --test_filter=TestTenantLogic/3node-tenant/system --test_arg -test.v --test_sharding_strategy=disabled --nocache_test_results --test_output all --build_event_binary_file=/tmp/path exec dev test pkg/spanconfig/spanconfigkvsubscriber -f=TestDecodeSpanTargets -v --stream-output @@ -115,19 +115,19 @@ exec dev test pkg/sql/schemachanger --rewrite -v ---- bazel info workspace --color=no -bazel test pkg/sql/schemachanger:all --nocache_test_results --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/schemachanger --test_arg -test.v --test_sharding_strategy=disabled --test_output all --build_event_binary_file=/tmp/path +bazel test pkg/sql/schemachanger:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql/schemachanger --test_arg -test.v --test_sharding_strategy=disabled --nocache_test_results --test_output all --build_event_binary_file=/tmp/path exec 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 --build_event_binary_file=/tmp/path +bazel test pkg/sql/opt/xform:all --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 --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path 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 --build_event_binary_file=/tmp/path +bazel test pkg/sql/... --test_env=GOTRACEBACK=all --test_env=COCKROACH_WORKSPACE=crdb-checkout --test_arg -rewrite --sandbox_writable_path=crdb-checkout/pkg/sql --test_sharding_strategy=disabled --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path exec dev test pkg/spanconfig/spanconfigstore --test-args '-test.timeout=0.5s' @@ -162,3 +162,8 @@ dev test pkg/spanconfig/spanconfigstore --stress --count 250 ---- getenv DEV_I_UNDERSTAND_ABOUT_STRESS bazel test pkg/spanconfig/spanconfigstore:all --test_env=GOTRACEBACK=all --test_env=COCKROACH_STRESS=true --notest_keep_going --runs_per_test=250 --test_output errors --build_event_binary_file=/tmp/path + +exec +dev test pkg/spanconfig/spanconfigstore --count 1 +---- +bazel test pkg/spanconfig/spanconfigstore:all --test_env=GOTRACEBACK=all --nocache_test_results --test_output errors --build_event_binary_file=/tmp/path