Snap for 4503844 from 863c52448ee3d218b03c585c4f1ee2fee2080a19 to oreo-vts-release
Change-Id: Id7563dc7584448795b1171d111cf00d0c35f14b9
diff --git a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 8ac8a29..3ee44f3 100644
--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -1057,27 +1057,34 @@
"InputStream::setGain");
}
-static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize,
- uint32_t framesCount) {
+static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, uint32_t framesCount,
+ bool allowSucceed) {
Result res;
- // Ignore output parameters as the call should fail
+ // Ignore output parameters.
ASSERT_OK(stream->prepareForReading(
frameSize, framesCount,
[&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
+ if (allowSucceed) {
+ auto status = {
+ Result::INVALID_ARGUMENTS, Result::OK,
+ };
+ EXPECT_RESULT(status, res);
+ } else {
+ EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
+ };
}
TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) {
doc::test(
"Preparing a stream for reading with a 0 sized buffer should fail");
- testPrepareForReading(stream.get(), 0, 0);
+ testPrepareForReading(stream.get(), 0, 0, false /*allowSucceed*/);
}
TEST_P(InputStreamTest, PrepareForReadingWithHugeBuffer) {
doc::test(
"Preparing a stream for reading with a 2^32 sized buffer should fail");
- testPrepareForReading(stream.get(), 1,
- std::numeric_limits<uint32_t>::max());
+ testPrepareForReading(stream.get(), 1, std::numeric_limits<uint32_t>::max(),
+ false /*allowSucceed*/);
}
TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) {
@@ -1085,7 +1092,8 @@
"Preparing a stream for reading with a overflowing sized buffer should "
"fail");
auto uintMax = std::numeric_limits<uint32_t>::max();
- testPrepareForReading(stream.get(), uintMax, uintMax);
+ // In O, the test fails for 32-bit HAL, and succeeds for 64-bit HAL.
+ testPrepareForReading(stream.get(), uintMax, uintMax, true /*allowSucceed*/);
}
TEST_P(InputStreamTest, GetInputFramesLost) {
@@ -1125,27 +1133,34 @@
"setVolume");
}
-static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize,
- uint32_t framesCount) {
+static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, uint32_t framesCount,
+ bool allowSucceed) {
Result res;
- // Ignore output parameters as the call should fail
+ // Ignore output parameters.
ASSERT_OK(stream->prepareForWriting(
frameSize, framesCount,
[&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
+ if (allowSucceed) {
+ auto status = {
+ Result::INVALID_ARGUMENTS, Result::OK,
+ };
+ EXPECT_RESULT(status, res);
+ } else {
+ EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
+ };
}
TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) {
doc::test(
"Preparing a stream for writing with a 0 sized buffer should fail");
- testPrepareForWriting(stream.get(), 0, 0);
+ testPrepareForWriting(stream.get(), 0, 0, false /*allowSucceed*/);
}
TEST_P(OutputStreamTest, PrepareForWriteWithHugeBuffer) {
doc::test(
"Preparing a stream for writing with a 2^32 sized buffer should fail");
- testPrepareForWriting(stream.get(), 1,
- std::numeric_limits<uint32_t>::max());
+ testPrepareForWriting(stream.get(), 1, std::numeric_limits<uint32_t>::max(),
+ false /*allowSucceed*/);
}
TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) {
@@ -1153,7 +1168,8 @@
"Preparing a stream for writing with a overflowing sized buffer should "
"fail");
auto uintMax = std::numeric_limits<uint32_t>::max();
- testPrepareForWriting(stream.get(), uintMax, uintMax);
+ // In O, the test fails for 32-bit HAL, and succeeds for 64-bit HAL.
+ testPrepareForWriting(stream.get(), uintMax, uintMax, true /*allowSucceed*/);
}
struct Capability {
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 5d4e7d0..33fb6fb 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -129,7 +129,7 @@
// Do the same for the crypto factory
cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name);
if (cryptoFactory == nullptr) {
- cryptoFactory = VtsTestBase::getService<ICryptoFactory>();
+ VtsTestBase::getService<ICryptoFactory>();
}
ASSERT_NE(cryptoFactory, nullptr);
diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp
index 33cf84c..68aede2 100644
--- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp
+++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp
@@ -290,6 +290,11 @@
: IComposerClient::Vsync::DISABLE;
Error error = mClient->setVsyncEnabled(display, vsync);
ASSERT_EQ(Error::NONE, error) << "failed to set vsync mode";
+
+ // give the hwbinder thread some time to handle any pending vsync callback
+ if (!enabled) {
+ usleep(5 * 1000);
+ }
}
} // namespace tests
diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp
index 387222f..4261d00 100644
--- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp
+++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp
@@ -118,7 +118,7 @@
// the set of all currently connected displays
std::unordered_set<Display> mDisplays;
// true only when vsync is enabled
- bool mVsyncAllowed = false;
+ bool mVsyncAllowed = true;
// track invalid callbacks
int mInvalidHotplugCount = 0;
@@ -137,6 +137,10 @@
// assume the first display is primary and is never removed
mPrimaryDisplay = waitForFirstDisplay();
+
+ // explicitly disable vsync
+ mComposerClient->setVsyncEnabled(mPrimaryDisplay, false);
+ mComposerCallback->setVsyncAllowed(false);
}
void TearDown() override {
diff --git a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
index a017404..3dad3c1 100644
--- a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
+++ b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
@@ -59,7 +59,7 @@
uint32_t len = 16;
hidl_vec<int32_t> vec;
vec.resize(len);
- std::fill(vec.begin(), vec.end(), 1000);
+ std::fill(vec.begin(), vec.end(), 1);
for (auto range = ranges.begin(); range != ranges.end(); range++) {
EXPECT_TRUE(ir->transmit(range->min, vec));
EXPECT_TRUE(ir->transmit(range->max, vec));
@@ -74,6 +74,7 @@
vec.resize(len);
std::fill(vec.begin(), vec.end(), 1);
EXPECT_FALSE(ir->transmit(-1, vec));
+ EXPECT_FALSE(ir->transmit(0, vec));
}
int main(int argc, char **argv) {
diff --git a/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp b/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
index c94fa4f..da49dfc 100644
--- a/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
+++ b/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
@@ -77,6 +77,7 @@
if (fd1 < 0 || fd2 < 0) {
// Files don't exist, so skip the rest of the test case
SUCCEED();
+ return;
}
char old_governor[80];
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index 2cf4ef9..51d7645 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -1180,16 +1180,17 @@
usleep(batchingPeriodInNs / 1000 * 8 / 10);
SensorsHidlEnvironment::Instance()->setCollection(true);
- // 0.8 + 0.3 times the batching period
- // plus some time for the event to deliver
- events = collectEvents(
- batchingPeriodInNs / 1000 * 3 / 10,
- minFifoCount, true /*clearBeforeStart*/, false /*change collection*/);
+ // clean existing collections
+ collectEvents(0 /*timeLimitUs*/, 0/*nEventLimit*/,
+ true /*clearBeforeStart*/, false /*change collection*/);
+ // 0.8 + 0.2 times the batching period
+ usleep(batchingPeriodInNs / 1000 * 8 / 10);
ASSERT_EQ(flush(handle), Result::OK);
+ // plus some time for the event to deliver
events = collectEvents(allowedBatchDeliverTimeNs / 1000,
- minFifoCount, true /*clearBeforeStart*/, false /*change collection*/);
+ minFifoCount, false /*clearBeforeStart*/, false /*change collection*/);
SensorsHidlEnvironment::Instance()->setCollection(false);
ASSERT_EQ(activate(handle, 0), Result::OK);
@@ -1202,7 +1203,7 @@
}
// at least reach 90% of advertised capacity
- ASSERT_GT(nEvent, (size_t)(batchingPeriodInNs / minSamplingPeriodInNs * 9 / 10));
+ ASSERT_GT(nEvent, (size_t)(minFifoCount * 9 / 10));
}
// Test if sensor hal can do accelerometer batching properly
@@ -1223,7 +1224,7 @@
void SensorsHidlTest::testDirectReportOperation(
SensorType type, SharedMemType memType, RateLevel rate, const SensorEventsChecker &checker) {
constexpr size_t kEventSize = static_cast<size_t>(SensorsEventFormatOffset::TOTAL_LENGTH);
- constexpr size_t kNEvent = 500;
+ constexpr size_t kNEvent = 4096;
constexpr size_t kMemSize = kEventSize * kNEvent;
constexpr float kNormalNominal = 50;