Loading wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp +7 −3 Original line number Original line Diff line number Diff line Loading @@ -21,9 +21,13 @@ #include "wifi_hidl_test_utils.h" #include "wifi_hidl_test_utils.h" int main(int argc, char** argv) { int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment); WifiHidlEnvironment* gEnv = new WifiHidlEnvironment(); ::testing::AddGlobalTestEnvironment(gEnv); ::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv); int status = RUN_ALL_TESTS(); int status = gEnv->initFromOptions(argc, argv); if (status == 0) { status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; LOG(INFO) << "Test result = " << status; } return status; return status; } } wifi/1.0/vts/functional/wifi_hidl_test_utils.h +45 −7 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,8 @@ #include <android/hardware/wifi/1.0/IWifiRttController.h> #include <android/hardware/wifi/1.0/IWifiRttController.h> #include <android/hardware/wifi/1.0/IWifiStaIface.h> #include <android/hardware/wifi/1.0/IWifiStaIface.h> #include <getopt.h> // Helper functions to obtain references to the various HIDL interface objects. // Helper functions to obtain references to the various HIDL interface objects. // Note: We only have a single instance of each of these objects currently. // Note: We only have a single instance of each of these objects currently. // These helper functions should be modified to return vectors if we support // These helper functions should be modified to return vectors if we support Loading @@ -46,10 +48,46 @@ bool configureChipToSupportIfaceType( void stopWifi(); void stopWifi(); class WifiHidlEnvironment : public ::testing::Environment { class WifiHidlEnvironment : public ::testing::Environment { public: protected: virtual void SetUp() override { virtual void SetUp() override { stopWifi(); stopWifi(); sleep(5); sleep(5); } } virtual void TearDown() override {} public: // Whether NaN feature is supported on the device. bool isNanOn = false; 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" "-N, --nan_on: Whether NAN feature is supported\n", arg, me); } int initFromOptions(int argc, char** argv) { static struct option options[] = {{"nan_on", no_argument, 0, 'N'}, {0, 0, 0, 0}}; int c; while ((c = getopt_long(argc, argv, "N", options, NULL)) >= 0) { switch (c) { case 'N': isNanOn = true; break; default: usage(argv[0], argv[optind]); return 2; } } if (optind < argc) { usage(argv[0], argv[optind]); return 2; } return 0; } }; }; Loading
wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp +7 −3 Original line number Original line Diff line number Diff line Loading @@ -21,9 +21,13 @@ #include "wifi_hidl_test_utils.h" #include "wifi_hidl_test_utils.h" int main(int argc, char** argv) { int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment); WifiHidlEnvironment* gEnv = new WifiHidlEnvironment(); ::testing::AddGlobalTestEnvironment(gEnv); ::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv); int status = RUN_ALL_TESTS(); int status = gEnv->initFromOptions(argc, argv); if (status == 0) { status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; LOG(INFO) << "Test result = " << status; } return status; return status; } }
wifi/1.0/vts/functional/wifi_hidl_test_utils.h +45 −7 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,8 @@ #include <android/hardware/wifi/1.0/IWifiRttController.h> #include <android/hardware/wifi/1.0/IWifiRttController.h> #include <android/hardware/wifi/1.0/IWifiStaIface.h> #include <android/hardware/wifi/1.0/IWifiStaIface.h> #include <getopt.h> // Helper functions to obtain references to the various HIDL interface objects. // Helper functions to obtain references to the various HIDL interface objects. // Note: We only have a single instance of each of these objects currently. // Note: We only have a single instance of each of these objects currently. // These helper functions should be modified to return vectors if we support // These helper functions should be modified to return vectors if we support Loading @@ -46,10 +48,46 @@ bool configureChipToSupportIfaceType( void stopWifi(); void stopWifi(); class WifiHidlEnvironment : public ::testing::Environment { class WifiHidlEnvironment : public ::testing::Environment { public: protected: virtual void SetUp() override { virtual void SetUp() override { stopWifi(); stopWifi(); sleep(5); sleep(5); } } virtual void TearDown() override {} public: // Whether NaN feature is supported on the device. bool isNanOn = false; 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" "-N, --nan_on: Whether NAN feature is supported\n", arg, me); } int initFromOptions(int argc, char** argv) { static struct option options[] = {{"nan_on", no_argument, 0, 'N'}, {0, 0, 0, 0}}; int c; while ((c = getopt_long(argc, argv, "N", options, NULL)) >= 0) { switch (c) { case 'N': isNanOn = true; break; default: usage(argv[0], argv[optind]); return 2; } } if (optind < argc) { usage(argv[0], argv[optind]); return 2; } return 0; } }; };