Building and running tests

To build and run tests, just run

make

To run just presubmit checks (golint etc):

make check

Running the tests for a package:

make test PKG=./sql

Verbose test output:

make test PKG=./sql TESTFLAGS='-v'

Running tests, showing which tests are run and test failures but not the CockroachDB log details:

make test PKG=./sql TESTFLAGS='-v -logtostderr NONE'

Finding a test that fails:

make test PKG=./sql TESTFLAGS='-v -logtostderr NONE' | grep FAIL

Running a particular test:

make test PKG=./sql TESTS=Logic

Running the SQL logic tests:

make testlogic

Running a subtest of the logic test:

make testlogic FILES="show_trace explain"

Running a subtest of the logic test under stress (STRESSFLAGS is optional):

make stress PKG=./pkg/sql/logictest TESTS=TestLogic/.*/show_trace STRESSFLAGS="-p 16"

Changing the expected output of SQL logic tests:

make testlogic FILES="..." TESTFLAGS=-rewrite

Running telemetry tests:
make test PKG=./pkg/sql/ TESTS=TestTelemetry


Running a specific telemetry test:
make test PKG=./pkg/sql/ TESTS=TestTelemetry/$FILE_NAME

Running the sql logic test with the bigtest datasets:

$ cd sql $ cat Makefile .PHONY: bigtest bigtest: go test -bigtest -timeout 24h -run '^TestLogic$$' $ make

Running the logic test as a SQL tenant (ie. only on logic tests labeled with #LogicTest: 3node-tenant

make test PKG=./pkg/ccl/logictestccl TESTS=TestTenantLogic//<test_name>

Finding commit that introduced a regression:

$ git bisect start
$ git bisect bad
$ git bisect good 59ee12f
Bisecting: 10 revisions left to test after this (roughly 4 steps)
...
$ git bisect run make testlogic FILES=orderby_nosort'
running make testlogic FILES=orderby_nosort
   ...

0d1bfc4b92a26f2d6688340b41f9830f4cfc77dc is the first bad commit

Copyright (C) Cockroach Labs.
Attention: This documentation is provided on an "as is" basis, without warranties or conditions of any kind, either express or implied, including, without limitation, any warranties or conditions of title, non-infringement, merchantability, or fitness for a particular purpose.