Merge changes I917be24b,Ia10d3805 into main

* changes:
  Skip AP and P2P tests in wifi_chip_aidl_test if those iface types cannot be created.
  Add AIDL VTS helper method to check whether the specified iface type is supported.
This commit is contained in:
Gabriel Biren
2023-09-11 19:35:25 +00:00
committed by Android (Google) Code Review
3 changed files with 45 additions and 0 deletions

View File

@@ -203,6 +203,20 @@ bool configureChipToSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wif
return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id);
}
bool doesChipSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
IfaceConcurrencyType type) {
if (!wifi_chip.get()) {
return false;
}
std::vector<IWifiChip::ChipMode> chip_modes;
auto status = wifi_chip->getAvailableModes(&chip_modes);
if (!status.isOk()) {
return false;
}
int mode_id;
return findAnyModeSupportingConcurrencyType(type, chip_modes, &mode_id);
}
void stopWifiService(const char* instance_name) {
std::shared_ptr<IWifi> wifi = getWifi(instance_name);
if (wifi != nullptr) {

View File

@@ -42,6 +42,9 @@ std::shared_ptr<IWifiApIface> getBridgedWifiApIface(std::shared_ptr<IWifiChip> w
// Configure the chip in a mode to support the creation of the provided iface type.
bool configureChipToSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
IfaceConcurrencyType type, int* configured_mode_id);
// Check whether the chip supports the creation of the provided iface type.
bool doesChipSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
IfaceConcurrencyType type);
// Used to trigger IWifi.stop() at the end of every test.
void stopWifiService(const char* instance_name);
int32_t getChipFeatureSet(const std::shared_ptr<IWifiChip>& wifi_chip);

View File

@@ -63,6 +63,10 @@ class WifiChipAidlTest : public testing::TestWithParam<std::string> {
return mode_id;
}
bool isConcurrencyTypeSupported(IfaceConcurrencyType type) {
return doesChipSupportConcurrencyType(wifi_chip_, type);
}
std::shared_ptr<IWifiStaIface> configureChipForStaAndGetIface() {
std::shared_ptr<IWifiStaIface> iface;
configureChipForConcurrencyType(IfaceConcurrencyType::STA);
@@ -532,6 +536,9 @@ TEST_P(WifiChipAidlTest, CreateStaIface) {
* CreateApIface
*/
TEST_P(WifiChipAidlTest, CreateApIface) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
GTEST_SKIP() << "AP is not supported";
}
configureChipForApAndGetIface();
}
@@ -549,6 +556,9 @@ TEST_P(WifiChipAidlTest, CreateNanIface) {
* CreateP2pIface
*/
TEST_P(WifiChipAidlTest, CreateP2pIface) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
GTEST_SKIP() << "P2P is not supported";
}
configureChipForP2pAndGetIface();
}
@@ -583,6 +593,9 @@ TEST_P(WifiChipAidlTest, GetStaIfaceNames) {
* GetP2pIfaceNames
*/
TEST_P(WifiChipAidlTest, GetP2pIfaceNames) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
GTEST_SKIP() << "P2P is not supported";
}
configureChipForConcurrencyType(IfaceConcurrencyType::P2P);
std::vector<std::string> iface_names;
@@ -607,6 +620,9 @@ TEST_P(WifiChipAidlTest, GetP2pIfaceNames) {
* GetApIfaceNames
*/
TEST_P(WifiChipAidlTest, GetApIfaceNames) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
GTEST_SKIP() << "AP is not supported";
}
configureChipForConcurrencyType(IfaceConcurrencyType::AP);
std::vector<std::string> iface_names;
@@ -679,6 +695,9 @@ TEST_P(WifiChipAidlTest, GetStaIface) {
* GetP2pIface
*/
TEST_P(WifiChipAidlTest, GetP2pIface) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
GTEST_SKIP() << "P2P is not supported";
}
std::shared_ptr<IWifiP2pIface> iface = configureChipForP2pAndGetIface();
std::string iface_name = getP2pIfaceName(iface);
@@ -697,6 +716,9 @@ TEST_P(WifiChipAidlTest, GetP2pIface) {
* GetApIface
*/
TEST_P(WifiChipAidlTest, GetApIface) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
GTEST_SKIP() << "AP is not supported";
}
std::shared_ptr<IWifiApIface> iface = configureChipForApAndGetIface();
std::string iface_name = getApIfaceName(iface);
@@ -755,6 +777,9 @@ TEST_P(WifiChipAidlTest, RemoveStaIface) {
* RemoveP2pIface
*/
TEST_P(WifiChipAidlTest, RemoveP2pIface) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
GTEST_SKIP() << "P2P is not supported";
}
std::shared_ptr<IWifiP2pIface> iface = configureChipForP2pAndGetIface();
std::string iface_name = getP2pIfaceName(iface);
@@ -771,6 +796,9 @@ TEST_P(WifiChipAidlTest, RemoveP2pIface) {
* RemoveApIface
*/
TEST_P(WifiChipAidlTest, RemoveApIface) {
if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
GTEST_SKIP() << "AP is not supported";
}
std::shared_ptr<IWifiApIface> iface = configureChipForApAndGetIface();
std::string iface_name = getApIfaceName(iface);