Merge "convert float|double_t to float|double in C/C++"
diff --git a/hals/light/bullhead/Android.mk b/hals/light/bullhead/Android.mk
index 564124b..a679e4a 100644
--- a/hals/light/bullhead/Android.mk
+++ b/hals/light/bullhead/Android.mk
@@ -36,6 +36,4 @@
 
 LOCAL_MULTILIB := both
 
-LOCAL_COMPATIBILITY_SUITE := vts
-
 include $(BUILD_SHARED_LIBRARY)
diff --git a/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java b/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java
index 8962195..a594fb1 100644
--- a/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java
+++ b/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java
@@ -352,9 +352,6 @@
                     case BINARY_TEST_TYPE_GTEST:
                         template = TEMPLATE_GTEST_BINARY_TEST_PATH;
                         break;
-                    case BINARY_TEST_TYPE_LLVMFUZZER:
-                        template = TEMPLATE_LLVMFUZZER_TEST_PATH;
-                        break;
                     case BINARY_TEST_TYPE_HAL_HIDL_GTEST:
                       template = TEMPLATE_HAL_HIDL_GTEST_PATH;
                       break;
@@ -363,6 +360,9 @@
                 }
                 CLog.i("Using default test case template at %s.", template);
                 setTestCasePath(template);
+            } else if (mBinaryTestType.equals(BINARY_TEST_TYPE_LLVMFUZZER)) {
+                // Fuzz test don't need test-case-path.
+                setTestCasePath(TEMPLATE_LLVMFUZZER_TEST_PATH);
             } else {
                 throw new IllegalArgumentException("test-case-path is not set.");
             }
diff --git a/testcases/template/llvmfuzzer_test/llvmfuzzer_test.py b/testcases/template/llvmfuzzer_test/llvmfuzzer_test.py
index a7737e5..cbf59d1 100644
--- a/testcases/template/llvmfuzzer_test/llvmfuzzer_test.py
+++ b/testcases/template/llvmfuzzer_test/llvmfuzzer_test.py
@@ -41,21 +41,15 @@
         """Creates a remote shell instance, and copies data files."""
         required_params = [
             keys.ConfigKeys.IKEY_DATA_FILE_PATH,
-            keys.ConfigKeys.IKEY_BINARY_TEST_SOURCES,
             config.ConfigKeys.FUZZER_CONFIGS
         ]
         self.getUserParams(required_params)
 
-        self._testcases = list_utils.ExpandItemDelimiters(
-            self.binary_test_sources,
-            const.LIST_ITEM_DELIMITER,
-            strip=True,
-            to_str=True)
+        self._testcases = map(lambda x: str(x), self.fuzzer_configs.keys())
 
+        logging.info("Testcases: %s", self._testcases)
         logging.info("%s: %s", keys.ConfigKeys.IKEY_DATA_FILE_PATH,
             self.data_file_path)
-        logging.info("%s: %s", keys.ConfigKeys.IKEY_BINARY_TEST_SOURCES,
-            self._testcases)
         logging.info("%s: %s", config.ConfigKeys.FUZZER_CONFIGS,
             self.fuzzer_configs)
 
@@ -85,14 +79,55 @@
             fuzzer_config: dict, contains configuration for the fuzzer.
 
         Returns:
-            string, of form "-<flag0>=<val0> -<flag1>=<val1> ... "
+            string, command line flags for fuzzer executable.
         """
-        fuzzer_params = config.FUZZER_PARAMS.copy()
-        fuzzer_params.update(fuzzer_config.get("fuzzer_params", {}))
+        def _SerializeVTSFuzzerParams(params):
+            """Creates VTS command line flags for fuzzer executable.
 
