From 0076dae6084a07742856bc4c5aa87dc18fba3b41 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 16 Sep 2020 13:51:11 -0700 Subject: [PATCH] wifi(vts): Precondition AP tests on existence of hostapd HAL This used to be present on the old host side VTS tests, port the feature to target side since host side VTS tests are deprecated. Also, i) Added a separate test: VtsHalWifiV1_4TargetTest to test the wifi chip methods. Putting them in VtsHalWifiApV1_4TargetTest will prevent these from running on devices without AP feature. ii) Ensured all the non-NAN, non-RTT tests disable framework for testing. NAN/RTT tests uses framework to check if the corresponding package manager feature exists. Bug: 166529516 Test: atest \ VtsHalWifiApV1_0TargetTest \ VtsHalWifiApV1_4TargetTest \ VtsHalWifiV1_0TargetTest \ VtsHalWifiV1_4TargetTest Change-Id: I05aab6992277601633a0f926a8262c4c27402e93 --- wifi/1.0/vts/functional/Android.bp | 2 ++ .../functional/wifi_ap_iface_hidl_test.cpp | 6 ++++ .../vts/functional/wifi_chip_hidl_ap_test.cpp | 6 ++++ wifi/1.1/vts/functional/Android.bp | 1 + wifi/1.4/vts/functional/Android.bp | 28 +++++++++++++++++-- .../functional/wifi_ap_iface_hidl_test.cpp | 6 ++++ 6 files changed, 46 insertions(+), 3 deletions(-) diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp index 14a8509718..867f31e058 100644 --- a/wifi/1.0/vts/functional/Android.bp +++ b/wifi/1.0/vts/functional/Android.bp @@ -89,8 +89,10 @@ cc_test { static_libs: [ "VtsHalWifiV1_0TargetTestUtil", "android.hardware.wifi@1.0", + "android.hardware.wifi.hostapd@1.0", "libwifi-system-iface", ], + disable_framework: true, test_suites: [ "general-tests", "vts", diff --git a/wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp index 3599b94075..173e64776c 100644 --- a/wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp +++ b/wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include "wifi_hidl_test_utils.h" using ::android::sp; +using ::android::hardware::wifi::hostapd::V1_0::IHostapd; using ::android::hardware::wifi::V1_0::IfaceType; using ::android::hardware::wifi::V1_0::IWifi; using ::android::hardware::wifi::V1_0::IWifiApIface; @@ -38,6 +40,10 @@ using ::android::hardware::wifi::V1_0::WifiStatusCode; class WifiApIfaceHidlTest : public ::testing::TestWithParam { public: virtual void SetUp() override { + if (android::hardware::getAllHalInstanceNames(IHostapd::descriptor) + .empty()) { + GTEST_SKIP() << "Device does not support AP"; + } // Make sure test starts with a clean state stopWifi(GetInstanceName()); diff --git a/wifi/1.0/vts/functional/wifi_chip_hidl_ap_test.cpp b/wifi/1.0/vts/functional/wifi_chip_hidl_ap_test.cpp index 5a2c6a740e..8644ad6246 100644 --- a/wifi/1.0/vts/functional/wifi_chip_hidl_ap_test.cpp +++ b/wifi/1.0/vts/functional/wifi_chip_hidl_ap_test.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include "wifi_hidl_test_utils.h" using ::android::sp; +using ::android::hardware::wifi::hostapd::V1_0::IHostapd; using ::android::hardware::wifi::V1_0::ChipModeId; using ::android::hardware::wifi::V1_0::IfaceType; using ::android::hardware::wifi::V1_0::IWifi; @@ -41,6 +43,10 @@ using ::android::hardware::wifi::V1_0::WifiStatusCode; class WifiChipHidlApTest : public ::testing::TestWithParam { public: virtual void SetUp() override { + if (android::hardware::getAllHalInstanceNames(IHostapd::descriptor) + .empty()) { + GTEST_SKIP() << "Device does not support AP"; + } // Make sure test starts with a clean state stopWifi(GetInstanceName()); diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp index 7dc78e4519..df14868362 100644 --- a/wifi/1.1/vts/functional/Android.bp +++ b/wifi/1.1/vts/functional/Android.bp @@ -28,6 +28,7 @@ cc_test { "android.hardware.wifi@1.3", "libwifi-system-iface", ], + disable_framework: true, test_suites: [ "general-tests", "vts", diff --git a/wifi/1.4/vts/functional/Android.bp b/wifi/1.4/vts/functional/Android.bp index 59a35e0262..c1618a4265 100644 --- a/wifi/1.4/vts/functional/Android.bp +++ b/wifi/1.4/vts/functional/Android.bp @@ -14,12 +14,10 @@ // limitations under the License. // -// SoftAP-specific tests, similar to VtsHalWifiApV1_0TargetTest. cc_test { - name: "VtsHalWifiApV1_4TargetTest", + name: "VtsHalWifiV1_4TargetTest", defaults: ["VtsHalTargetTestDefaults"], srcs: [ - "wifi_ap_iface_hidl_test.cpp", "wifi_chip_hidl_test.cpp", ], static_libs: [ @@ -37,6 +35,30 @@ cc_test { ], } +// SoftAP-specific tests, similar to VtsHalWifiApV1_0TargetTest. +cc_test { + name: "VtsHalWifiApV1_4TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "wifi_ap_iface_hidl_test.cpp", + ], + static_libs: [ + "VtsHalWifiV1_0TargetTestUtil", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi.hostapd@1.0", + "libwifi-system-iface", + ], + disable_framework: true, + test_suites: [ + "general-tests", + "vts", + ], +} + // These tests are split out so that they can be conditioned on presence of the // "android.hardware.wifi.aware" feature. cc_test { diff --git a/wifi/1.4/vts/functional/wifi_ap_iface_hidl_test.cpp b/wifi/1.4/vts/functional/wifi_ap_iface_hidl_test.cpp index aff0ef741f..453861b1a5 100644 --- a/wifi/1.4/vts/functional/wifi_ap_iface_hidl_test.cpp +++ b/wifi/1.4/vts/functional/wifi_ap_iface_hidl_test.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,7 @@ using ::android::sp; using ::android::hardware::hidl_array; +using ::android::hardware::wifi::hostapd::V1_0::IHostapd; using ::android::hardware::wifi::V1_0::WifiStatus; using ::android::hardware::wifi::V1_0::WifiStatusCode; using ::android::hardware::wifi::V1_4::IWifi; @@ -36,6 +38,10 @@ using ::android::hardware::wifi::V1_4::IWifiApIface; class WifiApIfaceHidlTest : public ::testing::TestWithParam { public: virtual void SetUp() override { + if (android::hardware::getAllHalInstanceNames(IHostapd::descriptor) + .empty()) { + GTEST_SKIP() << "Device does not support AP"; + } // Make sure to start with a clean state stopWifi(GetInstanceName());