SF: Optionally skip slow unittests
TimeStatsTest::canDumpWithInvalidMaxLayers can take many seconds to run
(even a full minute, depending on the target).
Add a new flag "--no-slow" for libsurfaceflinger_unittests which will
cause it to skip slow tests like these, and add a check to that test
which checks for that flag to skip it.
To run use it with atest, you need to use:
atest libsurfaceflinger_unittest -- --module-arg libsurfaceflinger_unittest:native-test-flag:--no-slow
Bug: None
Test: atest libsurfaceflinger_unittest
Change-Id: I433c1707eb52866fb9f5c61956db338cc5c58723
diff --git a/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp b/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp
index bfd34cd..86f1a39 100644
--- a/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp
@@ -27,6 +27,8 @@
#include "TimeStats/TimeStats.h"
+#include "libsurfaceflinger_unittest_main.h"
+
using namespace android::surfaceflinger;
using namespace google::protobuf;
@@ -486,6 +488,10 @@
}
TEST_F(TimeStatsTest, canSurviveMonkey) {
+ if (g_noSlowTests) {
+ GTEST_SKIP();
+ }
+
EXPECT_TRUE(inputCommand(InputCommand::ENABLE, FMT_STRING).empty());
for (size_t i = 0; i < 10000000; ++i) {