From aaa67596dff0833f124bd111da746e39c5c5bcec Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 31 Oct 2017 12:54:27 -0700 Subject: [PATCH] Adds test cases to stress marshaling of primitive array types and vectors of thereof. Bug: 68654583 Test: hidl_test_java Change-Id: Id498fe9b1e153512be294c39aff783f7d0600219 --- tests/baz/1.0/IBase.hal | 29 +++++++++++++++++++++++++++++ tests/baz/1.0/default/Baz.cpp | 28 ++++++++++++++++++++++++++++ tests/baz/1.0/default/Baz.h | 16 ++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/tests/baz/1.0/IBase.hal b/tests/baz/1.0/IBase.hal index 97b2db4022..0c1b61f7d0 100644 --- a/tests/baz/1.0/IBase.hal +++ b/tests/baz/1.0/IBase.hal @@ -77,6 +77,30 @@ interface IBase { typedef bitfield Mask; + typedef uint8_t[128] ByteOneDim; + typedef uint8_t[8][128] ByteTwoDim; + typedef uint8_t[8][16][128] ByteThreeDim; + + typedef bool[128] BooleanOneDim; + typedef bool[8][128] BooleanTwoDim; + typedef bool[8][16][128] BooleanThreeDim; + + typedef double[128] DoubleOneDim; + typedef double[8][128] DoubleTwoDim; + typedef double[8][16][128] DoubleThreeDim; + + struct LotsOfPrimitiveArrays { + ByteOneDim byte1; + ByteTwoDim byte2; + ByteThreeDim byte3; + BooleanOneDim boolean1; + BooleanTwoDim boolean2; + BooleanThreeDim boolean3; + DoubleOneDim double1; + DoubleTwoDim double2; + DoubleThreeDim double3; + }; + someBaseMethod(); someBoolMethod(bool x) generates (bool y); @@ -97,4 +121,9 @@ interface IBase { takeAMask(BitField bf, bitfield first, MyMask second, Mask third) generates (BitField out, uint8_t f, uint8_t s, uint8_t t); + + testArrays(LotsOfPrimitiveArrays in) generates (LotsOfPrimitiveArrays out); + testByteVecs(vec in) generates (vec out); + testBooleanVecs(vec in) generates (vec out); + testDoubleVecs(vec in) generates (vec out); }; diff --git a/tests/baz/1.0/default/Baz.cpp b/tests/baz/1.0/default/Baz.cpp index 875fe65287..5ccd87b441 100644 --- a/tests/baz/1.0/default/Baz.cpp +++ b/tests/baz/1.0/default/Baz.cpp @@ -199,6 +199,34 @@ Return Baz::takeAMask(IBase::BitField bf, return Void(); } +Return Baz::testArrays( + const IBase::LotsOfPrimitiveArrays &in, + testArrays_cb _hidl_cb) { + _hidl_cb(in); + return Void(); +} + +Return Baz::testByteVecs( + const hidl_vec &in, + testByteVecs_cb _hidl_cb) { + _hidl_cb(in); + return Void(); +} + +Return Baz::testBooleanVecs( + const hidl_vec &in, + testBooleanVecs_cb _hidl_cb) { + _hidl_cb(in); + return Void(); +} + +Return Baz::testDoubleVecs( + const hidl_vec &in, + testDoubleVecs_cb _hidl_cb) { + _hidl_cb(in); + return Void(); +} + // Methods from ::android::hardware::tests::baz::V1_0::IBaz follow. Return Baz::doThis(float param) { diff --git a/tests/baz/1.0/default/Baz.h b/tests/baz/1.0/default/Baz.h index ceb3035ca0..4443587b26 100644 --- a/tests/baz/1.0/default/Baz.h +++ b/tests/baz/1.0/default/Baz.h @@ -53,6 +53,22 @@ struct Baz : public IBaz { uint8_t third, takeAMask_cb _hidl_cb) override; + Return testArrays( + const IBase::LotsOfPrimitiveArrays &in, + testArrays_cb _hidl_cb) override; + + Return testByteVecs( + const hidl_vec &in, + testByteVecs_cb _hidl_cb) override; + + Return testBooleanVecs( + const hidl_vec &in, + testBooleanVecs_cb _hidl_cb) override; + + Return testDoubleVecs( + const hidl_vec &in, + testDoubleVecs_cb _hidl_cb) override; + // Methods from ::android::hardware::tests::baz::V1_0::IBaz follow. Return doThis(float param) override; Return doThatAndReturnSomething(int64_t param) override;