summaryrefslogtreecommitdiffstats
path: root/gnss/1.1
diff options
context:
space:
mode:
authorWyattRiley <wyattriley@google.com>2018-06-28 15:05:14 -0700
committerKeun Soo Yim <yim@google.com>2018-08-28 21:17:02 +0000
commit2d86da7b2867c5f964768226cba7aa11adec4dfd (patch)
tree5fed7b050bc66f5e9b958784ecde767293352e05 /gnss/1.1
parent66fb7a1b887758d13a6bb7d1d45ba8ec19e1951e (diff)
downloadplatform_hardware_interfaces-2d86da7b2867c5f964768226cba7aa11adec4dfd.tar.gz
platform_hardware_interfaces-2d86da7b2867c5f964768226cba7aa11adec4dfd.tar.bz2
platform_hardware_interfaces-2d86da7b2867c5f964768226cba7aa11adec4dfd.zip
Improve VTS GNSS 1.1 reliability.
Allow VTS test for low power mode to handle certain vendor issues that supply one extra location at the start of low power mode. Allow more time for GNSS first fix, and warmup as needed given limited VTS access to AGPS. Bug: 110626730 Bug: 110987651 Test: (TODO) Passes on device. Merged-In: Ieeefd7fcd45890b03dffbbee965e1d9b17805c4c Change-Id: Ieeefd7fcd45890b03dffbbee965e1d9b17805c4c (cherry picked from commit 5ea5dda2c33f9d2f1db77d6b4493f0eb356c2937)
Diffstat (limited to 'gnss/1.1')
-rw-r--r--gnss/1.1/vts/functional/gnss_hal_test.cpp11
-rw-r--r--gnss/1.1/vts/functional/gnss_hal_test.h9
-rw-r--r--gnss/1.1/vts/functional/gnss_hal_test_cases.cpp39
3 files changed, 42 insertions, 17 deletions
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp
index 46d61e54e3..433f5cb4ea 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp
@@ -83,6 +83,7 @@ void GnssHalTest::StopAndClearLocations() {
*/
while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) {
}
+ location_called_count_ = 0;
}
void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) {
@@ -97,17 +98,17 @@ void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_po
EXPECT_TRUE(result);
}
-bool GnssHalTest::StartAndGetSingleLocation() {
+bool GnssHalTest::StartAndCheckFirstLocation() {
auto result = gnss_hal_->start();
EXPECT_TRUE(result.isOk());
EXPECT_TRUE(result);
/*
- * GPS signals initially optional for this test, so don't expect fast fix,
- * or no timeout, unless signal is present
+ * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS,
+ * so allow time to demodulate ephemeris over the air.
*/
- const int kFirstGnssLocationTimeoutSeconds = 15;
+ const int kFirstGnssLocationTimeoutSeconds = 75;
wait(kFirstGnssLocationTimeoutSeconds);
EXPECT_EQ(location_called_count_, 1);
@@ -195,7 +196,7 @@ void GnssHalTest::StartAndCheckLocations(int count) {
SetPositionMode(kMinIntervalMsec, kLowPowerMode);
- EXPECT_TRUE(StartAndGetSingleLocation());
+ EXPECT_TRUE(StartAndCheckFirstLocation());
for (int i = 1; i < count; i++) {
EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec));
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.h b/gnss/1.1/vts/functional/gnss_hal_test.h
index 269366a9b9..64478b5b1c 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.h
+++ b/gnss/1.1/vts/functional/gnss_hal_test.h
@@ -107,12 +107,15 @@ class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
void SetUpGnssCallback();
/*
- * StartAndGetSingleLocation:
- * Helper function to get one Location and check fields
+ * StartAndCheckFirstLocation:
+ * Helper function to start location, and check the first one.
+ *
+ * <p> Note this leaves the Location request active, to enable Stop call vs. other call
+ * reordering tests.
*
* returns true if a location was successfully generated
*/
- bool StartAndGetSingleLocation();
+ bool StartAndCheckFirstLocation();
/*
* CheckLocation:
diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
index 4ce87339c2..72e5e1416a 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
@@ -60,24 +60,46 @@ TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
*/
TEST_F(GnssHalTest, GetLocationLowPower) {
const int kMinIntervalMsec = 5000;
- const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) + 1;
- const int kNoLocationPeriodSec = 2;
+ const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2;
+ const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2;
const int kLocationsToCheck = 5;
const bool kLowPowerMode = true;
+ // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider
+ StartAndCheckLocations(5);
+ StopAndClearLocations();
+
+ // Start of Low Power Mode test
SetPositionMode(kMinIntervalMsec, kLowPowerMode);
- EXPECT_TRUE(StartAndGetSingleLocation());
+ // Don't expect true - as without AGPS access
+ if (!StartAndCheckFirstLocation()) {
+ ALOGW("GetLocationLowPower test - no first low power location received.");
+ }
for (int i = 1; i < kLocationsToCheck; i++) {
// Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and
// ensure that no location is received yet
+
wait(kNoLocationPeriodSec);
- EXPECT_EQ(location_called_count_, i);
- EXPECT_EQ(std::cv_status::no_timeout,
- wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec));
- EXPECT_EQ(location_called_count_, i + 1);
- CheckLocation(last_location_, true);
+ // Tolerate (ignore) one extra location right after the first one
+ // to handle startup edge case scheduling limitations in some implementations
+ if ((i == 1) && (location_called_count_ == 2)) {
+ CheckLocation(last_location_, true);
+ continue; // restart the quiet wait period after this too-fast location
+ }
+ EXPECT_LE(location_called_count_, i);
+ if (location_called_count_ != i) {
+ ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ",
+ location_called_count_, i);
+ }
+
+ if (std::cv_status::no_timeout !=
+ wait(kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) {
+ ALOGW("GetLocationLowPower test - timeout awaiting location %d", i);
+ } else {
+ CheckLocation(last_location_, true);
+ }
}
StopAndClearLocations();
@@ -238,7 +260,6 @@ TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
ASSERT_TRUE(result.isOk());
EXPECT_TRUE(result);
- location_called_count_ = 0;
StopAndClearLocations();
list_gnss_sv_status_.clear();