VTS: only assert that IGnssDebug present for non-automotive

VTS test VtsHalGnssV1_0Target#GnssHalTest.GetAllExtensions tests that
IGnss::getEnxtensionGnssDebug returns an actual extension. Make an
exception for automotive devices.

Bug: 143966170
Test: ran VtsHalGnssV1_0Target on Volvo IHU

Change-Id: I1588099a5be704c7869d6d5e8c0312d8b498bb95
This commit is contained in:
Johan Ankner
2019-12-17 10:30:30 +01:00
parent 356c36b96d
commit 2fd5c7cdf9
2 changed files with 19 additions and 4 deletions

View File

@@ -25,6 +25,8 @@
#include <condition_variable>
#include <mutex>
#include <cutils/properties.h>
using android::hardware::Return;
using android::hardware::Void;
@@ -36,6 +38,12 @@ using android::hardware::gnss::V1_0::IGnssDebug;
using android::hardware::gnss::V1_0::IGnssMeasurement;
using android::sp;
static bool IsAutomotiveDevice() {
char buffer[PROPERTY_VALUE_MAX] = {0};
property_get("ro.hardware.type", buffer, "");
return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0;
}
#define TIMEOUT_SEC 2 // for basic commands/responses
// for command line argument on how strictly to run the test
@@ -460,9 +468,9 @@ TEST_F(GnssHalTest, GetAllExtensions) {
auto gnssDebug = gnss_hal_->getExtensionGnssDebug();
ASSERT_TRUE(gnssDebug.isOk());
if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) {
sp<IGnssDebug> iGnssDebug = gnssDebug;
EXPECT_NE(iGnssDebug, nullptr);
if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) {
sp<IGnssDebug> iGnssDebug = gnssDebug;
EXPECT_NE(iGnssDebug, nullptr);
}
}

View File

@@ -21,6 +21,7 @@
#include <VtsHalHidlTargetTestBase.h>
#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <cutils/properties.h>
using android::hardware::hidl_vec;
@@ -30,6 +31,12 @@ using android::hardware::gnss::V1_0::IGnssDebug;
using android::hardware::gnss::V1_1::IGnssConfiguration;
using android::hardware::gnss::V1_1::IGnssMeasurement;
static bool IsAutomotiveDevice() {
char buffer[PROPERTY_VALUE_MAX] = {0};
property_get("ro.hardware.type", buffer, "");
return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0;
}
/*
* SetupTeardownCreateCleanup:
* Requests the gnss HAL then calls cleanup
@@ -425,7 +432,7 @@ TEST_F(GnssHalTest, InjectBestLocation) {
TEST_F(GnssHalTest, GnssDebugValuesSanityTest) {
auto gnssDebug = gnss_hal_->getExtensionGnssDebug();
ASSERT_TRUE(gnssDebug.isOk());
if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) {
if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) {
sp<IGnssDebug> iGnssDebug = gnssDebug;
EXPECT_NE(iGnssDebug, nullptr);