aboutsummaryrefslogtreecommitdiffstats
path: root/sysfuzzer
diff options
context:
space:
mode:
authorKeun Soo Yim <yim@google.com>2016-10-21 15:18:14 -0700
committerKeun Soo Yim <yim@google.com>2016-10-22 00:54:03 +0000
commit6295065e892b14f047960fbfe22588937f383ebc (patch)
tree97b5a4fec9b72fe16fc1fc1ae5f5d6fd3082b00c /sysfuzzer
parentfd70543e3914f69e0048229608b5ff22e9df0e5d (diff)
downloadplatform_test_vts-6295065e892b14f047960fbfe22588937f383ebc.tar.gz
platform_test_vts-6295065e892b14f047960fbfe22588937f383ebc.tar.bz2
platform_test_vts-6295065e892b14f047960fbfe22588937f383ebc.zip
use component_name to specify a target_component
Test: vts-tradefed; run -m NfcHidlBasicTest Change-Id: Iee4be2843bccc5a1f1b03d95611033b56e7a6443
Diffstat (limited to 'sysfuzzer')
-rw-r--r--sysfuzzer/common/include/specification_parser/SpecificationBuilder.h9
-rw-r--r--sysfuzzer/common/specification_parser/SpecificationBuilder.cpp22
-rw-r--r--sysfuzzer/framework/SocketServer.cpp8
-rw-r--r--sysfuzzer/framework/SocketServer.h3
-rw-r--r--sysfuzzer/framework/VtsFuzzerMain.cpp8
5 files changed, 36 insertions, 14 deletions
diff --git a/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h b/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h
index 982dd4363..9d3bc6808 100644
--- a/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h
+++ b/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h
@@ -48,7 +48,8 @@ class SpecificationBuilder {
// component.
vts::ComponentSpecificationMessage* FindComponentSpecification(
const int target_class, const int target_type, const float target_version,
- const string submodule_name = "", const string package = "");
+ const string submodule_name = "", const string package = "",
+ const string component_name = "");
vts::ComponentSpecificationMessage*
FindComponentSpecification(const string& component_name);
@@ -69,12 +70,14 @@ class SpecificationBuilder {
// the target component.
bool Process(const char* dll_file_name, const char* spec_lib_file_path,
int target_class, int target_type, float target_version,
- const char* target_package);
+ const char* target_package, const char* target_component_name);
bool LoadTargetComponent(const char* dll_file_name,
const char* spec_lib_file_path, int target_class,
int target_type, float target_version,
- const char* target_package, const char* module_name);
+ const char* target_package,
+ const char* target_component_name,
+ const char* module_name);
FuzzerBase* GetFuzzerBase(
const ComponentSpecificationMessage& iface_spec_msg,
diff --git a/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp b/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp
index bee9e2b3b..19eb87e00 100644
--- a/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp
+++ b/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp
@@ -46,7 +46,8 @@ SpecificationBuilder::FindComponentSpecification(const int target_class,
const int target_type,
const float target_version,
const string submodule_name,
- const string package) {
+ const string package,
+ const string component_name) {
DIR* dir;
struct dirent* ent;
@@ -79,6 +80,11 @@ SpecificationBuilder::FindComponentSpecification(const int target_class,
} else {
if (message->package() == package &&
message->component_type_version() == target_version) {
+ if (component_name.length() > 0) {
+ if (message->component_name() != component_name) {
+ continue;
+ }
+ }
closedir(dir);
return message;
}
@@ -224,10 +230,11 @@ FuzzerBase* SpecificationBuilder::GetFuzzerBaseAndAddAllFunctionsToQueue(
bool SpecificationBuilder::LoadTargetComponent(
const char* dll_file_name, const char* spec_lib_file_path, int target_class,
int target_type, float target_version, const char* target_package,
- const char* module_name) {
+ const char* target_component_name, const char* module_name) {
if_spec_msg_ =
FindComponentSpecification(target_class, target_type, target_version,
- module_name, target_package);
+ module_name, target_package,
+ target_component_name);
if (!if_spec_msg_) {
cerr << __FUNCTION__ << ": no interface specification file found for "
<< "class " << target_class << " type " << target_type << " version "
@@ -439,7 +446,7 @@ const string& SpecificationBuilder::CallFunction(
FindComponentSpecification(
if_spec_msg_->component_class(), if_spec_msg_->component_type(),
if_spec_msg_->component_type_version(), submodule_name,
- if_spec_msg_->package());
+ if_spec_msg_->package(), if_spec_msg_->component_name());
if (!submodule_iface_spec_msg) {
cerr << __func__ << " submodule InterfaceSpecification not found" << endl;
} else {
@@ -589,7 +596,7 @@ const string& SpecificationBuilder::GetAttribute(
FindComponentSpecification(
if_spec_msg_->component_class(), if_spec_msg_->component_type(),
if_spec_msg_->component_type_version(), submodule_name,
- if_spec_msg_->package());
+ if_spec_msg_->package(), if_spec_msg_->component_name());
if (!submodule_iface_spec_msg) {
cerr << __func__ << " submodule InterfaceSpecification not found" << endl;
} else {
@@ -614,10 +621,11 @@ bool SpecificationBuilder::Process(const char* dll_file_name,
const char* spec_lib_file_path,
int target_class, int target_type,
float target_version,
- const char* target_package) {
+ const char* target_package,
+ const char* target_component_name) {
vts::ComponentSpecificationMessage* interface_specification_message =
FindComponentSpecification(target_class, target_type, target_version,
- target_package);
+ target_package, target_component_name);
cout << "ifspec addr " << interface_specification_message << endl;
if (!interface_specification_message) {
diff --git a/sysfuzzer/framework/SocketServer.cpp b/sysfuzzer/framework/SocketServer.cpp
index cf064ff91..fb226ec38 100644
--- a/sysfuzzer/framework/SocketServer.cpp
+++ b/sysfuzzer/framework/SocketServer.cpp
@@ -65,11 +65,13 @@ void VtsDriverHalSocketServer::Exit() { printf("VtsFuzzerServer::Exit\n"); }
int32_t VtsDriverHalSocketServer::LoadHal(const string& path, int target_class,
int target_type, float target_version,
const string& target_package,
+ const string& target_component_name,
const string& module_name) {
printf("VtsFuzzerServer::LoadHal(%s)\n", path.c_str());
bool success = spec_builder_.LoadTargetComponent(
path.c_str(), lib_path_, target_class, target_type, target_version,
- target_package.c_str(), module_name.c_str());
+ target_package.c_str(), target_component_name.c_str(),
+ module_name.c_str());
cout << "Result: " << success << std::endl;
if (success) {
return 0;
@@ -152,7 +154,9 @@ bool VtsDriverHalSocketServer::ProcessOneCommand() {
int32_t result = LoadHal(
command_message.file_path(), command_message.target_class(),
command_message.target_type(), command_message.target_version(),
- command_message.target_package(), command_message.module_name());
+ command_message.target_package(),
+ command_message.target_component_name(),
+ command_message.module_name());
VtsDriverControlResponseMessage response_message;
response_message.set_response_code(VTS_DRIVER_RESPONSE_SUCCESS);
response_message.set_return_value(result);
diff --git a/sysfuzzer/framework/SocketServer.h b/sysfuzzer/framework/SocketServer.h
index d15a5e71a..b87789aae 100644
--- a/sysfuzzer/framework/SocketServer.h
+++ b/sysfuzzer/framework/SocketServer.h
@@ -39,7 +39,8 @@ class VtsDriverHalSocketServer : public VtsDriverCommUtil {
void Exit();
int32_t LoadHal(const string& path, int target_class, int target_type,
float target_version, const string& target_package,
- const string& module_name);
+ const string& module_name,
+ const string& target_component_name);
int32_t Status(int32_t type);
const char* ReadSpecification(const string& name);
const char* Call(const string& arg);
diff --git a/sysfuzzer/framework/VtsFuzzerMain.cpp b/sysfuzzer/framework/VtsFuzzerMain.cpp
index 253302a88..4878714d8 100644
--- a/sysfuzzer/framework/VtsFuzzerMain.cpp
+++ b/sysfuzzer/framework/VtsFuzzerMain.cpp
@@ -85,6 +85,7 @@ int main(int argc, char* const argv[]) {
{"epoch_count", required_argument, NULL, 'e'},
{"spec_dir", required_argument, NULL, 's'},
{"target_package", optional_argument, NULL, 'k'},
+ {"target_component_name", optional_argument, NULL, 'n'},
#ifndef VTS_AGENT_DRIVER_COMM_BINDER // socket
{"server_socket_path", optional_argument, NULL, 'f'},
#else // binder
@@ -105,6 +106,7 @@ int main(int argc, char* const argv[]) {
string service_name(VTS_FUZZER_BINDER_SERVICE_NAME);
#endif
string target_package;
+ string target_component_name;
string callback_socket_name;
while (true) {
@@ -177,6 +179,9 @@ int main(int argc, char* const argv[]) {
case 'k':
target_package = string(optarg);
break;
+ case 'n':
+ target_component_name = string(optarg);
+ break;
default:
if (ic != '?') {
fprintf(stderr, "getopt_long returned unexpected value 0x%x\n", ic);
@@ -196,7 +201,8 @@ int main(int argc, char* const argv[]) {
bool success =
spec_builder.Process(argv[optind], INTERFACE_SPEC_LIB_FILENAME,
target_class, target_type, target_version,
- target_package.c_str());
+ target_package.c_str(),
+ target_component_name.c_str());
cout << "Result: " << success << endl;
if (success) {
cout << endl << PASSED_MARKER << endl;