Skip to content

Building and running tests

vivekmenezes edited this page May 4, 2018 · 10 revisions

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-results-in-testfiles

Running the sql logic test with the bigtest datasets:

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

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
Clone this wiki locally