Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08ab488c authored by lesl's avatar lesl
Browse files

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
parent 828e90a4
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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))
+4 −1
Original line number Diff line number Diff line
@@ -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() {
+4 −1
Original line number Diff line number Diff line
@@ -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() {