PSA: Parameterized C++ tests missing INSTANTIATE_TEST_SUITE_P now cause an error

977 views
Skip to first unread message

James Cook

unread,
Mar 31, 2021, 8:14:05 PM3/31/21
to chromium-dev
If you have a parameterized test suite using testing::WithParamInterface<> and TEST_P, but there is no matching INSTANTIATE_TEST_SUITE_P macro, then the tests don't run. This can happen due to accidental code deletion, or when test suites are split into multiple classes.

We printed warnings when this happened, but we were still skipping a bunch of tests. As of crrev.com/868266 the skipped tests are fixed and the warning is now an error.

So if you see this error, just do what it says. :-)

Found uninstantiated parameterized tests. These test suites will not run:
  MyNewTest
  MyRefactoredTest
Please use INSTANTIATE_TEST_SUITE_P to instantiate the tests, or GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST if the parameter list can be intentionally empty. See //third_party/googletest/src/docs/advanced.md

James

Victor Costan

unread,
Apr 1, 2021, 2:18:06 PM4/1/21
to jame...@chromium.org, chromium-dev
Thank you very much for turning this warning into an error, James!

I'm really happy to see us take advantage of this new googletest check so soon after it got rolled into Chromium!

    Victor

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAKLzqjHt9qb1UOb9yrrHJed8Gj4FMqVpBs%2BRQn23FHRYagkQDg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages