summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-04-09 17:38:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-09 17:38:07 +0000
commitccea7be7005e27db2deb8babc53cacddad5794a2 (patch)
treeb6bda22da42fd5d27b6fcc21331d8a03c2888aa9
parent178660e3d2f6aa83fe9770d05fdc0d59d0d482dc (diff)
parent0734fc56cc3e235fac608485c9db24c2979b5766 (diff)
downloadplatform_system_libhidl-ccea7be7005e27db2deb8babc53cacddad5794a2.tar.gz
platform_system_libhidl-ccea7be7005e27db2deb8babc53cacddad5794a2.tar.bz2
platform_system_libhidl-ccea7be7005e27db2deb8babc53cacddad5794a2.zip
Merge "Add VtsHidlAllocatorV1_0TargetTest to vts." into rvc-dev
-rw-r--r--TEST_MAPPING3
-rw-r--r--transport/allocator/1.0/vts/functional/Android.bp1
-rw-r--r--transport/allocator/1.0/vts/functional/Android.mk22
-rw-r--r--transport/allocator/1.0/vts/functional/AndroidTest.xml32
-rw-r--r--transport/allocator/1.0/vts/functional/VtsHidlAllocatorV1_0TargetTest.cpp37
5 files changed, 17 insertions, 78 deletions
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 8916794f..01179d5d 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -4,6 +4,9 @@
"name": "libhidl_test"
},
{
+ "name": "VtsHidlAllocatorV1_0TargetTest"
+ },
+ {
"name": "hal_implementation_test"
}
]
diff --git a/transport/allocator/1.0/vts/functional/Android.bp b/transport/allocator/1.0/vts/functional/Android.bp
index 797d3f8b..31d9821d 100644
--- a/transport/allocator/1.0/vts/functional/Android.bp
+++ b/transport/allocator/1.0/vts/functional/Android.bp
@@ -24,5 +24,6 @@ cc_test {
static_libs: [
"android.hidl.allocator@1.0",
],
+ test_suites: ["general-tests", "vts"],
}
diff --git a/transport/allocator/1.0/vts/functional/Android.mk b/transport/allocator/1.0/vts/functional/Android.mk
deleted file mode 100644
index 62880ed3..00000000
--- a/transport/allocator/1.0/vts/functional/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2018 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := VtsHidlAllocatorV1_0Target
--include test/vts/tools/build/Android.host_config.mk
diff --git a/transport/allocator/1.0/vts/functional/AndroidTest.xml b/transport/allocator/1.0/vts/functional/AndroidTest.xml
deleted file mode 100644
index 6ac167f9..00000000
--- a/transport/allocator/1.0/vts/functional/AndroidTest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<configuration description="Config for VTS VtsHidlAllocatorV1_0Target test cases">
- <option name="config-descriptor:metadata" key="plan" value="vts-treble" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="abort-on-push-failure" value="false"/>
- <option name="push-group" value="HalHidlTargetTest.push"/>
- </target_preparer>
- <multi_target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
- <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="VtsHidlAllocatorV1_0Target"/>
- <option name="binary-test-working-directory" value="_32bit::/data/nativetest/" />
- <option name="binary-test-working-directory" value="_64bit::/data/nativetest64/" />
- <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHidlAllocatorV1_0TargetTest/VtsHidlAllocatorV1_0TargetTest" />
- <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHidlAllocatorV1_0TargetTest/VtsHidlAllocatorV1_0TargetTest" />
- <option name="binary-test-type" value="hal_hidl_gtest"/>
- <option name="test-timeout" value="5m"/>
- </test>
-</configuration>
diff --git a/transport/allocator/1.0/vts/functional/VtsHidlAllocatorV1_0TargetTest.cpp b/transport/allocator/1.0/vts/functional/VtsHidlAllocatorV1_0TargetTest.cpp
index 39ce6068..340ec0c6 100644
--- a/transport/allocator/1.0/vts/functional/VtsHidlAllocatorV1_0TargetTest.cpp
+++ b/transport/allocator/1.0/vts/functional/VtsHidlAllocatorV1_0TargetTest.cpp
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-#include <VtsHalHidlTargetTestBase.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMemory.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
#include <hidlmemory/mapping.h>
using ::android::sp;
@@ -32,20 +33,10 @@ using ::android::hidl::memory::V1_0::IMemory;
#define ASSERT_OK(ret) ASSERT_TRUE((ret).isOk())
#define EXPECT_OK(ret) EXPECT_TRUE((ret).isOk())
-class AllocatorEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- virtual void registerTestServices() override { registerTestService<IAllocator>(); }
-
- static AllocatorEnvironment* instance() {
- static AllocatorEnvironment* instance = new AllocatorEnvironment();
- return instance;
- };
-};
-
-class AllocatorHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- public:
+class AllocatorHidlTest : public ::testing::TestWithParam<std::string> {
+ public:
virtual void SetUp() override {
- allocator = getService<IAllocator>(AllocatorEnvironment::instance());
+ allocator = IAllocator::getService(GetParam());
ASSERT_NE(allocator, nullptr);
}
@@ -88,13 +79,13 @@ class AllocatorHidlTest : public ::testing::VtsHalHidlTargetTestBase {
sp<IAllocator> allocator;
};
-TEST_F(AllocatorHidlTest, TestAllocateSizes) {
+TEST_P(AllocatorHidlTest, TestAllocateSizes) {
for (size_t size : {1, 1023, 1024, 1025, 4096}) {
expectAllocateSuccess(size);
}
}
-TEST_F(AllocatorHidlTest, TestBatchAllocateSizes) {
+TEST_P(AllocatorHidlTest, TestBatchAllocateSizes) {
for (size_t count : {1, 1, 2, 3, 10}) {
for (size_t size : {1, 1023, 1024, 1025, 4096}) {
expectBatchAllocateSuccess(size, count);
@@ -102,7 +93,7 @@ TEST_F(AllocatorHidlTest, TestBatchAllocateSizes) {
}
}
-TEST_F(AllocatorHidlTest, TestCommit) {
+TEST_P(AllocatorHidlTest, TestCommit) {
constexpr size_t kSize = 1337;
sp<IMemory> memory = expectAllocateSuccess(kSize);
@@ -131,9 +122,7 @@ TEST_F(AllocatorHidlTest, TestCommit) {
}
}
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(AllocatorEnvironment::instance());
- ::testing::InitGoogleTest(&argc, argv);
- AllocatorEnvironment::instance()->init(&argc, argv);
- return RUN_ALL_TESTS();
-}
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, AllocatorHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(IAllocator::descriptor)),
+ android::hardware::PrintInstanceNameToString);