-        test_flags = " ".join(
-            ["-%s=%s" % (k, v) for k, v in fuzzer_params.items()])
-        return test_flags
+            Args:
+                params: dict, contains flags and their values.
+
+            Returns:
+                string, of form "--<flag0>=<val0> --<flag1>=<val1> ... "
+            """
+            VTS_SPEC_FILES = "vts_spec_files"
+            VTS_EXEC_SIZE = "vts_exec_size"
+            DELIMITER = ":"
+
+            # vts_spec_files is a string list, will be serialized like this:
+            # [a, b, c] -> "a:b:c"
+            vts_spec_files = params.get(VTS_SPEC_FILES, {})
+            flags = "--%s=\"%s\" " % (
+                VTS_SPEC_FILES,
+                DELIMITER.join(map(
+                    lambda x: os.path.join(config.FUZZER_SPEC_DIR, x),
+                    vts_spec_files)))
+
+            vts_exec_size = params.get(VTS_EXEC_SIZE, {})
+            flags += "--%s=%s" % (VTS_EXEC_SIZE, vts_exec_size)
+            return flags
+
+        def _SerializeLLVMFuzzerParams(params):
+            """Creates LLVM libfuzzer command line flags for fuzzer executable.
+
+            Args:
+                params: dict, contains flags and their values.
+
+            Returns:
+                string, of form "--<flag0>=<val0> --<flag1>=<val1> ... "
+            """
+            return " ".join(["-%s=%s" % (k, v) for k, v in params.items()])
+
+
+        vts_fuzzer_params = fuzzer_config.get("vts_fuzzer_params", {})
+
+        llvmfuzzer_params = config.FUZZER_PARAMS.copy()
+        llvmfuzzer_params.update(fuzzer_config.get("llvmfuzzer_params", {}))
+
+        vts_fuzzer_flags = _SerializeVTSFuzzerParams(vts_fuzzer_params)
+        llvmfuzzer_flags = _SerializeLLVMFuzzerParams(llvmfuzzer_params)
+
+        return vts_fuzzer_flags + " -- " + llvmfuzzer_flags
 
     def CreateCorpus(self, fuzzer, fuzzer_config):
         """Creates a corpus directory on target.
@@ -134,7 +169,7 @@
         self._shell.Execute(chmod_cmd)
 
         cd_cmd = "cd %s" % config.FUZZER_TEST_DIR
-        ld_path = "LD_LIBRARY_PATH=/data/local/tmp/32:/data/local/tmp/64:$LD_LIBRARY_PATH"
+        ld_path = "LD_LIBRARY_PATH=/data/local/tmp/64:/data/local/tmp/32:$LD_LIBRARY_PATH"
         test_cmd = "./%s" % fuzzer
 
         fuzz_cmd = "%s && %s %s %s %s" % (cd_cmd, ld_path, test_cmd, corpus_dir, test_flags)
