diff options
author | Andreas Huber | 2017-10-31 14:54:27 -0500 |
---|---|---|
committer | Andreas Huber | 2017-10-31 15:03:56 -0500 |
commit | aaa67596dff0833f124bd111da746e39c5c5bcec (patch) | |
tree | a8f364c561bf51aa88b351dcd54e322cb4053914 /tests | |
parent | 6a70875ba81a3683dbf537a97c1a152df315aeee (diff) | |
download | platform-hardware-interfaces-aaa67596dff0833f124bd111da746e39c5c5bcec.tar.gz platform-hardware-interfaces-aaa67596dff0833f124bd111da746e39c5c5bcec.tar.xz platform-hardware-interfaces-aaa67596dff0833f124bd111da746e39c5c5bcec.zip |
Adds test cases to stress marshaling of primitive array types and
vectors of thereof.
Bug: 68654583
Test: hidl_test_java
Change-Id: Id498fe9b1e153512be294c39aff783f7d0600219
Diffstat (limited to 'tests')
-rw-r--r-- | tests/baz/1.0/IBase.hal | 29 | ||||
-rw-r--r-- | tests/baz/1.0/default/Baz.cpp | 28 | ||||
-rw-r--r-- | tests/baz/1.0/default/Baz.h | 16 |
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/baz/1.0/IBase.hal b/tests/baz/1.0/IBase.hal index 97b2db40..0c1b61f7 100644 --- a/tests/baz/1.0/IBase.hal +++ b/tests/baz/1.0/IBase.hal | |||
@@ -77,6 +77,30 @@ interface IBase { | |||
77 | 77 | ||
78 | typedef bitfield<BitField> Mask; | 78 | typedef bitfield<BitField> Mask; |
79 | 79 | ||
80 | typedef uint8_t[128] ByteOneDim; | ||
81 | typedef uint8_t[8][128] ByteTwoDim; | ||
82 | typedef uint8_t[8][16][128] ByteThreeDim; | ||
83 | |||
84 | typedef bool[128] BooleanOneDim; | ||
85 | typedef bool[8][128] BooleanTwoDim; | ||
86 | typedef bool[8][16][128] BooleanThreeDim; | ||
87 | |||
88 | typedef double[128] DoubleOneDim; | ||
89 | typedef double[8][128] DoubleTwoDim; | ||
90 | typedef double[8][16][128] DoubleThreeDim; | ||
91 | |||
92 | struct LotsOfPrimitiveArrays { | ||
93 | ByteOneDim byte1; | ||
94 | ByteTwoDim byte2; | ||
95 | ByteThreeDim byte3; | ||
96 | BooleanOneDim boolean1; | ||
97 | BooleanTwoDim boolean2; | ||
98 | BooleanThreeDim boolean3; | ||
99 | DoubleOneDim double1; | ||
100 | DoubleTwoDim double2; | ||
101 | DoubleThreeDim double3; | ||
102 | }; | ||
103 | |||
80 | someBaseMethod(); | 104 | someBaseMethod(); |
81 | 105 | ||
82 | someBoolMethod(bool x) generates (bool y); | 106 | someBoolMethod(bool x) generates (bool y); |
@@ -97,4 +121,9 @@ interface IBase { | |||
97 | 121 | ||
98 | takeAMask(BitField bf, bitfield<BitField> first, MyMask second, Mask third) | 122 | takeAMask(BitField bf, bitfield<BitField> first, MyMask second, Mask third) |
99 | generates (BitField out, uint8_t f, uint8_t s, uint8_t t); | 123 | generates (BitField out, uint8_t f, uint8_t s, uint8_t t); |
124 | |||
125 | testArrays(LotsOfPrimitiveArrays in) generates (LotsOfPrimitiveArrays out); | ||
126 | testByteVecs(vec<ByteOneDim> in) generates (vec<ByteOneDim> out); | ||
127 | testBooleanVecs(vec<BooleanOneDim> in) generates (vec<BooleanOneDim> out); | ||
128 | testDoubleVecs(vec<DoubleOneDim> in) generates (vec<DoubleOneDim> out); | ||
100 | }; | 129 | }; |
diff --git a/tests/baz/1.0/default/Baz.cpp b/tests/baz/1.0/default/Baz.cpp index 875fe652..5ccd87b4 100644 --- a/tests/baz/1.0/default/Baz.cpp +++ b/tests/baz/1.0/default/Baz.cpp | |||
@@ -199,6 +199,34 @@ Return<void> Baz::takeAMask(IBase::BitField bf, | |||
199 | return Void(); | 199 | return Void(); |
200 | } | 200 | } |
201 | 201 | ||
202 | Return<void> Baz::testArrays( | ||
203 | const IBase::LotsOfPrimitiveArrays &in, | ||
204 | testArrays_cb _hidl_cb) { | ||
205 | _hidl_cb(in); | ||
206 | return Void(); | ||
207 | } | ||
208 | |||
209 | Return<void> Baz::testByteVecs( | ||
210 | const hidl_vec<IBase::ByteOneDim> &in, | ||
211 | testByteVecs_cb _hidl_cb) { | ||
212 | _hidl_cb(in); | ||
213 | return Void(); | ||
214 | } | ||
215 | |||
216 | Return<void> Baz::testBooleanVecs( | ||
217 | const hidl_vec<IBase::BooleanOneDim> &in, | ||
218 | testBooleanVecs_cb _hidl_cb) { | ||
219 | _hidl_cb(in); | ||
220 | return Void(); | ||
221 | } | ||
222 | |||
223 | Return<void> Baz::testDoubleVecs( | ||
224 | const hidl_vec<IBase::DoubleOneDim> &in, | ||
225 | testDoubleVecs_cb _hidl_cb) { | ||
226 | _hidl_cb(in); | ||
227 | return Void(); | ||
228 | } | ||
229 | |||
202 | // Methods from ::android::hardware::tests::baz::V1_0::IBaz follow. | 230 | // Methods from ::android::hardware::tests::baz::V1_0::IBaz follow. |
203 | 231 | ||
204 | Return<void> Baz::doThis(float param) { | 232 | Return<void> Baz::doThis(float param) { |
diff --git a/tests/baz/1.0/default/Baz.h b/tests/baz/1.0/default/Baz.h index ceb3035c..4443587b 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 { | |||
53 | uint8_t third, | 53 | uint8_t third, |
54 | takeAMask_cb _hidl_cb) override; | 54 | takeAMask_cb _hidl_cb) override; |
55 | 55 | ||
56 | Return<void> testArrays( | ||
57 | const IBase::LotsOfPrimitiveArrays &in, | ||
58 | testArrays_cb _hidl_cb) override; | ||
59 | |||
60 | Return<void> testByteVecs( | ||
61 | const hidl_vec<IBase::ByteOneDim> &in, | ||
62 | testByteVecs_cb _hidl_cb) override; | ||
63 | |||
64 | Return<void> testBooleanVecs( | ||
65 | const hidl_vec<IBase::BooleanOneDim> &in, | ||
66 | testBooleanVecs_cb _hidl_cb) override; | ||
67 | |||
68 | Return<void> testDoubleVecs( | ||
69 | const hidl_vec<IBase::DoubleOneDim> &in, | ||
70 | testDoubleVecs_cb _hidl_cb) override; | ||
71 | |||
56 | // Methods from ::android::hardware::tests::baz::V1_0::IBaz follow. | 72 | // Methods from ::android::hardware::tests::baz::V1_0::IBaz follow. |
57 | Return<void> doThis(float param) override; | 73 | Return<void> doThis(float param) override; |
58 | Return<int32_t> doThatAndReturnSomething(int64_t param) override; | 74 | Return<int32_t> doThatAndReturnSomething(int64_t param) override; |