diff options
| author | Keun Soo Yim <yim@google.com> | 2017-07-11 09:40:33 -0700 |
|---|---|---|
| committer | Etan Cohen <etancohen@google.com> | 2017-07-18 10:38:42 -0700 |
| commit | e034df064094614ac5a35ddc09be6a5894d115c3 (patch) | |
| tree | 89b008791f9c16b0e4d8a93eeb2ec243d879b846 /wifi/1.0/vts | |
| parent | 92cc6209a73f3a1cd209d5590b313db9be9ca488 (diff) | |
| download | android_hardware_interfaces-e034df064094614ac5a35ddc09be6a5894d115c3.tar.gz android_hardware_interfaces-e034df064094614ac5a35ddc09be6a5894d115c3.tar.bz2 android_hardware_interfaces-e034df064094614ac5a35ddc09be6a5894d115c3.zip | |
Accept a command line arg (nan_on) in wifi vts
Test: make vts -j30 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 &&
vts-tradefed run commandAndExit vts --skip-all-system-status-check
--primary-abi-only --skip-preconditions --module VtsHalWifiV1_0Host -l
INFO
Test: VtsHalWifiV1_0TargetTest
Test: VtsHalWifiV1_0TargetTest -N
Test: VtsHalWifiV1_0TargetTest --nan_on
Test: VtsHalWifiV1_0TargetTest -f (fails)
Test: VtsHalWifiV1_0TargetTest --gtest_filter=foo
Test: VtsHalWifiV1_0TargetTest --gtest_filter=foo -N
Test: VtsHalWifiV1_0TargetTest -N --gtest_filter=foo
Bug: 63131342
Change-Id: I359ac7238496e64c7ace1e14e797d4fcfc8cc0e4
Diffstat (limited to 'wifi/1.0/vts')
| -rw-r--r-- | wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp | 10 | ||||
| -rw-r--r-- | wifi/1.0/vts/functional/wifi_hidl_test_utils.h | 52 |
2 files changed, 52 insertions, 10 deletions
diff --git a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp index 160fcd234..d8ec1a72f 100644 --- a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp +++ b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp @@ -21,9 +21,13 @@ #include "wifi_hidl_test_utils.h" int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment); + WifiHidlEnvironment* gEnv = new WifiHidlEnvironment(); + ::testing::AddGlobalTestEnvironment(gEnv); ::testing::InitGoogleTest(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; + int status = gEnv->initFromOptions(argc, argv); + if (status == 0) { + status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + } return status; } diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h index 39a0ebaff..c4a19ddf2 100644 --- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h +++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h @@ -24,6 +24,8 @@ #include <android/hardware/wifi/1.0/IWifiRttController.h> #include <android/hardware/wifi/1.0/IWifiStaIface.h> +#include <getopt.h> + // Helper functions to obtain references to the various HIDL interface objects. // 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 @@ -46,10 +48,46 @@ bool configureChipToSupportIfaceType( void stopWifi(); class WifiHidlEnvironment : public ::testing::Environment { - public: - virtual void SetUp() override { - stopWifi(); - sleep(5); - } - virtual void TearDown() override {} -};
\ No newline at end of file + protected: + virtual void SetUp() override { + stopWifi(); + sleep(5); + } + + 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; + } +}; |
