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

Commit 0e2aeb15 authored by Zhanglong Xia's avatar Zhanglong Xia Committed by Automerger Merge Worker
Browse files

Bypass Thread HAL SendSpinelFrame test on TV devices am: 1dc8481b am: 786b7371 am: 2e8bbb00

parents a25c1b85 2e8bbb00
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -67,10 +67,33 @@ class ThreadNetworkAidl : public testing::TestWithParam<std::string> {
    }

    virtual void TearDown() override { thread_chip->close(); }
    bool DeviceSupportsFeature(const char* feature);

    static constexpr char kTvFeatureName[] = "android.software.leanback";
    std::shared_ptr<IThreadChip> thread_chip;
};

bool ThreadNetworkAidl::DeviceSupportsFeature(const char* feature) {
    bool device_supports_feature = false;
    FILE* p = popen("pm list features", "re");
    char* line = nullptr;
    size_t len = 0;

    if (!p) {
        return false;
    }

    while (getline(&line, &len, p) > 0) {
        if (strstr(line, feature)) {
            device_supports_feature = true;
            break;
        }
    }
    pclose(p);

    return device_supports_feature;
}

TEST_P(ThreadNetworkAidl, Open) {
    std::shared_ptr<ThreadChipCallback> callback =
            ndk::SharedRefBase::make<ThreadChipCallback>([](auto /* data */) {});
@@ -122,6 +145,10 @@ TEST_P(ThreadNetworkAidl, SendSpinelFrame) {
                }
            });

    if (DeviceSupportsFeature(kTvFeatureName)) {
        GTEST_SKIP() << "SendSpinelFrame test is bypassed on TV devices";
    }

    ASSERT_NE(callback, nullptr);

    EXPECT_TRUE(thread_chip->open(callback).isOk());