Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-interfaces: Commit

hardware/interfaces


Commit MetaInfo

Révisionce607879baf84d5b3a8df95a609ad06204c56711 (tree)
l'heure2017-10-11 06:30:00
AuteurMikhail Naganov <mnaganov@goog...>
CommiterMikhail Naganov

Message de Log

Audio VTS: Allow 4GB buffer prepareToWrite/Read to succeed on 64 bits

Because on oc-dev the runtime image can not be modified and that this is
not a bug but a test and implementation misalignment,
allow prepareForWrite/Read(UINT32_MAX, UINT32_MAX) to succeed on oc-dev.

MR1 will have a better fix where the HAL will always reject > 1GiB
buffers independently of the architecture.

Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Bug: 67030516
Change-Id: I10a5ee3868c67c45ed5297d9c5c89129d762c7cd
Merged-In: I4cc3efda9bb66e6dae8b4e6785f52d9e51440aee
Signed-off-by: Kevin Rocard <krocard@google.com>

Change Summary

Modification

--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -1057,27 +1057,34 @@ TEST_P(InputStreamTest, SetGain) {
10571057 "InputStream::setGain");
10581058 }
10591059
1060-static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize,
1061- uint32_t framesCount) {
1060+static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, uint32_t framesCount,
1061+ bool allowSucceed) {
10621062 Result res;
1063- // Ignore output parameters as the call should fail
1063+ // Ignore output parameters.
10641064 ASSERT_OK(stream->prepareForReading(
10651065 frameSize, framesCount,
10661066 [&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
1067- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1067+ if (allowSucceed) {
1068+ auto status = {
1069+ Result::INVALID_ARGUMENTS, Result::OK,
1070+ };
1071+ EXPECT_RESULT(status, res);
1072+ } else {
1073+ EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1074+ };
10681075 }
10691076
10701077 TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) {
10711078 doc::test(
10721079 "Preparing a stream for reading with a 0 sized buffer should fail");
1073- testPrepareForReading(stream.get(), 0, 0);
1080+ testPrepareForReading(stream.get(), 0, 0, false /*allowSucceed*/);
10741081 }
10751082
10761083 TEST_P(InputStreamTest, PrepareForReadingWithHugeBuffer) {
10771084 doc::test(
10781085 "Preparing a stream for reading with a 2^32 sized buffer should fail");
1079- testPrepareForReading(stream.get(), 1,
1080- std::numeric_limits<uint32_t>::max());
1086+ testPrepareForReading(stream.get(), 1, std::numeric_limits<uint32_t>::max(),
1087+ false /*allowSucceed*/);
10811088 }
10821089
10831090 TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) {
@@ -1085,7 +1092,8 @@ TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) {
10851092 "Preparing a stream for reading with a overflowing sized buffer should "
10861093 "fail");
10871094 auto uintMax = std::numeric_limits<uint32_t>::max();
1088- testPrepareForReading(stream.get(), uintMax, uintMax);
1095+ // In O, the test fails for 32-bit HAL, and succeeds for 64-bit HAL.
1096+ testPrepareForReading(stream.get(), uintMax, uintMax, true /*allowSucceed*/);
10891097 }
10901098
10911099 TEST_P(InputStreamTest, GetInputFramesLost) {
@@ -1125,27 +1133,34 @@ TEST_P(OutputStreamTest, setVolume) {
11251133 "setVolume");
11261134 }
11271135
1128-static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize,
1129- uint32_t framesCount) {
1136+static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, uint32_t framesCount,
1137+ bool allowSucceed) {
11301138 Result res;
1131- // Ignore output parameters as the call should fail
1139+ // Ignore output parameters.
11321140 ASSERT_OK(stream->prepareForWriting(
11331141 frameSize, framesCount,
11341142 [&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
1135- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1143+ if (allowSucceed) {
1144+ auto status = {
1145+ Result::INVALID_ARGUMENTS, Result::OK,
1146+ };
1147+ EXPECT_RESULT(status, res);
1148+ } else {
1149+ EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1150+ };
11361151 }
11371152
11381153 TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) {
11391154 doc::test(
11401155 "Preparing a stream for writing with a 0 sized buffer should fail");
1141- testPrepareForWriting(stream.get(), 0, 0);
1156+ testPrepareForWriting(stream.get(), 0, 0, false /*allowSucceed*/);
11421157 }
11431158
11441159 TEST_P(OutputStreamTest, PrepareForWriteWithHugeBuffer) {
11451160 doc::test(
11461161 "Preparing a stream for writing with a 2^32 sized buffer should fail");
1147- testPrepareForWriting(stream.get(), 1,
1148- std::numeric_limits<uint32_t>::max());
1162+ testPrepareForWriting(stream.get(), 1, std::numeric_limits<uint32_t>::max(),
1163+ false /*allowSucceed*/);
11491164 }
11501165
11511166 TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) {
@@ -1153,7 +1168,8 @@ TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) {
11531168 "Preparing a stream for writing with a overflowing sized buffer should "
11541169 "fail");
11551170 auto uintMax = std::numeric_limits<uint32_t>::max();
1156- testPrepareForWriting(stream.get(), uintMax, uintMax);
1171+ // In O, the test fails for 32-bit HAL, and succeeds for 64-bit HAL.
1172+ testPrepareForWriting(stream.get(), uintMax, uintMax, true /*allowSucceed*/);
11571173 }
11581174
11591175 struct Capability {
Afficher sur ancien navigateur de dépôt.