Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-interfaces: Commit

hardware/interfaces


Commit MetaInfo

Révision5b122a7408df97b0dbd4316cdfead1712c7acb0e (tree)
l'heure2017-10-11 10:33:25
AuteurMikhail Naganov <mnaganov@goog...>
Commiterandroid-build-merger

Message de Log

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

Change-Id: I6869d49ab5ceb12e1b0d3e50e0952094c34b3c07

Change Summary

Modification

--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -1004,27 +1004,34 @@ TEST_P(InputStreamTest, SetGain) {
10041004 "InputStream::setGain");
10051005 }
10061006
1007-static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize,
1008- uint32_t framesCount) {
1007+static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, uint32_t framesCount,
1008+ bool allowSucceed) {
10091009 Result res;
1010- // Ignore output parameters as the call should fail
1010+ // Ignore output parameters.
10111011 ASSERT_OK(stream->prepareForReading(
10121012 frameSize, framesCount,
10131013 [&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
1014- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1014+ if (allowSucceed) {
1015+ auto status = {
1016+ Result::INVALID_ARGUMENTS, Result::OK,
1017+ };
1018+ EXPECT_RESULT(status, res);
1019+ } else {
1020+ EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1021+ };
10151022 }
10161023
10171024 TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) {
10181025 doc::test(
10191026 "Preparing a stream for reading with a 0 sized buffer should fail");
1020- testPrepareForReading(stream.get(), 0, 0);
1027+ testPrepareForReading(stream.get(), 0, 0, false /*allowSucceed*/);
10211028 }
10221029
10231030 TEST_P(InputStreamTest, PrepareForReadingWithHugeBuffer) {
10241031 doc::test(
10251032 "Preparing a stream for reading with a 2^32 sized buffer should fail");
1026- testPrepareForReading(stream.get(), 1,
1027- std::numeric_limits<uint32_t>::max());
1033+ testPrepareForReading(stream.get(), 1, std::numeric_limits<uint32_t>::max(),
1034+ false /*allowSucceed*/);
10281035 }
10291036
10301037 TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) {
@@ -1032,7 +1039,8 @@ TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) {
10321039 "Preparing a stream for reading with a overflowing sized buffer should "
10331040 "fail");
10341041 auto uintMax = std::numeric_limits<uint32_t>::max();
1035- testPrepareForReading(stream.get(), uintMax, uintMax);
1042+ // In O, the test fails for 32-bit HAL, and succeeds for 64-bit HAL.
1043+ testPrepareForReading(stream.get(), uintMax, uintMax, true /*allowSucceed*/);
10361044 }
10371045
10381046 TEST_P(InputStreamTest, GetInputFramesLost) {
@@ -1072,27 +1080,34 @@ TEST_P(OutputStreamTest, setVolume) {
10721080 "setVolume");
10731081 }
10741082
1075-static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize,
1076- uint32_t framesCount) {
1083+static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, uint32_t framesCount,
1084+ bool allowSucceed) {
10771085 Result res;
1078- // Ignore output parameters as the call should fail
1086+ // Ignore output parameters.
10791087 ASSERT_OK(stream->prepareForWriting(
10801088 frameSize, framesCount,
10811089 [&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
1082- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1090+ if (allowSucceed) {
1091+ auto status = {
1092+ Result::INVALID_ARGUMENTS, Result::OK,
1093+ };
1094+ EXPECT_RESULT(status, res);
1095+ } else {
1096+ EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
1097+ };
10831098 }
10841099
10851100 TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) {
10861101 doc::test(
10871102 "Preparing a stream for writing with a 0 sized buffer should fail");
1088- testPrepareForWriting(stream.get(), 0, 0);
1103+ testPrepareForWriting(stream.get(), 0, 0, false /*allowSucceed*/);
10891104 }
10901105
10911106 TEST_P(OutputStreamTest, PrepareForWriteWithHugeBuffer) {
10921107 doc::test(
10931108 "Preparing a stream for writing with a 2^32 sized buffer should fail");
1094- testPrepareForWriting(stream.get(), 1,
1095- std::numeric_limits<uint32_t>::max());
1109+ testPrepareForWriting(stream.get(), 1, std::numeric_limits<uint32_t>::max(),
1110+ false /*allowSucceed*/);
10961111 }
10971112
10981113 TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) {
@@ -1100,7 +1115,8 @@ TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) {
11001115 "Preparing a stream for writing with a overflowing sized buffer should "
11011116 "fail");
11021117 auto uintMax = std::numeric_limits<uint32_t>::max();
1103- testPrepareForWriting(stream.get(), uintMax, uintMax);
1118+ // In O, the test fails for 32-bit HAL, and succeeds for 64-bit HAL.
1119+ testPrepareForWriting(stream.get(), uintMax, uintMax, true /*allowSucceed*/);
11041120 }
11051121
11061122 struct Capability {
Afficher sur ancien navigateur de dépôt.