summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2021-11-18 00:30:46 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-11-18 00:30:46 +0000
commit261a78c60bc1e88f4bbbb6dbc1ac5c851e5fc0e1 (patch)
treedd6725cd3e27d07ea75d46d5f20c0a776303a1e7
parent527a18084c6b994d880623d227c0bcc67247fb3b (diff)
parent45d5b5372eb10f42e875d02123fea8c264805a32 (diff)
downloadlibfmq-261a78c60bc1e88f4bbbb6dbc1ac5c851e5fc0e1.tar.gz
Added an example of @FixedSize union am: 75253c2507 am: 45d5b5372e
Original change: https://android-review.googlesource.com/c/platform/system/libfmq/+/1893915 Change-Id: I0d9cb2b3d9a27d40c82214d7db365339bcb21f12
-rw-r--r--tests/aidl/android/fmq/test/FixedParcelable.aidl2
-rw-r--r--tests/aidl/android/fmq/test/FixedUnion.aidl25
-rw-r--r--tests/msgq_test_client.cpp6
3 files changed, 31 insertions, 2 deletions
diff --git a/tests/aidl/android/fmq/test/FixedParcelable.aidl b/tests/aidl/android/fmq/test/FixedParcelable.aidl
index acb54f2..7d0c0e5 100644
--- a/tests/aidl/android/fmq/test/FixedParcelable.aidl
+++ b/tests/aidl/android/fmq/test/FixedParcelable.aidl
@@ -17,9 +17,11 @@
package android.fmq.test;
import android.fmq.test.EventFlagBits;
+import android.fmq.test.FixedUnion;
@FixedSize
parcelable FixedParcelable {
int a;
EventFlagBits b;
+ FixedUnion u;
}
diff --git a/tests/aidl/android/fmq/test/FixedUnion.aidl b/tests/aidl/android/fmq/test/FixedUnion.aidl
new file mode 100644
index 0000000..40a4a28
--- /dev/null
+++ b/tests/aidl/android/fmq/test/FixedUnion.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.fmq.test;
+
+import android.fmq.test.EventFlagBits;
+
+@FixedSize
+union FixedUnion {
+ int a;
+ EventFlagBits b;
+}
diff --git a/tests/msgq_test_client.cpp b/tests/msgq_test_client.cpp
index a6f1ccc..1ff9d50 100644
--- a/tests/msgq_test_client.cpp
+++ b/tests/msgq_test_client.cpp
@@ -20,6 +20,7 @@
#endif
#include <aidl/android/fmq/test/FixedParcelable.h>
+#include <aidl/android/fmq/test/FixedUnion.h>
#include <aidl/android/fmq/test/ITestAidlMsgQ.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@@ -38,6 +39,7 @@ using android::status_t;
// generated
using ::aidl::android::fmq::test::EventFlagBits;
using ::aidl::android::fmq::test::FixedParcelable;
+using ::aidl::android::fmq::test::FixedUnion;
using ::aidl::android::fmq::test::ITestAidlMsgQ;
using android::hardware::tests::msgq::V1_0::ITestMsgQ;
@@ -1169,8 +1171,8 @@ TYPED_TEST(UnsynchronizedWriteClient, OverflowNotificationTest) {
* annotated with @FixedSize is supported. A parcelable without it, will cause
* a compilation error.
*/
-typedef ::testing::Types<FixedParcelable, EventFlagBits, bool, int8_t, char, char16_t, int32_t,
- int64_t, float, double>
+typedef ::testing::Types<FixedParcelable, FixedUnion, EventFlagBits, bool, int8_t, char, char16_t,
+ int32_t, int64_t, float, double>
AidlTypeCheckTypes;
template <typename T>