Add metadata to modules in system/libfmq
am: ef477dd676
Change-Id: I2308aebb69489516dfba79050dbf1635e015c9af
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..9b3f9d9
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2017 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.
+#
+
+BasedOnStyle: Google
+CommentPragmas: NOLINT:.*
+DerivePointerAlignment: false
+AllowShortFunctionsOnASingleLine: Inline
+ColumnLimit: 100
+TabWidth: 4
+UseTab: Never
+IndentWidth: 4
diff --git a/Android.bp b/Android.bp
index 4636f2b..de2b6ac 100644
--- a/Android.bp
+++ b/Android.bp
@@ -36,4 +36,7 @@
"-Werror",
],
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
}
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..d19e4ea
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,4 @@
+smoreland@google.com
+elsk@google.com
+malchev@google.com
+hridya@google.com
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
new file mode 100644
index 0000000..213c93a
--- /dev/null
+++ b/PREUPLOAD.cfg
@@ -0,0 +1,5 @@
+[Options]
+ignore_merged_commits = true
+
+[Builtin Hooks]
+clang_format = true
diff --git a/benchmarks/msgq_benchmark_client.cpp b/benchmarks/msgq_benchmark_client.cpp
index e67f1cf..6abbe3b 100644
--- a/benchmarks/msgq_benchmark_client.cpp
+++ b/benchmarks/msgq_benchmark_client.cpp
@@ -23,6 +23,7 @@
#include <android/hardware/tests/msgq/1.0/IBenchmarkMsgQ.h>
#include <fmq/MessageQueue.h>
+#include <hidl/ServiceManagement.h>
// libutils:
using android::OK;
@@ -39,6 +40,7 @@
using android::hardware::kSynchronizedReadWrite;
using android::hardware::MQDescriptorSync;
using android::hardware::MessageQueue;
+using android::hardware::details::waitForHwService;
/*
* All the benchmark cases will be performed on an FMQ of size kQueueSize.
@@ -69,6 +71,9 @@
}
virtual void SetUp() {
+ // waitForHwService is required because IBenchmarkMsgQ is not in manifest.xml.
+ // "Real" HALs shouldn't be doing this.
+ waitForHwService(IBenchmarkMsgQ::descriptor, "default");
service = IBenchmarkMsgQ::getService();
ASSERT_NE(service, nullptr);
ASSERT_TRUE(service->isRemote());
diff --git a/tests/Android.mk b/tests/Android.mk
index 2d3bd31..673d485 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -68,4 +68,4 @@
LOCAL_MODULE := VtsFmqUnitTests
VTS_CONFIG_SRC_DIR := system/libfmq/tests
-include test/vts/tools/build/Android.host_config.mk
+-include test/vts/tools/build/Android.host_config.mk
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
index c35b089..adf8b02 100644
--- a/tests/AndroidTest.xml
+++ b/tests/AndroidTest.xml
@@ -24,11 +24,19 @@
<option name="push" value="DATA/nativetest64/mq_test_client/mq_test_client->/data/nativetest64/mq_test_client/mq_test_client" />
<option name="push" value="DATA/nativetest64/hidl_test_helper->/data/nativetest64/hidl_test_helper" />
<option name="push" value="DATA/nativetest64/fmq_test->/data/nativetest64/fmq_test" />
+ <option name="push" value="DATA/lib/android.hardware.tests.msgq@1.0.so->/data/local/tmp/system/lib/android.hardware.tests.msgq@1.0.so" />
+ <option name="push" value="DATA/lib64/android.hardware.tests.msgq@1.0.so->/data/local/tmp/system/lib64/android.hardware.tests.msgq@1.0.so" />
+ <option name="push" value="DATA/lib/hw/android.hardware.tests.msgq@1.0-impl.so->/data/local/tmp/system/lib/hw/android.hardware.tests.msgq@1.0-impl.so" />
+ <option name="push" value="DATA/lib64/hw/android.hardware.tests.msgq@1.0-impl.so->/data/local/tmp/system/lib64/hw/android.hardware.tests.msgq@1.0-impl.so" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="VtsFmqUnitTests" />
- <option name="binary-test-type" value="binary_test" />
- <option name="binary-test-source" value="DATA/nativetest64/fmq_test->/data/nativetest64/fmq_test" />
+ <option name="test-module-name" value="VtsFmqUnitTests" />
+ <option name="binary-test-type" value="binary_test" />
+ <option name="binary-test-source" value="DATA/nativetest64/fmq_test->/data/nativetest64/fmq_test" />
+ <option name="binary-test-envp" value="TREBLE_TESTING_OVERRIDE=true" />
+ <option name="binary-test-envp" value="VTS_ROOT_PATH=/data/local/tmp" />
+ <option name="binary-test-args" value="-x /data/local/tmp/system/lib" />
+ <option name="binary-test-args" value="-y /data/local/tmp/system/lib64" />
</test>
</configuration>
diff --git a/tests/fmq_test b/tests/fmq_test
index 7c5bfbe..02683c9 100644
--- a/tests/fmq_test
+++ b/tests/fmq_test
@@ -1,6 +1,6 @@
source /data/nativetest64/hidl_test_helper
-run_all_tests \
+TREBLE_TESTING_OVERRIDE=true run_all_tests \
"/data/nativetest/android.hardware.tests.msgq@1.0-service-test/android.hardware.tests.msgq@1.0-service-test" \
"/data/nativetest64/android.hardware.tests.msgq@1.0-service-test/android.hardware.tests.msgq@1.0-service-test" \
"/data/nativetest/mq_test_client/mq_test_client" \
diff --git a/tests/msgq_test_client.cpp b/tests/msgq_test_client.cpp
index c15035b..4416c54 100644
--- a/tests/msgq_test_client.cpp
+++ b/tests/msgq_test_client.cpp
@@ -19,9 +19,10 @@
#error "GTest did not detect pthread library."
#endif
-#include <fmq/MessageQueue.h>
#include <android/hardware/tests/msgq/1.0/ITestMsgQ.h>
#include <fmq/EventFlag.h>
+#include <fmq/MessageQueue.h>
+#include <hidl/ServiceManagement.h>
// libutils:
using android::OK;
@@ -37,23 +38,30 @@
using android::hardware::MessageQueue;
using android::hardware::MQDescriptorSync;
using android::hardware::MQDescriptorUnsync;
+using android::hardware::details::waitForHwService;
typedef MessageQueue<uint16_t, kSynchronizedReadWrite> MessageQueueSync;
typedef MessageQueue<uint16_t, kUnsynchronizedWrite> MessageQueueUnsync;
+static sp<ITestMsgQ> waitGetTestService() {
+ // waitForHwService is required because ITestMsgQ is not in manifest.xml.
+ // "Real" HALs shouldn't be doing this.
+ waitForHwService(ITestMsgQ::descriptor, "default");
+ return ITestMsgQ::getService();
+}
+
class UnsynchronizedWriteClientMultiProcess : public ::testing::Test {
-protected:
- void getQueue(MessageQueueUnsync** fmq, sp<ITestMsgQ>& service, bool setupQueue) {
- service = ITestMsgQ::getService();
- ASSERT_NE(service, nullptr);
- ASSERT_TRUE(service->isRemote());
- service->getFmqUnsyncWrite(setupQueue,
- [fmq](bool ret, const MQDescriptorUnsync<uint16_t>& in) {
- ASSERT_TRUE(ret);
- *fmq = new (std::nothrow) MessageQueueUnsync(in);
- });
- ASSERT_NE(*fmq, nullptr);
- ASSERT_TRUE((*fmq)->isValid());
+ protected:
+ void getQueue(MessageQueueUnsync** fmq, sp<ITestMsgQ>* service, bool setupQueue) {
+ *service = waitGetTestService();
+ *fmq = nullptr;
+ if (*service == nullptr) return;
+ if (!(*service)->isRemote()) return;
+ (*service)->getFmqUnsyncWrite(setupQueue,
+ [fmq](bool ret, const MQDescriptorUnsync<uint16_t>& in) {
+ ASSERT_TRUE(ret);
+ *fmq = new (std::nothrow) MessageQueueUnsync(in);
+ });
}
};
@@ -64,7 +72,7 @@
}
virtual void SetUp() {
- mService = ITestMsgQ::getService();
+ mService = waitGetTestService();
ASSERT_NE(mService, nullptr);
ASSERT_TRUE(mService->isRemote());
mService->configureFmqSyncReadWrite([this](
@@ -89,7 +97,7 @@
}
virtual void SetUp() {
- mService = ITestMsgQ::getService();
+ mService = waitGetTestService();
ASSERT_NE(mService, nullptr);
ASSERT_TRUE(mService->isRemote());
mService->getFmqUnsyncWrite(true /* configureFmq */,
@@ -138,7 +146,11 @@
if ((pid = fork()) == 0) {
sp<ITestMsgQ> testService;
MessageQueueUnsync* queue = nullptr;
- getQueue(&queue, testService, true /* setupQueue */);
+ getQueue(&queue, &testService, true /* setupQueue */);
+ ASSERT_NE(testService, nullptr);
+ ASSERT_TRUE(testService->isRemote());
+ ASSERT_NE(queue, nullptr);
+ ASSERT_TRUE(queue->isValid());
size_t numMessagesMax = queue->getQuantumCount();
@@ -183,7 +195,11 @@
sp<ITestMsgQ> testService;
MessageQueueUnsync* queue = nullptr;
- getQueue(&queue, testService, false /* setupQueue */);
+ getQueue(&queue, &testService, false /* setupQueue */);
+ ASSERT_NE(testService, nullptr);
+ ASSERT_TRUE(testService->isRemote());
+ ASSERT_NE(queue, nullptr);
+ ASSERT_TRUE(queue->isValid());
// This read should fail due to the write overflow.
std::vector<uint16_t> readData(dataLen);