Rename FuzzerBase to DriverBase in ProtoFuzzer.
* Update due to driver refactory.
Bug: 62952729
Test: make vts.
Change-Id: I5bbbb5a1163fdc2baf1d131823b2973a13cc6549
diff --git a/iface_fuzzer/ProtoFuzzerMain.cpp b/iface_fuzzer/ProtoFuzzerMain.cpp
index a9babbc..59ec328 100644
--- a/iface_fuzzer/ProtoFuzzerMain.cpp
+++ b/iface_fuzzer/ProtoFuzzerMain.cpp
@@ -16,7 +16,6 @@
#include "ProtoFuzzerMutator.h"
-#include "specification_parser/InterfaceSpecificationParser.h"
#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
#include <unistd.h>
diff --git a/iface_fuzzer/ProtoFuzzerRunner.cpp b/iface_fuzzer/ProtoFuzzerRunner.cpp
index 8fe7931..dddefb9 100644
--- a/iface_fuzzer/ProtoFuzzerRunner.cpp
+++ b/iface_fuzzer/ProtoFuzzerRunner.cpp
@@ -93,7 +93,7 @@
return function;
}
-static void GetService(FuzzerBase *hal, string service_name, bool binder_mode) {
+static void GetService(DriverBase *hal, string service_name, bool binder_mode) {
// For fuzzing, only passthrough mode provides coverage.
// If binder mode is not requested, attempt to open HAL in passthrough mode.
// If the attempt fails, fall back to binder mode.
@@ -116,24 +116,24 @@
}
}
-FuzzerBase *ProtoFuzzerRunner::LoadInterface(const CompSpec &comp_spec,
+DriverBase *ProtoFuzzerRunner::LoadInterface(const CompSpec &comp_spec,
uint64_t hidl_service = 0) {
- FuzzerBase *hal;
+ DriverBase *hal;
const char *error;
// Clear dlerror().
dlerror();
- // FuzzerBase can be constructed with or without an argument.
- // Using different FuzzerBase constructors requires dlsym'ing different
+ // DriverBase can be constructed with or without an argument.
+ // Using different DriverBase constructors requires dlsym'ing different
// symbols from the driver library.
string function_name = GetFunctionNamePrefix(comp_spec);
if (hidl_service) {
function_name += "with_arg";
- using loader_func = FuzzerBase *(*)(uint64_t);
+ using loader_func = DriverBase *(*)(uint64_t);
auto hal_loader = (loader_func)Dlsym(driver_handle_, function_name.c_str());
hal = hal_loader(hidl_service);
} else {
- using loader_func = FuzzerBase *(*)();
+ using loader_func = DriverBase *(*)();
auto hal_loader = (loader_func)Dlsym(driver_handle_, function_name.c_str());
hal = hal_loader();
}
@@ -155,7 +155,7 @@
string driver_name = GetDriverName(*comp_spec);
driver_handle_ = Dlopen(driver_name);
- std::shared_ptr<FuzzerBase> hal{LoadInterface(*comp_spec)};
+ std::shared_ptr<DriverBase> hal{LoadInterface(*comp_spec)};
string service_name = GetServiceName(*comp_spec);
cerr << "HAL name: " << comp_spec->package() << endl
<< "Interface name: " << comp_spec->component_name() << endl
@@ -209,7 +209,7 @@
string iface_name = StripNamespace(type);
const CompSpec *comp_spec = FindCompSpec(iface_name);
- std::shared_ptr<FuzzerBase> hal{LoadInterface(*comp_spec, hidl_service)};
+ std::shared_ptr<DriverBase> hal{LoadInterface(*comp_spec, hidl_service)};
// Register this interface as opened by the runner.
opened_ifaces_[iface_name] = {
diff --git a/iface_fuzzer/ProtoFuzzerUtils.cpp b/iface_fuzzer/ProtoFuzzerUtils.cpp
index 44f8c9d..b6c2231 100644
--- a/iface_fuzzer/ProtoFuzzerUtils.cpp
+++ b/iface_fuzzer/ProtoFuzzerUtils.cpp
@@ -21,7 +21,6 @@
#include <algorithm>
#include <sstream>
-#include "specification_parser/InterfaceSpecificationParser.h"
#include "utils/InterfaceSpecUtil.h"
using std::cout;
@@ -95,7 +94,7 @@
cout << "Loading: " << vts_spec_name << endl;
string vts_spec_path = dir_path + "/" + vts_spec_name;
CompSpec comp_spec{};
- InterfaceSpecificationParser::parse(vts_spec_path.c_str(), &comp_spec);
+ ParseInterfaceSpec(vts_spec_path.c_str(), &comp_spec);
TrimCompSpec(&comp_spec);
result.emplace_back(std::move(comp_spec));
}
diff --git a/iface_fuzzer/include/ProtoFuzzerRunner.h b/iface_fuzzer/include/ProtoFuzzerRunner.h
index 124b2b9..179b059 100644
--- a/iface_fuzzer/include/ProtoFuzzerRunner.h
+++ b/iface_fuzzer/include/ProtoFuzzerRunner.h
@@ -30,7 +30,7 @@
// VTS spec of the interface.
const CompSpec *comp_spec_;
// Handle to an interface instance.
- std::shared_ptr<FuzzerBase> hal_;
+ std::shared_ptr<DriverBase> hal_;
};
using IfaceDescTbl = std::unordered_map<std::string, IfaceDesc>;
@@ -58,7 +58,7 @@
void ProcessReturnValue(const FuncSpec &result);
// Loads the interface corresponding to the given VTS spec. Interface is
// constructed with the given argument.
- FuzzerBase *LoadInterface(const CompSpec &, uint64_t);
+ DriverBase *LoadInterface(const CompSpec &, uint64_t);
// Keeps track of opened interfaces.
IfaceDescTbl opened_ifaces_;
diff --git a/iface_fuzzer/include/ProtoFuzzerUtils.h b/iface_fuzzer/include/ProtoFuzzerUtils.h
index 9f37401..753a2be 100644
--- a/iface_fuzzer/include/ProtoFuzzerUtils.h
+++ b/iface_fuzzer/include/ProtoFuzzerUtils.h
@@ -23,7 +23,7 @@
#include <unordered_map>
#include <vector>
-#include "fuzz_tester/FuzzerBase.h"
+#include "driver_base/DriverBase.h"
#include "test/vts/proto/ExecutionSpecificationMessage.pb.h"
namespace android {