Skip to content

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.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Merge request reports

Loading