enable unit-tests: enable for SensorManager
Enabled unit-tests in general for the project, and more
specifically started with a benign construction test for
the SensorManager object.
Tested: Verified continues to build and link, and unit-test
passes.
Tested: Ran on quanta-q71l board and it behaved as expected.
Change-Id: I4ad9a0c57efd0b9ccc37d26faa0cc1b82026b8d7
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sensors/builder.cpp b/sensors/builder.cpp
index 2786141..4654e51 100644
--- a/sensors/builder.cpp
+++ b/sensors/builder.cpp
@@ -15,6 +15,8 @@
*/
#include <iostream>
+#include <map>
+#include <string>
/* Configuration. */
#include "conf.hpp"
@@ -33,12 +35,12 @@
static constexpr bool deferSignals = true;
-std::shared_ptr<SensorManager> BuildSensors(
+SensorManager BuildSensors(
const std::map<std::string, struct sensor>& config)
{
- auto mgmr = std::make_shared<SensorManager>();
- auto& HostSensorBus = mgmr->getHostBus();
- auto& PassiveListeningBus = mgmr->getPassiveBus();
+ SensorManager mgmr;
+ auto& HostSensorBus = mgmr.getHostBus();
+ auto& PassiveListeningBus = mgmr.getPassiveBus();
for (auto& it : config)
{
@@ -110,7 +112,7 @@
info->timeout,
std::move(ri),
std::move(wi));
- mgmr->addSensor(info->type, name, std::move(sensor));
+ mgmr.addSensor(info->type, name, std::move(sensor));
}
else if (info->type == "temp" || info->type == "margin")
{
@@ -133,7 +135,7 @@
HostSensorBus,
info->readpath.c_str(),
deferSignals);
- mgmr->addSensor(info->type, name, std::move(sensor));
+ mgmr.addSensor(info->type, name, std::move(sensor));
}
else
{
@@ -143,7 +145,7 @@
info->timeout,
std::move(ri),
std::move(wi));
- mgmr->addSensor(info->type, name, std::move(sensor));
+ mgmr.addSensor(info->type, name, std::move(sensor));
}
}
}