Update vtsc driver codegen to notify hidl async-cb events
Test: run vehicle host-side test
Change-Id: I1061da14810edb3e46f0782fe75f1bf8009d3b63
diff --git a/compilation_tools/vtsc/code_gen/driver/DriverCodeGenBase.cpp b/compilation_tools/vtsc/code_gen/driver/DriverCodeGenBase.cpp
index 04496e3..d5547d0 100644
--- a/compilation_tools/vtsc/code_gen/driver/DriverCodeGenBase.cpp
+++ b/compilation_tools/vtsc/code_gen/driver/DriverCodeGenBase.cpp
@@ -179,6 +179,11 @@
out << "#include <fuzz_tester/FuzzerBase.h>" << "\n";
out << "#include <fuzz_tester/FuzzerCallbackBase.h>" << "\n";
out << "\n";
+ if (message.component_class() == HAL_HIDL &&
+ endsWith(message.component_name(), "Callback")) {
+ out << "#include <VtsDriverCommUtil.h>" << "\n";
+ out << "\n";
+ }
}
void DriverCodeGenBase::GenerateSourceIncludeFiles(Formatter& out,
diff --git a/compilation_tools/vtsc/code_gen/driver/HalCodeGen.cpp b/compilation_tools/vtsc/code_gen/driver/HalCodeGen.cpp
index 4a24181..e215cf3 100644
--- a/compilation_tools/vtsc/code_gen/driver/HalCodeGen.cpp
+++ b/compilation_tools/vtsc/code_gen/driver/HalCodeGen.cpp
@@ -549,7 +549,6 @@
out.indent();
out << "cerr << \"both device_ and hmi_ are NULL.\" << endl;"
<< "\n";
- out.indent();
out << "return false;" << "\n";
out.unindent();
out << "}" << "\n";
diff --git a/compilation_tools/vtsc/code_gen/driver/HalHidlCodeGen.cpp b/compilation_tools/vtsc/code_gen/driver/HalHidlCodeGen.cpp
index 6f45fe3..cb616e9 100644
--- a/compilation_tools/vtsc/code_gen/driver/HalHidlCodeGen.cpp
+++ b/compilation_tools/vtsc/code_gen/driver/HalHidlCodeGen.cpp
@@ -51,8 +51,9 @@
out << "::android::hardware::Return<void> ";
}
// Generate function call.
- out << "Vts_" << component_fq_name.tokenName() << "::" << api.name()
- << "(\n";
+ string full_method_name = "Vts_" + component_fq_name.tokenName() + "::"
+ + api.name();
+ out << full_method_name << "(\n";
out.indent();
for (int index = 0; index < api.arg_size(); index++) {
const auto& arg = api.arg(index);
@@ -84,6 +85,18 @@
out << ")>) {" << "\n";
}
out << "cout << \"" << api.name() << " called\" << endl;" << "\n";
+ out << "AndroidSystemCallbackRequestMessage callback_message;" << "\n";
+ out << "callback_message.set_id(GetCallbackID(\"" << api.name() << "\"));" << "\n";
+ out << "callback_message.set_name(\"" << full_method_name << "\");" << "\n";
+ for (int index = 0; index < api.arg_size(); index++) {
+ out << "VariableSpecificationMessage* var_msg" << index << " = "
+ << "callback_message.add_arg();\n";
+ GenerateSetResultCodeForTypedVariable(out, api.arg(index),
+ "var_msg" + std::to_string(index),
+ "arg" + std::to_string(index));
+ }
+ out << "RpcCallToAgent(callback_message, callback_socket_name_);" << "\n";
+
if (api.return_type_hidl_size() == 0
|| api.return_type_hidl(0).type() == TYPE_VOID) {
out << "return ::android::hardware::Void();" << "\n";
@@ -101,7 +114,8 @@
out << " {" << "\n";
out.indent();
out << "sp<" << component_fq_name.cppName() << "> result;\n";
- out << "result = new " << component_name_token << "();\n";
+ out << "result = new " << component_name_token << "(callback_socket_name);"
+ << "\n";
out << "return result;\n";
out.unindent();
out << "}" << "\n" << "\n";
@@ -368,11 +382,12 @@
out << "\n";
FQName component_fq_name = GetFQName(message);
string component_name_token = "Vts_" + component_fq_name.tokenName();;
- out << "class " << component_name_token << ": public "
- << component_fq_name.cppName() << " {" << "\n";
+ out << "class " << component_name_token << " : public "
+ << component_fq_name.cppName() << ", public FuzzerCallbackBase {" << "\n";
out << " public:" << "\n";
out.indent();
- out << component_name_token << "() {};" << "\n";
+ out << component_name_token << "(const string& callback_socket_name)\n"
+ << " : callback_socket_name_(callback_socket_name) {};" << "\n";
out << "\n";
out << "virtual ~" << component_name_token << "()"
<< " = default;" << "\n";
@@ -419,6 +434,11 @@
}
out.unindent();
}
+ out << "\n";
+ out.unindent();
+ out << " private:" << "\n";
+ out.indent();
+ out << "const string& callback_socket_name_;" << "\n";
out.unindent();
out << "};" << "\n";
out << "\n";
@@ -850,6 +870,8 @@
out << arg_name << " = VtsFuzzerCreateVts" << type_name
<< "(callback_socket_name);\n";
+ out << "static_cast<" << "Vts" + type_name << "*>(" << arg_name
+ << ".get())->Register(" << arg_value_name << ");\n";
break;
}
case TYPE_HANDLE:
diff --git a/compilation_tools/vtsc/test/golden/DRIVER/CameraHalV2.driver.cpp b/compilation_tools/vtsc/test/golden/DRIVER/CameraHalV2.driver.cpp
new file mode 100644
index 0000000..60dbf56
--- /dev/null
+++ b/compilation_tools/vtsc/test/golden/DRIVER/CameraHalV2.driver.cpp
@@ -0,0 +1,302 @@
+#include "test/vts/specification/hal_conventional/CameraHalV2.vts.h"
+#include <hardware/hardware.h>
+#include <hardware/camera_common.h>
+#include <hardware/camera.h>
+#include "vts_datatype.h"
+#include "vts_measurement.h"
+#include <iostream>
+
+
+namespace android {
+namespace vts {
+static string callback_socket_name_;
+
+class vts_callback_FuzzerExtended_camera_module_t_camera_module_callbacks_t : public FuzzerCallbackBase {
+ public:
+ vts_callback_FuzzerExtended_camera_module_t_camera_module_callbacks_t(const string& callback_socket_name) {
+ callback_socket_name_ = callback_socket_name;
+ }
+
+ static void
+ camera_device_status_change(const const struct camera_module_callbacks* arg0, int32_t arg1, int32_t arg2) {
+ AndroidSystemCallbackRequestMessage callback_message;
+ callback_message.set_id(GetCallbackID("camera_device_status_change"));
+ VariableSpecificationMessage* var_msg0 = callback_message.add_arg();
+ var_msg0->set_type(TYPE_PREDEFINED);
+ VariableSpecificationMessage* var_msg1 = callback_message.add_arg();
+ var_msg1->set_type(TYPE_SCALAR);
+ var_msg1->set_scalar_type("int32_t");
+ var_msg1->mutable_scalar_value()->set_int32_t(0);
+ VariableSpecificationMessage* var_msg2 = callback_message.add_arg();
+ var_msg2->set_type(TYPE_SCALAR);
+ var_msg2->set_scalar_type("int32_t");
+ var_msg2->mutable_scalar_value()->set_int32_t(0);
+ RpcCallToAgent(callback_message, callback_socket_name_);
+ }
+
+
+ static void
+ torch_mode_status_change(const struct camera_module_callbacks* arg0, const char* arg1, int32_t arg2) {
+ AndroidSystemCallbackRequestMessage callback_message;
+ callback_message.set_id(GetCallbackID("torch_mode_status_change"));
+ VariableSpecificationMessage* var_msg0 = callback_message.add_arg();
+ var_msg0->set_type(TYPE_PREDEFINED);
+ VariableSpecificationMessage* var_msg1 = callback_message.add_arg();
+ var_msg1->set_type(TYPE_SCALAR);
+ var_msg1->set_scalar_type("char_pointer");
+ var_msg1->mutable_scalar_value()->set_char_pointer(0);
+ VariableSpecificationMessage* var_msg2 = callback_message.add_arg();
+ var_msg2->set_type(TYPE_SCALAR);
+ var_msg2->set_scalar_type("int32_t");
+ var_msg2->mutable_scalar_value()->set_int32_t(0);
+ RpcCallToAgent(callback_message, callback_socket_name_);
+ }
+
+
+ private:
+};
+
+bool FuzzerExtended_camera_module_t::Fuzz__common_methods(
+FunctionSpecificationMessage* func_msg,
+void** result, const string& callback_socket_name) {
+ const char* func_name = func_msg->name().c_str();
+ cout << "Function: " << __func__ << " " << func_name << endl;
+ if (!strcmp(func_name, "open")) {
+ camera_module_t* local_device = reinterpret_cast<camera_module_t*>(device_);
+ if (local_device == NULL) {
+ cout << "use hmi" << endl;
+ local_device = reinterpret_cast<camera_module_t*>(hmi_);
+ }
+ if (local_device == NULL) {
+ cerr << "both device_ and hmi_ are NULL." << endl;
+ return false;
+ }
+ hw_module_t* arg0 = hmi_;
+ ;
+ cout << "arg0 = " << arg0 << endl;
+
+ char* arg1 = (func_msg->arg(1).type() == TYPE_SCALAR && func_msg->arg(1).scalar_value().has_pointer())? reinterpret_cast<char*>(func_msg->arg(1).scalar_value().pointer() ) : ((hmi_) ? const_cast<char*>(hmi_->name) : NULL)
+ ;
+ cout << "arg1 = " << arg1 << endl;
+
+ hw_device_t** arg2 = (struct hw_device_t**) &device_
+ ;
+ cout << "arg2 = " << arg2 << endl;
+
+ VtsMeasurement vts_measurement;
+ vts_measurement.Start();
+ cout << "hit2." << device_ << endl;
+ if (reinterpret_cast<camera_module_t*>(local_device)->common.methods->open == NULL) {
+ cerr << "api not set." << endl;
+ return false;
+ }
+ cout << "Call an API." << endl;
+ *result = const_cast<void*>(reinterpret_cast<const void*>(local_device->common.methods->open(
+ arg0,
+ arg1,
+ arg2)));
+ vector<float>* measured = vts_measurement.Stop();
+ cout << "time " << (*measured)[0] << endl;
+ cout << "called" << endl;
+ (arg2, func_msg->mutable_arg(2));
+ return true;
+ }
+ return false;
+}
+bool FuzzerExtended_camera_module_t::Fuzz__common(
+FunctionSpecificationMessage* func_msg,
+void** result, const string& callback_socket_name) {
+ const char* func_name = func_msg->name().c_str();
+ cout << "Function: " << __func__ << " " << func_name << endl;
+ return false;
+}
+bool FuzzerExtended_camera_module_t::Fuzz(
+ FunctionSpecificationMessage* func_msg,
+ void** result, const string& callback_socket_name) {
+ const char* func_name = func_msg->name().c_str();
+ cout << "Function: " << __func__ << " '" << func_name << "'" << endl;
+ if (func_msg->parent_path().length() > 0) {
+ if (func_msg->parent_path() == "common") {
+ return Fuzz__common(func_msg, result, callback_socket_name);
+ }
+ if (func_msg->parent_path() == "common.methods") {
+ return Fuzz__common_methods(func_msg, result, callback_socket_name);
+ }
+ }
+ camera_module_t* local_device = reinterpret_cast<camera_module_t*>(device_);
+ if (local_device == NULL) {
+ cout << "use hmi " << (uint64_t)hmi_ << endl;
+ local_device = reinterpret_cast<camera_module_t*>(hmi_);
+ }
+ if (local_device == NULL) {
+ cerr << "both device_ and hmi_ are NULL." << endl;
+ return false;
+ }
+ if (!strcmp(func_name, "get_number_of_cameras")) {
+ cout << "match" << endl;
+ VtsMeasurement vts_measurement;
+ vts_measurement.Start();
+ cout << "hit2." << device_ << endl;
+ if (reinterpret_cast<camera_module_t*>(local_device)->get_number_of_cameras == NULL) {
+ cerr << "api not set." << endl;
+ return false;
+ }
+ cout << "Call an API." << endl;
+ cout << "local_device = " << local_device;
+ *result = const_cast<void*>(reinterpret_cast<const void*>(local_device->get_number_of_cameras()));
+ vector<float>* measured = vts_measurement.Stop();
+ cout << "time " << (*measured)[0] << endl;
+ cout << "called" << endl;
+ return true;
+ }
+ if (!strcmp(func_name, "get_camera_info")) {
+ cout << "match" << endl;
+ int32_t arg0 = (func_msg->arg(0).type() == TYPE_SCALAR)? (func_msg->arg(0).scalar_value().int32_t() ) : ( (func_msg->arg(0).type() == TYPE_PREDEFINED || func_msg->arg(0).type() == TYPE_STRUCT || func_msg->arg(0).type() == TYPE_SCALAR)? RandomInt32() : RandomInt32() );
+ cout << "arg0 = " << arg0 << endl;
+ camera_info_t* arg1 = ( (func_msg->arg(1).type() == TYPE_PREDEFINED || func_msg->arg(1).type() == TYPE_STRUCT || func_msg->arg(1).type() == TYPE_SCALAR)? GenerateCameraInfoUsingMessage(func_msg->arg(1)) : GenerateCameraInfo() );
+ cout << "arg1 = " << arg1 << endl;
+ VtsMeasurement vts_measurement;
+ vts_measurement.Start();
+ cout << "hit2." << device_ << endl;
+ if (reinterpret_cast<camera_module_t*>(local_device)->get_camera_info == NULL) {
+ cerr << "api not set." << endl;
+ return false;
+ }
+ cout << "Call an API." << endl;
+ cout << "local_device = " << local_device;
+ *result = const_cast<void*>(reinterpret_cast<const void*>(local_device->get_camera_info(
+ arg0,
+ arg1)));
+ vector<float>* measured = vts_measurement.Stop();
+ cout << "time " << (*measured)[0] << endl;
+ cout << "called" << endl;
+ ConvertCameraInfoToProtobuf(arg1, func_msg->mutable_arg(1));
+ return true;
+ }
+ if (!strcmp(func_name, "set_callbacks")) {
+ cout << "match" << endl;
+ vts_callback_FuzzerExtended_camera_module_t_camera_module_callbacks_t* arg0callback = new vts_callback_FuzzerExtended_camera_module_t_camera_module_callbacks_t(callback_socket_name);
+ arg0callback->Register(func_msg->arg(0));
+ camera_module_callbacks_t* arg0 = (camera_module_callbacks_t*) malloc(sizeof(camera_module_callbacks_t*));
+ arg0->camera_device_status_change = arg0callback->camera_device_status_change;
+ arg0->torch_mode_status_change = arg0callback->torch_mode_status_change;
+ cout << "arg0 = " << arg0 << endl;
+ VtsMeasurement vts_measurement;
+ vts_measurement.Start();
+ cout << "hit2." << device_ << endl;
+ if (reinterpret_cast<camera_module_t*>(local_device)->set_callbacks == NULL) {
+ cerr << "api not set." << endl;
+ return false;
+ }
+ cout << "Call an API." << endl;
+ cout << "local_device = " << local_device;
+ *result = const_cast<void*>(reinterpret_cast<const void*>(local_device->set_callbacks(
+ arg0)));
+ vector<float>* measured = vts_measurement.Stop();
+ cout << "time " << (*measured)[0] << endl;
+ cout << "called" << endl;
+ return true;
+ }
+ if (!strcmp(func_name, "init")) {
+ cout << "match" << endl;
+ VtsMeasurement vts_measurement;
+ vts_measurement.Start();
+ cout << "hit2." << device_ << endl;
+ if (reinterpret_cast<camera_module_t*>(local_device)->init == NULL) {
+ cerr << "api not set." << endl;
+ return false;
+ }
+ cout << "Call an API." << endl;
+ cout << "local_device = " << local_device;
+ *result = const_cast<void*>(reinterpret_cast<const void*>(local_device->init()));
+ vector<float>* measured = vts_measurement.Stop();
+ cout << "time " << (*measured)[0] << endl;
+ cout << "called" << endl;
+ return true;
+ }
+ cerr << "func not found" << endl;
+ return false;
+}
+bool FuzzerExtended_camera_module_t::GetAttribute__common_methods(
+ FunctionSpecificationMessage* func_msg,
+ void** result) {
+ const char* func_name = func_msg->name().c_str();
+ cout << "Function: " << __func__ << " " << func_name << endl;
+ camera_module_t* local_device = reinterpret_cast<camera_module_t*>(device_);
+ if (local_device == NULL) {
+ cout << "use hmi " << (uint64_t)hmi_ << endl;
+ local_device = reinterpret_cast<camera_module_t*>(hmi_);
+ }
+ if (local_device == NULL) {
+ cerr << "both device_ and hmi_ are NULL." << endl;
+ return false;
+ }
+ cerr << "attribute not found" << endl;
+ return false;
+}
+bool FuzzerExtended_camera_module_t::GetAttribute__common(
+ FunctionSpecificationMessage* func_msg,
+ void** result) {
+ const char* func_name = func_msg->name().c_str();
+ cout << "Function: " << __func__ << " " << func_name << endl;
+ camera_module_t* local_device = reinterpret_cast<camera_module_t*>(device_);
+ if (local_device == NULL) {
+ cout << "use hmi " << (uint64_t)hmi_ << endl;
+ local_device = reinterpret_cast<camera_module_t*>(hmi_);
+ }
+ if (local_device == NULL) {
+ cerr << "both device_ and hmi_ are NULL." << endl;
+ return false;
+ }
+ if (!strcmp(func_name, "module_api_version")) {
+ cout << "match" << endl;
+ cout << "hit2." << device_ << endl;
+ cout << "ok. let's read attribute." << endl;
+ *result = const_cast<void*>(reinterpret_cast<const void*>(local_device->common.module_api_version));
+ cout << "got" << endl;
+ return true;
+ }
+ cerr << "attribute not found" << endl;
+ return false;
+}
+bool FuzzerExtended_camera_module_t::GetAttribute(
+ FunctionSpecificationMessage* func_msg,
+ void** result) {
+ const char* func_name = func_msg->name().c_str();
+ cout << "Function: " << __func__ << " '" << func_name << "'" << endl;
+ if (func_msg->parent_path().length() > 0) {
+ if (func_msg->parent_path() == "common") {
+ return GetAttribute__common(func_msg, result);
+ }
+ if (func_msg->parent_path() == "common.methods") {
+ return GetAttribute__common_methods(func_msg, result);
+ }
+ }
+ camera_module_t* local_device = reinterpret_cast<camera_module_t*>(device_);
+ if (local_device == NULL) {
+ cout << "use hmi " << (uint64_t)hmi_ << endl;
+ local_device = reinterpret_cast<camera_module_t*>(hmi_);
+ }
+ if (local_device == NULL) {
+ cerr << "both device_ and hmi_ are NULL." << endl;
+ return false;
+ }
+ cerr << "attribute not found" << endl;
+ return false;
+}
+bool FuzzerExtended_camera_module_t::CallFunction(const FunctionSpecificationMessage&, const string&, FunctionSpecificationMessage* ) {
+ /* No implementation yet. */
+ return true;
+}
+bool FuzzerExtended_camera_module_t::VerifyResults(const FunctionSpecificationMessage&, const FunctionSpecificationMessage&) {
+ /* No implementation yet. */
+ return true;
+}
+extern "C" {
+android::vts::FuzzerBase* vts_func_1_2_2_() {
+ return (android::vts::FuzzerBase*) new android::vts::FuzzerExtended_camera_module_t();
+}
+
+}
+} // namespace vts
+} // namespace android
diff --git a/compilation_tools/vtsc/test/golden/DRIVER/Nfc.driver.cpp b/compilation_tools/vtsc/test/golden/DRIVER/Nfc.driver.cpp
index e60071d..ac5bc1a 100644
--- a/compilation_tools/vtsc/test/golden/DRIVER/Nfc.driver.cpp
+++ b/compilation_tools/vtsc/test/golden/DRIVER/Nfc.driver.cpp
@@ -42,6 +42,7 @@
if (!strcmp(func_name, "open")) {
sp<::android::hardware::nfc::V1_0::INfcClientCallback> arg0;
arg0 = VtsFuzzerCreateVts_android_hardware_nfc_V1_0_INfcClientCallback(callback_socket_name);
+ static_cast<Vts_android_hardware_nfc_V1_0_INfcClientCallback*>(arg0.get())->Register(func_msg.arg(0));
VtsMeasurement vts_measurement;
vts_measurement.Start();
cout << "Call an API" << endl;
diff --git a/compilation_tools/vtsc/test/golden/DRIVER/NfcClientCallback.driver.cpp b/compilation_tools/vtsc/test/golden/DRIVER/NfcClientCallback.driver.cpp
index 7f5575c..505ae23 100644
--- a/compilation_tools/vtsc/test/golden/DRIVER/NfcClientCallback.driver.cpp
+++ b/compilation_tools/vtsc/test/golden/DRIVER/NfcClientCallback.driver.cpp
@@ -15,18 +15,41 @@
::android::hardware::nfc::V1_0::NfcEvent arg0,
::android::hardware::nfc::V1_0::NfcStatus arg1) {
cout << "sendEvent called" << endl;
+ AndroidSystemCallbackRequestMessage callback_message;
+ callback_message.set_id(GetCallbackID("sendEvent"));
+ callback_message.set_name("Vts_android_hardware_nfc_V1_0_INfcClientCallback::sendEvent");
+ VariableSpecificationMessage* var_msg0 = callback_message.add_arg();
+ var_msg0->set_type(TYPE_ENUM);
+ SetResult__android__hardware__nfc__V1_0__NfcEvent(var_msg0, arg0);
+ VariableSpecificationMessage* var_msg1 = callback_message.add_arg();
+ var_msg1->set_type(TYPE_ENUM);
+ SetResult__android__hardware__nfc__V1_0__NfcStatus(var_msg1, arg1);
+ RpcCallToAgent(callback_message, callback_socket_name_);
return ::android::hardware::Void();
}
::android::hardware::Return<void> Vts_android_hardware_nfc_V1_0_INfcClientCallback::sendData(
const ::android::hardware::hidl_vec<uint8_t>& arg0) {
cout << "sendData called" << endl;
+ AndroidSystemCallbackRequestMessage callback_message;
+ callback_message.set_id(GetCallbackID("sendData"));
+ callback_message.set_name("Vts_android_hardware_nfc_V1_0_INfcClientCallback::sendData");
+ VariableSpecificationMessage* var_msg0 = callback_message.add_arg();
+ var_msg0->set_type(TYPE_VECTOR);
+ var_msg0->set_vector_size(arg0.size());
+ for (int i = 0; i < (int)arg0.size(); i++) {
+ auto *var_msg0_vector_i = var_msg0->add_vector_value();
+ var_msg0_vector_i->set_type(TYPE_SCALAR);
+ var_msg0_vector_i->set_scalar_type("uint8_t");
+ var_msg0_vector_i->mutable_scalar_value()->set_uint8_t(arg0[i]);
+ }
+ RpcCallToAgent(callback_message, callback_socket_name_);
return ::android::hardware::Void();
}
sp<::android::hardware::nfc::V1_0::INfcClientCallback> VtsFuzzerCreateVts_android_hardware_nfc_V1_0_INfcClientCallback(const string& callback_socket_name) {
sp<::android::hardware::nfc::V1_0::INfcClientCallback> result;
- result = new Vts_android_hardware_nfc_V1_0_INfcClientCallback();
+ result = new Vts_android_hardware_nfc_V1_0_INfcClientCallback(callback_socket_name);
return result;
}
diff --git a/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal/NfcClientCallback.vts.h b/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal/NfcClientCallback.vts.h
index a231365..dc04b95 100644
--- a/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal/NfcClientCallback.vts.h
+++ b/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal/NfcClientCallback.vts.h
@@ -13,6 +13,8 @@
#include <fuzz_tester/FuzzerBase.h>
#include <fuzz_tester/FuzzerCallbackBase.h>
+#include <VtsDriverCommUtil.h>
+
#include <android/hardware/nfc/1.0/INfcClientCallback.h>
#include <hidl/HidlSupport.h>
#include <android/hardware/nfc/1.0/types.h>
@@ -24,9 +26,10 @@
namespace android {
namespace vts {
-class Vts_android_hardware_nfc_V1_0_INfcClientCallback: public ::android::hardware::nfc::V1_0::INfcClientCallback {
+class Vts_android_hardware_nfc_V1_0_INfcClientCallback : public ::android::hardware::nfc::V1_0::INfcClientCallback, public FuzzerCallbackBase {
public:
- Vts_android_hardware_nfc_V1_0_INfcClientCallback() {};
+ Vts_android_hardware_nfc_V1_0_INfcClientCallback(const string& callback_socket_name)
+ : callback_socket_name_(callback_socket_name) {};
virtual ~Vts_android_hardware_nfc_V1_0_INfcClientCallback() = default;
@@ -37,6 +40,9 @@
::android::hardware::Return<void> sendData(
const ::android::hardware::hidl_vec<uint8_t>& arg0) override;
+
+ private:
+ const string& callback_socket_name_;
};
sp<::android::hardware::nfc::V1_0::INfcClientCallback> VtsFuzzerCreateVts_android_hardware_nfc_V1_0_INfcClientCallback(const string& callback_socket_name);
diff --git a/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal_conventional/CameraHalV2.vts.h b/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal_conventional/CameraHalV2.vts.h
new file mode 100644
index 0000000..285c69e
--- /dev/null
+++ b/compilation_tools/vtsc/test/golden/DRIVER/test/vts/specification/hal_conventional/CameraHalV2.vts.h
@@ -0,0 +1,46 @@
+#ifndef __VTS_DRIVER__CameraHalV2.driver__
+#define __VTS_DRIVER__CameraHalV2.driver__
+
+#undef LOG_TAG
+#define LOG_TAG "FuzzerExtended_camera_module_t"
+#include <hardware/hardware.h>
+#include <hardware/camera_common.h>
+#include <hardware/camera.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utils/Log.h>
+
+#include <fuzz_tester/FuzzerBase.h>
+#include <fuzz_tester/FuzzerCallbackBase.h>
+
+namespace android {
+namespace vts {
+class FuzzerExtended_camera_module_t : public FuzzerBase {
+ public:
+ FuzzerExtended_camera_module_t() : FuzzerBase(HAL_CONVENTIONAL) {}
+ protected:
+ bool Fuzz(FunctionSpecificationMessage* func_msg, void** result, const string& callback_socket_name);
+ bool CallFunction(const FunctionSpecificationMessage& func_msg, const string& callback_socket_name, FunctionSpecificationMessage* result_msg);
+ bool VerifyResults(const FunctionSpecificationMessage& expected_result, const FunctionSpecificationMessage& actual_result);
+ bool GetAttribute(FunctionSpecificationMessage* func_msg, void** result);
+ bool Fuzz__common(FunctionSpecificationMessage* func_msg,
+ void** result, const string& callback_socket_name);
+ bool GetAttribute__common(FunctionSpecificationMessage* func_msg,
+ void** result);
+ bool Fuzz__common_methods(FunctionSpecificationMessage* func_msg,
+ void** result, const string& callback_socket_name);
+ bool GetAttribute__common_methods(FunctionSpecificationMessage* func_msg,
+ void** result);
+ private:
+};
+
+
+extern "C" {
+extern android::vts::FuzzerBase* vts_func_1_2_2_();
+}
+} // namespace vts
+} // namespace android
+#endif
diff --git a/compilation_tools/vtsc/test/test_vtsc.py b/compilation_tools/vtsc/test/test_vtsc.py
index 8cb041c..7ed19ab 100755
--- a/compilation_tools/vtsc/test/test_vtsc.py
+++ b/compilation_tools/vtsc/test/test_vtsc.py
@@ -80,20 +80,19 @@
def TestDriver(self):
"""Run tests for DRIVER mode. """
logging.info("Running TestDriver test case.")
- #Tests for Hidl Hals.
+ # Tests for Hidl Hals.
self.GenerateVtsFile("android.hardware.nfc@1.0")
for component_name in ["Nfc", "types", "NfcClientCallback"]:
self.RunTest("DRIVER",
os.path.join(self._temp_dir, component_name + ".vts"),
"%s.driver.cpp" % component_name)
- #Tests for conventional Hals.
- for component_name in [
- "BluetoothHalV1", "BluetoothHalV1bt_interface_t", "WifiHalV1"
- ]:
+ # Tests for conventional Hals.
+ for component_name in ["CameraHalV2", "BluetoothHalV1",
+ "BluetoothHalV1bt_interface_t", "WifiHalV1"]:
self.RunTest("DRIVER",
"test/vts/specification/hal_conventional/%s.vts" %
component_name, "%s.driver.cpp" % component_name)
- #Tests for shared libraries.
+ # Tests for shared libraries.
for component_name in ["libcV1"]:
self.RunTest("DRIVER", "test/vts/specification/lib_bionic/%s.vts" %
component_name, "%s.driver.cpp" % component_name)