Loading wifi/supplicant/1.0/vts/functional/Android.bp +20 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ cc_test { srcs: [ "VtsHalWifiSupplicantV1_0TargetTest.cpp", "supplicant_hidl_test.cpp", "supplicant_p2p_iface_hidl_test.cpp", "supplicant_sta_iface_hidl_test.cpp", "supplicant_sta_network_hidl_test.cpp", ], Loading @@ -55,3 +54,23 @@ cc_test { "libwifi-system-iface", ], } cc_test { name: "VtsHalWifiSupplicantP2pV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], srcs: [ "VtsHalWifiSupplicantV1_0TargetTest.cpp", "supplicant_p2p_iface_hidl_test.cpp", ], static_libs: [ "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", "android.hardware.wifi@1.0", "libcrypto", "libgmock", "libwifi-system", "libwifi-system-iface", ], } wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,10 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(gEnv); ::testing::InitGoogleTest(&argc, argv); gEnv->init(&argc, argv); int status = gEnv->initFromOptions(argc, argv); if (status == 0) { int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; } return status; } wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp +15 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; using ::android::hardware::wifi::supplicant::V1_0::IfaceType; extern WifiSupplicantHidlEnvironment* gEnv; class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { Loading Loading @@ -72,11 +74,14 @@ TEST_F(SupplicantHidlTest, ListInterfaces) { std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) { return iface.type == IfaceType::STA; })); EXPECT_NE(ifaces.end(), if (gEnv->isP2pOn) { EXPECT_NE( ifaces.end(), std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) { return iface.type == IfaceType::P2P; })); } } /* * GetInterface Loading Loading @@ -178,8 +183,10 @@ TEST_F(SupplicantHidlTest, SetConcurrencyPriority) { IfaceType::STA, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); if (gEnv->isP2pOn) { supplicant_->setConcurrencyPriority( IfaceType::P2P, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); } } wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -225,8 +225,10 @@ sp<ISupplicant> getSupplicant() { // For 1.1 supplicant, we need to add interfaces at initialization. if (is_1_1(supplicant)) { addSupplicantStaIface_1_1(supplicant); if (gEnv->isP2pOn) { addSupplicantP2pIface_1_1(supplicant); } } return supplicant; } Loading wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h +40 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ #include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h> #include <android/hardware/wifi/supplicant/1.1/ISupplicant.h> #include <getopt.h> #include <VtsHalHidlTargetTestEnvBase.h> // Used to stop the android wifi framework before every test. Loading Loading @@ -50,11 +52,48 @@ bool turnOnExcessiveLogging(); class WifiSupplicantHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { public: protected: virtual void HidlSetUp() override { stopSupplicant(); } virtual void HidlTearDown() override { startSupplicantAndWaitForHidlService(); } public: // Whether P2P feature is supported on the device. bool isP2pOn = true; void usage(char* me, char* arg) { fprintf(stderr, "unrecognized option: %s\n\n" "usage: %s <gtest options> <test options>\n\n" "test options are:\n\n" "-P, --p2p_on: Whether P2P feature is supported\n", arg, me); } int initFromOptions(int argc, char** argv) { static struct option options[] = {{"p2p_off", no_argument, 0, 'P'}, {0, 0, 0, 0}}; int c; while ((c = getopt_long(argc, argv, "P", options, NULL)) >= 0) { switch (c) { case 'P': isP2pOn = false; break; default: usage(argv[0], argv[optind]); return 2; } } if (optind < argc) { usage(argv[0], argv[optind]); return 2; } return 0; } }; #endif /* SUPPLICANT_HIDL_TEST_UTILS_H */ Loading
wifi/supplicant/1.0/vts/functional/Android.bp +20 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ cc_test { srcs: [ "VtsHalWifiSupplicantV1_0TargetTest.cpp", "supplicant_hidl_test.cpp", "supplicant_p2p_iface_hidl_test.cpp", "supplicant_sta_iface_hidl_test.cpp", "supplicant_sta_network_hidl_test.cpp", ], Loading @@ -55,3 +54,23 @@ cc_test { "libwifi-system-iface", ], } cc_test { name: "VtsHalWifiSupplicantP2pV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], srcs: [ "VtsHalWifiSupplicantV1_0TargetTest.cpp", "supplicant_p2p_iface_hidl_test.cpp", ], static_libs: [ "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", "android.hardware.wifi@1.0", "libcrypto", "libgmock", "libwifi-system", "libwifi-system-iface", ], }
wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,10 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(gEnv); ::testing::InitGoogleTest(&argc, argv); gEnv->init(&argc, argv); int status = gEnv->initFromOptions(argc, argv); if (status == 0) { int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; } return status; }
wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp +15 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; using ::android::hardware::wifi::supplicant::V1_0::IfaceType; extern WifiSupplicantHidlEnvironment* gEnv; class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { Loading Loading @@ -72,11 +74,14 @@ TEST_F(SupplicantHidlTest, ListInterfaces) { std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) { return iface.type == IfaceType::STA; })); EXPECT_NE(ifaces.end(), if (gEnv->isP2pOn) { EXPECT_NE( ifaces.end(), std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) { return iface.type == IfaceType::P2P; })); } } /* * GetInterface Loading Loading @@ -178,8 +183,10 @@ TEST_F(SupplicantHidlTest, SetConcurrencyPriority) { IfaceType::STA, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); if (gEnv->isP2pOn) { supplicant_->setConcurrencyPriority( IfaceType::P2P, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); } }
wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -225,8 +225,10 @@ sp<ISupplicant> getSupplicant() { // For 1.1 supplicant, we need to add interfaces at initialization. if (is_1_1(supplicant)) { addSupplicantStaIface_1_1(supplicant); if (gEnv->isP2pOn) { addSupplicantP2pIface_1_1(supplicant); } } return supplicant; } Loading
wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h +40 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ #include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h> #include <android/hardware/wifi/supplicant/1.1/ISupplicant.h> #include <getopt.h> #include <VtsHalHidlTargetTestEnvBase.h> // Used to stop the android wifi framework before every test. Loading Loading @@ -50,11 +52,48 @@ bool turnOnExcessiveLogging(); class WifiSupplicantHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { public: protected: virtual void HidlSetUp() override { stopSupplicant(); } virtual void HidlTearDown() override { startSupplicantAndWaitForHidlService(); } public: // Whether P2P feature is supported on the device. bool isP2pOn = true; void usage(char* me, char* arg) { fprintf(stderr, "unrecognized option: %s\n\n" "usage: %s <gtest options> <test options>\n\n" "test options are:\n\n" "-P, --p2p_on: Whether P2P feature is supported\n", arg, me); } int initFromOptions(int argc, char** argv) { static struct option options[] = {{"p2p_off", no_argument, 0, 'P'}, {0, 0, 0, 0}}; int c; while ((c = getopt_long(argc, argv, "P", options, NULL)) >= 0) { switch (c) { case 'P': isP2pOn = false; break; default: usage(argv[0], argv[optind]); return 2; } } if (optind < argc) { usage(argv[0], argv[optind]); return 2; } return 0; } }; #endif /* SUPPLICANT_HIDL_TEST_UTILS_H */