@@ -192,6 +227,7 @@
             fuzzer: string, name of fuzzer executable.
             result: dict(str, str, int), command results from shell.
         """
+        logging.info("Test result: %s" % result)
         if not self._dut.hasBooted():
             self._dut.waitForBootCompletion()
             asserts.fail("%s left the device in unresponsive state." % fuzzer)
diff --git a/testcases/template/llvmfuzzer_test/llvmfuzzer_test_config.py b/testcases/template/llvmfuzzer_test/llvmfuzzer_test_config.py
index bb6f06b..1b9402b 100644
--- a/testcases/template/llvmfuzzer_test/llvmfuzzer_test_config.py
+++ b/testcases/template/llvmfuzzer_test/llvmfuzzer_test_config.py
@@ -26,8 +26,11 @@
 # Directory on the target where the tests are copied.
 FUZZER_TEST_DIR = "/data/local/tmp/llvmfuzzer_test"
 
+# Directory on the target where VTS specs are copied.
+FUZZER_SPEC_DIR = "/data/local/tmp/spec"
+
 # Directory under data_file_path on the host where fuzzer executables are.
-FUZZER_SRC_DIR = "hal_fuzzer"
+FUZZER_SRC_DIR = "DATA/bin"
 
 # File used to save crash-causing fuzzer input.
 FUZZER_TEST_CRASH_REPORT = FUZZER_TEST_DIR + "/crash_report"
diff --git a/tools/build/tasks/list/vts_spec_file_list.mk b/tools/build/tasks/list/vts_spec_file_list.mk
index 5f94160..2fabfe6 100644
--- a/tools/build/tasks/list/vts_spec_file_list.mk
+++ b/tools/build/tasks/list/vts_spec_file_list.mk
@@ -55,5 +55,7 @@
   hardware/interfaces/tv/cec/1.0/vts/HdmiCec.vts \
   hardware/interfaces/tv/cec/1.0/vts/HdmiCecCallback.vts \
   hardware/interfaces/tv/cec/1.0/vts/types.vts \
+  hardware/interfaces/light/2.0/vts/Light.vts \
+  hardware/interfaces/light/2.0/vts/types.vts \
 
 endif
diff --git a/tools/vts-tradefed/res/config/vts-serving-staging-fuzz.xml b/tools/vts-tradefed/res/config/vts-serving-staging-fuzz.xml
index c778a0f..1fea8f9 100644
--- a/tools/vts-tradefed/res/config/vts-serving-staging-fuzz.xml
+++ b/tools/vts-tradefed/res/config/vts-serving-staging-fuzz.xml
@@ -16,8 +16,6 @@
 <configuration description="Run New VTS Fuzz Tests in the Staging environment">
     <include name="everything" />
     <option name="plan" value="vts" />
-    <option name="compatibility:include-filter" value="ILightFuzzTest" />
-    <option name="compatibility:include-filter" value="ISensorsFuzzTest" />
-    <option name="compatibility:include-filter" value="IPowerFuzzTest" />
+    <option name="compatibility:include-filter" value="LightIfaceFuzzTest" />
     <template-include name="reporters" default="basic-reporters" />
 </configuration>
diff --git a/tools/vts-tradefed/res/config/vts-serving-staging-hal-hidl-profiling.xml b/tools/vts-tradefed/res/config/vts-serving-staging-hal-hidl-profiling.xml
index 4af060d..eee4b3b 100644
--- a/tools/vts-tradefed/res/config/vts-serving-staging-hal-hidl-profiling.xml
+++ b/tools/vts-tradefed/res/config/vts-serving-staging-hal-hidl-profiling.xml
@@ -20,5 +20,8 @@
     <option name="compatibility:include-filter" value="VibratorHidlTargetProfilingTest" />
     <option name="compatibility:include-filter" value="NfcHidlTargetProfilingTest" />
     <option name="compatibility:include-filter" value="ThermalHidlTargetProfilingTest" />
+    <option name="compatibility:include-filter" value="LightHidlTargetProfilingTest" />
+    <option name="compatibility:include-filter" value="HalPowerHidlTargetProfilingTest" />
+    <option name="compatibility:include-filter" value="SensorsHidlProfilingTest" />
     <template-include name="reporters" default="basic-reporters" />
 </configuration>
diff --git a/tools/vts-tradefed/res/push_groups/IfaceFuzzerTest.push b/tools/vts-tradefed/res/push_groups/IfaceFuzzerTest.push
new file mode 100644
index 0000000..54475fa
--- /dev/null
+++ b/tools/vts-tradefed/res/push_groups/IfaceFuzzerTest.push
@@ -0,0 +1,11 @@
+HidlHalTest.push
+VtsSpec.push
+
+DATA/lib/libclang_rt.asan-arm-android.so->/data/local/tmp/32/libclang_rt.asan-arm-android.so
+DATA/lib64/libclang_rt.asan-aarch64-android.so->/data/local/tmp/64/libclang_rt.asan-aarch64-android.so
+
+DATA/lib/libvts_proto_fuzzer.so->/data/local/tmp/32/libvts_proto_fuzzer.so
+DATA/lib64/libvts_proto_fuzzer.so->/data/local/tmp/64/libvts_proto_fuzzer.so
+
+DATA/lib/libvts_proto_fuzzer_proto.so->/data/local/tmp/32/libvts_proto_fuzzer_proto.so
+DATA/lib64/libvts_proto_fuzzer_proto.so->/data/local/tmp/64/libvts_proto_fuzzer_proto.so
diff --git a/tools/vts-tradefed/res/push_groups/VtsSpec.push b/tools/vts-tradefed/res/push_groups/VtsSpec.push
new file mode 100644
index 0000000..61d693a
--- /dev/null
+++ b/tools/vts-tradefed/res/push_groups/VtsSpec.push
@@ -0,0 +1,27 @@
+spec/hardware/interfaces/thermal/1.0/vts/Thermal.vts->/data/local/tmp/spec/thermal/Thermal.vts
+spec/hardware/interfaces/thermal/1.0/vts/types.vts->/data/local/tmp/spec/thermal/types.vts
+spec/hardware/interfaces/vibrator/1.0/vts/Vibrator.vts->/data/local/tmp/spec/vibrator/Vibrator.vts
+spec/hardware/interfaces/vibrator/1.0/vts/types.vts->/data/local/tmp/spec/vibrator/types.vts
+spec/hardware/interfaces/sensors/1.0/vts/Sensors.vts->/data/local/tmp/spec/sensors/Sensors.vts
+spec/hardware/interfaces/sensors/1.0/vts/types.vts->/data/local/tmp/spec/sensors/types.vts
+spec/hardware/interfaces/graphics/mapper/2.0/vts/Mapper.vts->/data/local/tmp/spec/graphics/mapper/Mapper.vts
+spec/hardware/interfaces/graphics/mapper/2.0/vts/types.vts->/data/local/tmp/spec/graphics/mapper/types.vts
+spec/hardware/interfaces/graphics/allocator/2.0/vts/Allocator.vts->/data/local/tmp/spec/graphics/allocator/Allocator.vts
+spec/hardware/interfaces/graphics/allocator/2.0/vts/AllocatorClient.vts->/data/local/tmp/spec/graphics/allocator/AllocatorClient.vts
+spec/hardware/interfaces/graphics/allocator/2.0/vts/types.vts->/data/local/tmp/spec/graphics/allocator/types.vts
+spec/hardware/interfaces/tv/input/1.0/vts/TvInputCallback.vts->/data/local/tmp/spec/tv/input/TvInputCallback.vts
+spec/hardware/interfaces/tv/input/1.0/vts/TvInput.vts->/data/local/tmp/spec/tv/input/TvInput.vts
+spec/hardware/interfaces/tv/input/1.0/vts/types.vts->/data/local/tmp/spec/tv/input/types.vts
+spec/hardware/interfaces/tv/cec/1.0/vts/HdmiCec.vts->/data/local/tmp/spec/tv/cec/HdmiCec.vts
+spec/hardware/interfaces/tv/cec/1.0/vts/HdmiCecCallback.vts->/data/local/tmp/spec/tv/cec/HdmiCecCallback.vts
+spec/hardware/interfaces/tv/cec/1.0/vts/types.vts->/data/local/tmp/spec/tv/cec/types.vts
+spec/hardware/interfaces/vehicle/2.0/vts/Vehicle.vts->/data/local/tmp/spec/vehicle/Vehicle.vts
+spec/hardware/interfaces/vehicle/2.0/vts/VehicleCallback.vts->/data/local/tmp/spec/vehicle/VehicleCallback.vts
+spec/hardware/interfaces/vehicle/2.0/vts/types.vts->/data/local/tmp/spec/vehicle/types.vts
+spec/hardware/interfaces/vr/1.0/vts/Vr.vts->/data/local/tmp/spec/vr/Vr.vts
+spec/hardware/interfaces/nfc/1.0/vts/NfcClientCallback.vts->/data/local/tmp/spec/nfc/NfcClientCallback.vts
+spec/hardware/interfaces/nfc/1.0/vts/Nfc.vts->/data/local/tmp/spec/nfc/Nfc.vts
+spec/hardware/interfaces/nfc/1.0/vts/types.vts->/data/local/tmp/spec/nfc/types.vts
+spec/hardware/interfaces/light/2.0/vts/Light.vts->/data/local/tmp/spec/light/Light.vts
+spec/hardware/interfaces/light/2.0/vts/types.vts->/data/local/tmp/spec/light/types.vts
+
diff --git a/utils/python/mirror/py2pb.py b/utils/python/mirror/py2pb.py
index ee25c87..f0571ca 100644
--- a/utils/python/mirror/py2pb.py
+++ b/utils/python/mirror/py2pb.py
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+import logging
+
 from vts.proto import ComponentSpecificationMessage_pb2 as CompSpecMsg
 
 
@@ -58,6 +60,26 @@
     setattr(message.scalar_value, pb_spec.scalar_type, py_value)
 
 
+def PyStringPbString(message, pb_spec, py_value):
+    """Converts Python string to VTS VariableSecificationMessage (String).
+
+    Args:
+        message: VariableSpecificationMessage is the current and result
+                 value message.
+        pb_spec: VariableSpecificationMessage which captures the
+                 specification of a target attribute.
+        py_value: Python value provided by a test case.
+
+    Returns:
+        Converted VariableSpecificationMessage if found, None otherwise
+    """
+    if pb_spec.name:
+        message.name = pb_spec.name
+    message.type = CompSpecMsg.TYPE_STRING
+    message.string_value.message = py_value
+    message.string_value.length = len(py_value)
+
+
 def PyList2PbVector(message, pb_spec, py_value):
     """Converts Python list value to VTS VariableSecificationMessage (Vector).
 
