External script: run all gtest C++ tests from a given build target

266 views
Skip to first unread message

Carlos Knippschild

unread,
Oct 12, 2017, 4:52:02 PM10/12/17
to Chromium-dev
Sharing this hoping it might be useful to others: I created a script that assists one in running all Google Test tests from a given test build target (the closed I could get to running all tests from a chromium folder). It can be found here:


For further details, this is it's current documentation:

# Have you ever been annoyed by having to manually harvest test class names so
# that you can run a comprehensive set of tests from a Chromium subcomponent?
# Yes, well, me too! And here's the solution for it.
#
# This script generates a Google Test formatted filter string using all C++ test
# classes it can find given an output dir and one or more GN targets. For
# instance this call:
#
# tests-from-target.py out_linux/Debug components/offline_pages/core/background:unit_tests
#
# Generates this output as of today:
#
# AddRequestTaskTest.*:ChangeRequestsStateTaskTest.*:CleanupTaskTest.*:
# GetRequestsTaskTest.*:InitializeStoreTaskTest.*:MarkAttemptAbortedTaskTest.*:
# MarkAttemptCompletedTaskTest.*:MarkAttemptStartedTaskTest.*:
# PickRequestTaskTest.*:ReconcileTaskTest.*:RemoveRequestsTaskTest.*:
# RequestCoordinatorEventLoggerTest.*:RequestCoordinatorTest.*:
# RequestQueueStoreSQLTest.*:RequestQueueTest.*:SavePageRequestTest.*
#
# The most common usage case will be to use your shell's command substitution so
# that the script populates the filter argument of your test execution call.
# For Bash it would be something like this (if you are cool and use cr! ;):
#
# cr run components_unittests --gtest_filter=$(tests-from-target.py <OUT_DIR> <GN_TEST_TARGET>)

Reply all
Reply to author
Forward
0 new messages