Disable FooCallmeTest and WrapTest cases in hidl_test by default

An command line option has been added to enable them as well.
Bug: 35710876
Test: hidl_test
Change-Id: I395be9a8e3c868da1646722d7ff0ca2fb006df58
diff --git a/test/hidl_test_client.cpp b/test/hidl_test_client.cpp
index 94921b9..0dcfc32 100644
--- a/test/hidl_test_client.cpp
+++ b/test/hidl_test_client.cpp
@@ -351,8 +351,9 @@
     sp<IPointer> pointerInterface;
     sp<IPointer> validationPointerInterface;
     TestMode mode;
-
-    HidlEnvironment(TestMode mode) : mode(mode) {};
+    bool enableDelayMeasurementTests;
+    HidlEnvironment(TestMode mode, bool enableDelayMeasurementTests) :
+        mode(mode), enableDelayMeasurementTests(enableDelayMeasurementTests) {};
 
     void getServices() {
         manager = IServiceManager::getService();
@@ -821,6 +822,10 @@
 }
 
 TEST_F(HidlTest, WrapTest) {
+    if (!gHidlEnvironment->enableDelayMeasurementTests) {
+        return;
+    }
+
     using ::android::hardware::tests::foo::V1_0::BnHwSimple;
     using ::android::hardware::tests::foo::V1_0::BsSimple;
     using ::android::hardware::tests::foo::V1_0::BpHwSimple;
@@ -858,9 +863,10 @@
 }
 
 TEST_F(HidlTest, FooCallMeTest) {
-
+    if (!gHidlEnvironment->enableDelayMeasurementTests) {
+        return;
+    }
     sp<IFooCallback> fooCb = new FooCallback();
-
     ALOGI("CLIENT call callMe.");
     // callMe is oneway, should return instantly.
     nsecs_t now;
@@ -1753,7 +1759,7 @@
 }
 #endif
 
-int forkAndRunTests(TestMode mode) {
+int forkAndRunTests(TestMode mode, bool enableDelayMeasurementTests) {
     pid_t child;
     int status;
 
@@ -1764,7 +1770,8 @@
 
     if ((child = fork()) == 0) {
         gHidlEnvironment = static_cast<HidlEnvironment *>(
-                ::testing::AddGlobalTestEnvironment(new HidlEnvironment(mode)));
+                ::testing::AddGlobalTestEnvironment(new HidlEnvironment(
+                        mode, enableDelayMeasurementTests)));
         int testStatus = RUN_ALL_TESTS();
         if(testStatus == 0) {
             exit(0);
@@ -1799,22 +1806,24 @@
 
 static void usage(const char *me) {
     fprintf(stderr,
-            "usage: %s [-b] [-p] [GTEST_OPTIONS]\n",
+            "usage: %s [-b] [-p] [-d] [GTEST_OPTIONS]\n",
             me);
 
     fprintf(stderr, "         -b binderized mode only\n");
     fprintf(stderr, "         -p passthrough mode only\n");
     fprintf(stderr, "            (if -b and -p are both missing or both present, "
                                  "both modes are tested.)\n");
+    fprintf(stderr, "         -d Enable delay measurement tests\n");
 }
 
 int main(int argc, char **argv) {
     const char *me = argv[0];
     bool b = false;
     bool p = false;
+    bool d = false;
     struct option longopts[] = {{0,0,0,0}};
     int res;
-    while ((res = getopt_long(argc, argv, "hbp", longopts, NULL)) >= 0) {
+    while ((res = getopt_long(argc, argv, "hbpd", longopts, NULL)) >= 0) {
         switch (res) {
             case 'h': {
                 usage(me);
@@ -1829,6 +1838,10 @@
                 p = true;
             } break;
 
+            case 'd': {
+                d = true;
+            } break;
+
             case '?':
             default: {
                 // ignore. pass to gTest.
@@ -1842,8 +1855,8 @@
     ::testing::InitGoogleTest(&argc, argv);
     // put test in child process because RUN_ALL_TESTS
     // should not be run twice.
-    int pStatus = p ? forkAndRunTests(PASSTHROUGH) : 0;
-    int bStatus = b ? forkAndRunTests(BINDERIZED)  : 0;
+    int pStatus = p ? forkAndRunTests(PASSTHROUGH, d) : 0;
+    int bStatus = b ? forkAndRunTests(BINDERIZED, d)  : 0;
 
     fprintf(stdout, "\n=========================================================\n\n"
                     "    Summary:\n\n");