@@ -84,6 +106,23 @@
             exit(0)
 
 
+def FindSubStructType(pb_spec, sub_struct_name):
+    """Finds a specific sub_struct type.
+
+    Args:
+        pb_spec: VariableSpecificationMessage which captures the
+                 specification of a target attribute.
+        sub_struct_name: string, the name of a sub struct to look up.
+
+    Returns:
+        VariableSpecificationMessage if found or None otherwise.
+    """
+    for sub_struct in pb_spec.sub_struct:
+        if sub_struct.name == sub_struct_name:
+            return sub_struct
+    return None
+
+
 def PyDict2PbStruct(message, pb_spec, py_value):
     """Converts Python dict to VTS VariableSecificationMessage (struct).
 
@@ -106,8 +145,17 @@
                 PyValue2PbEnum(attr_msg, attr, curr_value)
             elif attr.type == CompSpecMsg.TYPE_SCALAR:
                 PyValue2PbScalar(attr_msg, attr, curr_value)
+            elif attr.type == CompSpecMsg.TYPE_STRING:
+                PyStringPbString(attr_msg, attr, curr_value)
             elif attr.type == CompSpecMsg.TYPE_VECTOR:
                 PyList2PbVector(attr_msg, attr, curr_value)
+            elif attr.type == CompSpecMsg.TYPE_STRUCT:
+                sub_attr = FindSubStructType(pb_spec, attr.predefined_type)
+                if sub_attr:
+                    PyDict2PbStruct(attr_msg, sub_attr, curr_value)
+                else:
+                    logging.error("PyDict2PbStruct: substruct not found.")
+                    exit(-1)
             else:
                 logging.error("PyDict2PbStruct: unsupported type %s",
                               attr.type)
@@ -139,6 +187,8 @@
         PyValue2PbEnum(message, pb_spec, py_value)
     elif attr.type == CompSpecMsg.TYPE_SCALAR:
         PyValue2PbScalar(message, pb_spec, py_value)
+    elif attr.type == CompSpecMsg.TYPE_STRING:
+        PyStringPbString(attr_msg, attr, curr_value)
     elif attr.type == CompSpecMsg.TYPE_VECTOR:
         PyList2PbVector(message, pb_spec, py_value)
     else:
diff --git a/web/dashboard/appengine/servlet/src/main/java/com/android/vts/servlet/ShowTableServlet.java b/web/dashboard/appengine/servlet/src/main/java/com/android/vts/servlet/ShowTableServlet.java
index 388152c..0cab490 100644
--- a/web/dashboard/appengine/servlet/src/main/java/com/android/vts/servlet/ShowTableServlet.java
+++ b/web/dashboard/appengine/servlet/src/main/java/com/android/vts/servlet/ShowTableServlet.java
@@ -269,7 +269,7 @@
         // number of days of data parsed for the current page. Limit to MAX_BUILD_IDS_PER_PAGE days
         // (i.e. one test per day)
         int days = 1;
-        while (days <= MAX_BUILD_IDS_PER_PAGE) {
+        while (true) {
             // Scan until there is a full page of data or until there is no
             // more older data.
             Scan scan = new Scan();
@@ -329,7 +329,9 @@
                 }
             }
             scanner.close();
-            if (tests.size() < MAX_BUILD_IDS_PER_PAGE && showMostRecent
+            if (days >= MAX_BUILD_IDS_PER_PAGE) {
+                break;
+            } else if (tests.size() < MAX_BUILD_IDS_PER_PAGE && showMostRecent
                 && BigtableHelper.hasOlder(table, startTime)) {
                 // Look further back in time a day
                 endTime = startTime;