return the updated call-by-pointer args from stub to runner
another contained, minor change is:
- define and use a lib for protobuf messages
Change-Id: I91908a9e7600e77b21f011997cdba1a96df9f121
diff --git a/sysfuzzer/vtscompiler/code_gen/HalCodeGen.cpp b/sysfuzzer/vtscompiler/code_gen/HalCodeGen.cpp
index 0e0eeed..233afae 100644
--- a/sysfuzzer/vtscompiler/code_gen/HalCodeGen.cpp
+++ b/sysfuzzer/vtscompiler/code_gen/HalCodeGen.cpp
@@ -21,7 +21,7 @@
#include <sstream>
#include <string>
-#include "test/vts/sysfuzzer/common/proto/InterfaceSpecificationMessage.pb.h"
+#include "test/vts/runners/host/proto/InterfaceSpecificationMessage.pb.h"
#include "VtsCompilerUtils.h"
@@ -39,9 +39,9 @@
const InterfaceSpecificationMessage& message,
const string& fuzzer_extended_class_name) {
cpp_ss << "bool " << fuzzer_extended_class_name << "::Fuzz(" << endl;
- cpp_ss << " FunctionSpecificationMessage& func_msg," << endl;
+ cpp_ss << " FunctionSpecificationMessage* func_msg," << endl;
cpp_ss << " void** result) {" << endl;
- cpp_ss << " const char* func_name = func_msg.name().c_str();" << endl;
+ cpp_ss << " const char* func_name = func_msg->name().c_str();" << endl;
cpp_ss << " cout << \"Function: \" << func_name << endl;" << endl;
for (auto const& api : message.api()) {
@@ -61,11 +61,12 @@
<< kInstanceVariableName << ")";
} else {
std::stringstream msg_ss;
- msg_ss << "func_msg.arg(" << arg_count << ")";
+ msg_ss << "func_msg->arg(" << arg_count << ")";
string msg = msg_ss.str();
if (arg.primitive_type().size() > 0) {
- cpp_ss << "(" << msg << ".primitive_value_size() > 0)? ";
+ cpp_ss << "(" << msg << ".aggregate_type().size() == 0 && "
+ << msg << ".primitive_type().size() == 1)? ";
if (!strcmp(arg.primitive_type(0).c_str(), "pointer")
|| !strcmp(arg.primitive_type(0).c_str(), "char_pointer")
|| !strcmp(arg.primitive_type(0).c_str(), "function_pointer")) {
@@ -97,7 +98,8 @@
cpp_ss << ") : ";
}
- cpp_ss << "( (" << msg << ".aggregate_value_size() > 0)? ";
+ cpp_ss << "( (" << msg << ".aggregate_value_size() > 0 || "
+ << msg << ".primitive_value_size() > 0)? ";
cpp_ss << GetCppInstanceType(arg, msg);
cpp_ss << " : " << GetCppInstanceType(arg) << " )";
// TODO: use the given message and call a lib function which converts
@@ -169,7 +171,7 @@
// TODO check the return value
cpp_ss << " " << GetConversionToProtobufFunctionName(arg)
<< "(arg" << arg_count << ", "
- << "func_msg.mutable_arg(" << arg_count << "));" << endl;
+ << "func_msg->mutable_arg(" << arg_count << "));" << endl;
}
arg_count++;
}