wifi: Call terminate in VTS teardown

When OEM register different hostapd instance without update the StopHostapd.
It will cause VTS clean fail because hostapd process name is the new
one.
Call terminate to request clean HAL state.

Bug: 163170239
Bug: 161682236
Bug: 167636313
Test: atest -c VtsHalWifiHostapdV1_1TargetTest
Test: atest -c VtsHalWifiHostapdV1_0TargetTest
Change-Id: If56e5b5351abd31865150bdf97d27674dbbc4257
This commit is contained in:
lesl
2020-09-08 00:06:34 +08:00
parent 828e90a428
commit 08ab488c16
3 changed files with 22 additions and 2 deletions

View File

@@ -97,6 +97,14 @@ typename functionArgSaver<CallbackT>::StorageT invokeMethod(
EXPECT_TRUE(res.isOk());
return result_buffer.saved_values;
}
// Invokes |void method| on |object| without arguments.
template <typename MethodT, typename ObjectT>
void invokeVoidMethodWithoutArguments(MethodT method, ObjectT object) {
const auto& res = ((*object).*method)();
EXPECT_TRUE(res.isOk());
}
} // namespace detail
} // namespace
@@ -125,3 +133,9 @@ typename functionArgSaver<CallbackT>::StorageT invokeMethod(
std::remove_reference<decltype(*strong_pointer)>::type::method##_cb>( \
&std::remove_reference<decltype(*strong_pointer)>::type::method, \
strong_pointer, ##__VA_ARGS__))
// Invokes |void method| on |strong_pointer| without arguments.
#define HIDL_INVOKE_VOID_WITHOUT_ARGUMENTS(strong_pointer, method) \
(detail::invokeVoidMethodWithoutArguments( \
&std::remove_reference<decltype(*strong_pointer)>::type::method, \
strong_pointer))

View File

@@ -47,7 +47,10 @@ class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
ASSERT_NE(hostapd_.get(), nullptr);
}
virtual void TearDown() override { stopHostapd(); }
virtual void TearDown() override {
HIDL_INVOKE_VOID_WITHOUT_ARGUMENTS(hostapd_, terminate);
stopHostapd();
}
protected:
std::string getPrimaryWlanIfaceName() {

View File

@@ -51,7 +51,10 @@ class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
ASSERT_NE(hostapd_.get(), nullptr);
}
virtual void TearDown() override { stopHostapd(); }
virtual void TearDown() override {
HIDL_INVOKE_VOID_WITHOUT_ARGUMENTS(hostapd_, terminate);
stopHostapd();
}
protected:
std::string getPrimaryWlanIfaceName() {