diff --git a/build/teamcity-testlogicrace.sh b/build/teamcity-testlogicrace.sh new file mode 100755 index 000000000000..844b2aafbdbb --- /dev/null +++ b/build/teamcity-testlogicrace.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euxo pipefail + +export BUILDER_HIDE_GOPATH_SRC=1 + +mkdir -p artifacts + +build/builder.sh env \ + make testrace \ + PKG=./pkg/sql/logictest + TESTFLAGS='-v' \ + 2>&1 \ + | tee artifacts/testlogicrace.log \ + | go-test-teamcity diff --git a/build/teamcity-testrace.sh b/build/teamcity-testrace.sh index 4f76ce137e84..77b131b4728a 100755 --- a/build/teamcity-testrace.sh +++ b/build/teamcity-testrace.sh @@ -13,6 +13,7 @@ build/builder.sh env \ github-pull-request-make build/builder.sh env \ + COCKROACH_LOGIC_TESTS_SKIP=true \ make testrace \ TESTFLAGS='-v' \ 2>&1 \ diff --git a/pkg/sql/logictest/logic_test.go b/pkg/sql/logictest/logic_test.go index 1bdcf91c2547..46f9595a08bc 100644 --- a/pkg/sql/logictest/logic_test.go +++ b/pkg/sql/logictest/logic_test.go @@ -53,6 +53,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/testutils/distsqlutils" "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" + "github.com/cockroachdb/cockroach/pkg/util/envutil" "github.com/cockroachdb/cockroach/pkg/util/leaktest" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/syncutil" @@ -1499,6 +1500,10 @@ func (t *logicTest) runFile(path string, config testClusterConfig) { t.outf("file %s done with config: %s", path, config.name) } +var skipLogicTests = envutil.EnvOrDefaultBool("COCKROACH_LOGIC_TESTS_SKIP", false) +var logicTestsConfigExclude = envutil.EnvOrDefaultString("COCKROACH_LOGIC_TESTS_SKIP_CONFIG", "") +var logicTestsConfigFilter = envutil.EnvOrDefaultString("COCKROACH_LOGIC_TESTS_CONFIG", "") + func TestLogic(t *testing.T) { defer leaktest.AfterTest(t)() @@ -1507,6 +1512,10 @@ func TestLogic(t *testing.T) { t.Skip() } + if skipLogicTests { + t.Skip("COCKROACH_LOGIC_TESTS_SKIP") + } + // run the logic tests indicated by the bigtest and logictestdata flags. // A new cluster is set up for each separate file in the test. var globs []string @@ -1596,6 +1605,12 @@ func TestLogic(t *testing.T) { } // Top-level test: one per test configuration. t.Run(cfg.name, func(t *testing.T) { + if logicTestsConfigExclude != "" && cfg.name == logicTestsConfigExclude { + t.Skip("config excluded via env var") + } + if logicTestsConfigFilter != "" && cfg.name != logicTestsConfigFilter { + t.Skip("config does not match env var") + } for _, path := range paths { path := path // Rebind range variable. // Inner test: one per file path.