Skip to content

Commit 000b2a1

Browse files
danbevaddaleax
authored andcommitted
test: add support for --gtest_filter
It might be useful to sometimes run a single cctest while debugging/ developing. This commit adds support for Google Test's --gtest_filter to enable this. To list the tests available: $ make list-gtests UtilTest. ListHead StringEqualNoCase StringEqualNoCaseN ToLower Malloc Calloc UncheckedMalloc UncheckedCalloc InspectorSocketTest. ReadsAndWritesInspectorMessage BufferEdgeCases AcceptsRequestInSeveralWrites ExtraTextBeforeRequest ExtraLettersBeforeRequest RequestWithoutKey KillsConnectionOnProtocolViolation CanStopReadingFromInspector CloseDoesNotNotifyReadCallback CloseWorksWithoutReadEnabled ReportsHttpGet HandshakeCanBeCanceled GetThenHandshake WriteBeforeHandshake CleanupSocketAfterEOF EOFBeforeHandshake Send1Mb ErrorCleansUpTheSocket InspectorSocketServerTest. InspectorSessions ServerDoesNothing ServerWithoutTargets ServerCannotStart StoppingServerDoesNotKillConnections Then run a single test: $ env GTEST_FILTER=InspectorSocketTest.GetThenHandshake make cctest Note: Google Test filter = InspectorSocketTest.GetThenHandshake [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from InspectorSocketTest [ RUN ] InspectorSocketTest.GetThenHandshake [ OK ] InspectorSocketTest.GetThenHandshake (0 ms) [----------] 1 test from InspectorSocketTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (0 ms total) [ PASSED ] 1 test. PR-URL: #11474 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 64a9256 commit 000b2a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Makefile

+9-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ STAGINGSERVER ?= node-www
1111
LOGLEVEL ?= silent
1212
OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]')
1313
COVTESTS ?= test
14+
GTEST_FILTER ?= "*"
1415

1516
ifdef JOBS
1617
PARALLEL_ARGS = -j $(JOBS)
@@ -178,7 +179,13 @@ coverage-test: coverage-build
178179
| sed 's/<[^>]*>//g'| sed 's/ //g'
179180

180181
cctest: all
181-
@out/$(BUILDTYPE)/$@
182+
@out/$(BUILDTYPE)/$@ --gtest_filter=$(GTEST_FILTER)
183+
184+
list-gtests:
185+
ifeq (,$(wildcard out/$(BUILDTYPE)/cctest))
186+
$(error Please run 'make cctest' first)
187+
endif
188+
@out/$(BUILDTYPE)/cctest --gtest_list_tests
182189

183190
v8:
184191
tools/make-v8.sh
@@ -846,4 +853,4 @@ endif
846853
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
847854
test-v8-benchmarks test-v8-all v8 lint-ci bench-ci jslint-ci doc-only \
848855
$(TARBALL)-headers test-ci test-ci-native test-ci-js build-ci clear-stalled \
849-
coverage-clean coverage-build coverage-test coverage
856+
coverage-clean coverage-build coverage-test coverage list-gtests

0 commit comments

Comments
 (0)