mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
IR HAL Target-side test am: c75771089a am: 85f1507253
am: a2d196bf9d
Change-Id: I75da721e6615849ac58d88b8373507eb64091447
This commit is contained in:
@@ -54,3 +54,106 @@ cc_library_shared {
|
|||||||
"android.hidl.base@1.0",
|
"android.hidl.base@1.0",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
genrule {
|
||||||
|
name: "android.hardware.ir.vts.driver@1.0_genc++",
|
||||||
|
tools: ["hidl-gen", "vtsc"],
|
||||||
|
cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.ir@1.0 && $(location vtsc) -mDRIVER -tSOURCE -b$(genDir) android/hardware/ir/1.0/ $(genDir)/android/hardware/ir/1.0/",
|
||||||
|
srcs: [
|
||||||
|
"types.hal",
|
||||||
|
"IConsumerIr.hal",
|
||||||
|
],
|
||||||
|
out: [
|
||||||
|
"android/hardware/ir/1.0/types.vts.cpp",
|
||||||
|
"android/hardware/ir/1.0/ConsumerIr.vts.cpp",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
genrule {
|
||||||
|
name: "android.hardware.ir.vts.driver@1.0_genc++_headers",
|
||||||
|
tools: ["hidl-gen", "vtsc"],
|
||||||
|
cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.ir@1.0 && $(location vtsc) -mDRIVER -tHEADER -b$(genDir) android/hardware/ir/1.0/ $(genDir)/android/hardware/ir/1.0/",
|
||||||
|
srcs: [
|
||||||
|
"types.hal",
|
||||||
|
"IConsumerIr.hal",
|
||||||
|
],
|
||||||
|
out: [
|
||||||
|
"android/hardware/ir/1.0/types.vts.h",
|
||||||
|
"android/hardware/ir/1.0/ConsumerIr.vts.h",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library_shared {
|
||||||
|
name: "android.hardware.ir.vts.driver@1.0",
|
||||||
|
generated_sources: ["android.hardware.ir.vts.driver@1.0_genc++"],
|
||||||
|
generated_headers: ["android.hardware.ir.vts.driver@1.0_genc++_headers"],
|
||||||
|
export_generated_headers: ["android.hardware.ir.vts.driver@1.0_genc++_headers"],
|
||||||
|
shared_libs: [
|
||||||
|
"libhidlbase",
|
||||||
|
"libhidltransport",
|
||||||
|
"libhwbinder",
|
||||||
|
"liblog",
|
||||||
|
"libutils",
|
||||||
|
"libcutils",
|
||||||
|
"libvts_common",
|
||||||
|
"libvts_datatype",
|
||||||
|
"libvts_measurement",
|
||||||
|
"libvts_multidevice_proto",
|
||||||
|
"libcamera_metadata",
|
||||||
|
"libprotobuf-cpp-full",
|
||||||
|
"android.hidl.base@1.0",
|
||||||
|
"android.hardware.ir@1.0",
|
||||||
|
],
|
||||||
|
export_shared_lib_headers: [
|
||||||
|
"libhidlbase",
|
||||||
|
"libhidltransport",
|
||||||
|
"libhwbinder",
|
||||||
|
"libutils",
|
||||||
|
"android.hidl.base@1.0",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
genrule {
|
||||||
|
name: "android.hardware.ir@1.0-IConsumerIr-vts.profiler_genc++",
|
||||||
|
tools: ["hidl-gen", "vtsc"],
|
||||||
|
cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.ir@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/ir/1.0/ $(genDir)/android/hardware/ir/1.0/",
|
||||||
|
srcs: [
|
||||||
|
"IConsumerIr.hal",
|
||||||
|
"types.hal",
|
||||||
|
],
|
||||||
|
out: [
|
||||||
|
"android/hardware/ir/1.0/ConsumerIr.vts.cpp",
|
||||||
|
"android/hardware/ir/1.0/types.vts.cpp",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
genrule {
|
||||||
|
name: "android.hardware.ir@1.0-IConsumerIr-vts.profiler_genc++_headers",
|
||||||
|
tools: ["hidl-gen", "vtsc"],
|
||||||
|
cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.ir@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/ir/1.0/ $(genDir)/android/hardware/ir/1.0/",
|
||||||
|
srcs: [
|
||||||
|
"IConsumerIr.hal",
|
||||||
|
"types.hal",
|
||||||
|
],
|
||||||
|
out: [
|
||||||
|
"android/hardware/ir/1.0/ConsumerIr.vts.h",
|
||||||
|
"android/hardware/ir/1.0/types.vts.h",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library_shared {
|
||||||
|
name: "android.hardware.ir@1.0-IConsumerIr-vts.profiler",
|
||||||
|
generated_sources: ["android.hardware.ir@1.0-IConsumerIr-vts.profiler_genc++"],
|
||||||
|
generated_headers: ["android.hardware.ir@1.0-IConsumerIr-vts.profiler_genc++_headers"],
|
||||||
|
export_generated_headers: ["android.hardware.ir@1.0-IConsumerIr-vts.profiler_genc++_headers"],
|
||||||
|
shared_libs: [
|
||||||
|
"libbase",
|
||||||
|
"libhidlbase",
|
||||||
|
"libhidltransport",
|
||||||
|
"libvts_profiling",
|
||||||
|
"libvts_multidevice_proto",
|
||||||
|
"libprotobuf-cpp-full",
|
||||||
|
"android.hidl.base@1.0",
|
||||||
|
"android.hardware.ir@1.0",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|||||||
19
ir/1.0/vts/Android.mk
Normal file
19
ir/1.0/vts/Android.mk
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2016 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 $(LOCAL_PATH)/functional/vts/testcases/hal/ir/hidl/target/Android.mk
|
||||||
44
ir/1.0/vts/ConsumerIr.vts
Normal file
44
ir/1.0/vts/ConsumerIr.vts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
component_class: HAL_HIDL
|
||||||
|
component_type_version: 1.0
|
||||||
|
component_name: "IConsumerIr"
|
||||||
|
|
||||||
|
package: "android.hardware.ir"
|
||||||
|
|
||||||
|
import: "android.hardware.ir@1.0::types"
|
||||||
|
|
||||||
|
interface: {
|
||||||
|
api: {
|
||||||
|
name: "transmit"
|
||||||
|
return_type_hidl: {
|
||||||
|
type: TYPE_SCALAR
|
||||||
|
scalar_type: "bool_t"
|
||||||
|
}
|
||||||
|
arg: {
|
||||||
|
type: TYPE_SCALAR
|
||||||
|
scalar_type: "int32_t"
|
||||||
|
}
|
||||||
|
arg: {
|
||||||
|
type: TYPE_VECTOR
|
||||||
|
vector_value: {
|
||||||
|
type: TYPE_SCALAR
|
||||||
|
scalar_type: "int32_t"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
api: {
|
||||||
|
name: "getCarrierFreqs"
|
||||||
|
return_type_hidl: {
|
||||||
|
type: TYPE_SCALAR
|
||||||
|
scalar_type: "bool_t"
|
||||||
|
}
|
||||||
|
return_type_hidl: {
|
||||||
|
type: TYPE_VECTOR
|
||||||
|
vector_value: {
|
||||||
|
type: TYPE_STRUCT
|
||||||
|
predefined_type: "::android::hardware::ir::V1_0::ConsumerIrFreqRange"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
40
ir/1.0/vts/functional/Android.bp
Normal file
40
ir/1.0/vts/functional/Android.bp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2016 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
cc_test {
|
||||||
|
name: "ir_hidl_hal_test",
|
||||||
|
gtest: true,
|
||||||
|
srcs: ["ir_hidl_hal_test.cpp"],
|
||||||
|
shared_libs: [
|
||||||
|
"libbase",
|
||||||
|
"liblog",
|
||||||
|
"libcutils",
|
||||||
|
"libhidlbase",
|
||||||
|
"libhidltransport",
|
||||||
|
"libhwbinder",
|
||||||
|
"libutils",
|
||||||
|
"android.hardware.ir@1.0",
|
||||||
|
],
|
||||||
|
static_libs: ["libgtest"],
|
||||||
|
cflags: [
|
||||||
|
"--coverage",
|
||||||
|
"-O0",
|
||||||
|
"-g",
|
||||||
|
],
|
||||||
|
ldflags: [
|
||||||
|
"--coverage"
|
||||||
|
]
|
||||||
|
}
|
||||||
86
ir/1.0/vts/functional/ir_hidl_hal_test.cpp
Normal file
86
ir/1.0/vts/functional/ir_hidl_hal_test.cpp
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LOG_TAG "ir_hidl_hal_test"
|
||||||
|
|
||||||
|
#include <android-base/logging.h>
|
||||||
|
|
||||||
|
#include <android/hardware/ir/1.0/IConsumerIr.h>
|
||||||
|
#include <android/hardware/ir/1.0/types.h>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using ::android::hardware::ir::V1_0::IConsumerIr;
|
||||||
|
using ::android::hardware::ir::V1_0::ConsumerIrFreqRange;
|
||||||
|
using ::android::hardware::hidl_vec;
|
||||||
|
using ::android::hardware::Return;
|
||||||
|
using ::android::sp;
|
||||||
|
|
||||||
|
// The main test class for IR HIDL HAL.
|
||||||
|
class ConsumerIrHidlTest : public ::testing::Test {
|
||||||
|
public:
|
||||||
|
virtual void SetUp() override {
|
||||||
|
ir = IConsumerIr::getService(false);
|
||||||
|
ASSERT_NE(ir, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void TearDown() override {}
|
||||||
|
|
||||||
|
sp<IConsumerIr> ir;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Test transmit() for the min and max frequency of every available range
|
||||||
|
TEST_F(ConsumerIrHidlTest, TransmitTest) {
|
||||||
|
int32_t freqs;
|
||||||
|
bool success;
|
||||||
|
hidl_vec<ConsumerIrFreqRange> ranges;
|
||||||
|
auto cb = [&](bool s, hidl_vec<ConsumerIrFreqRange> v) {
|
||||||
|
ranges = v;
|
||||||
|
success = s;
|
||||||
|
};
|
||||||
|
Return<void> ret = ir->getCarrierFreqs(cb);
|
||||||
|
ASSERT_TRUE(ret.isOk());
|
||||||
|
ASSERT_TRUE(success);
|
||||||
|
|
||||||
|
if (ranges.size() > 0) {
|
||||||
|
uint32_t len = 16;
|
||||||
|
hidl_vec<int32_t> vec;
|
||||||
|
vec.resize(len);
|
||||||
|
std::fill(vec.begin(), vec.end(), 1);
|
||||||
|
for (auto range = ranges.begin(); range != ranges.end(); range++) {
|
||||||
|
EXPECT_TRUE(ir->transmit(range->min, vec));
|
||||||
|
EXPECT_TRUE(ir->transmit(range->max, vec));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test transmit() when called with invalid frequencies
|
||||||
|
TEST_F(ConsumerIrHidlTest, BadFreqTest) {
|
||||||
|
uint32_t len = 16;
|
||||||
|
hidl_vec<int32_t> vec;
|
||||||
|
vec.resize(len);
|
||||||
|
std::fill(vec.begin(), vec.end(), 1);
|
||||||
|
EXPECT_FALSE(ir->transmit(-1, vec));
|
||||||
|
EXPECT_FALSE(ir->transmit(0, vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
int status = RUN_ALL_TESTS();
|
||||||
|
LOG(INFO) << "Test result = " << status;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2016 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 := HalIrHidlTargetTest
|
||||||
|
VTS_CONFIG_SRC_DIR := testcases/hal/ir/hidl/target
|
||||||
|
include test/vts/tools/build/Android.host_config.mk
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2016 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 IR HIDL HAL's target-side test cases">
|
||||||
|
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
|
||||||
|
<option name="push-group" value="HidlHalTest.push" />
|
||||||
|
</target_preparer>
|
||||||
|
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
|
||||||
|
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
|
||||||
|
<option name="test-module-name" value="HalIrHidlTargetTest"/>
|
||||||
|
<option name="binary-test-sources" value="
|
||||||
|
_32bit::DATA/nativetest/ir_hidl_hal_test/ir_hidl_hal_test,
|
||||||
|
_64bit::DATA/nativetest64/ir_hidl_hal_test/ir_hidl_hal_test,
|
||||||
|
"/>
|
||||||
|
<option name="binary-test-type" value="hal_hidl_gtest" />
|
||||||
|
<option name="hwbinder-service" value="android.hardware.ir" />
|
||||||
|
<option name="test-timeout" value="1m" />
|
||||||
|
</test>
|
||||||
|
</configuration>
|
||||||
21
ir/1.0/vts/types.vts
Normal file
21
ir/1.0/vts/types.vts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
component_class: HAL_HIDL
|
||||||
|
component_type_version: 1.0
|
||||||
|
component_name: "types"
|
||||||
|
|
||||||
|
package: "android.hardware.ir"
|
||||||
|
|
||||||
|
|
||||||
|
attribute: {
|
||||||
|
name: "::android::hardware::ir::V1_0::ConsumerIrFreqRange"
|
||||||
|
type: TYPE_STRUCT
|
||||||
|
struct_value: {
|
||||||
|
name: "min"
|
||||||
|
type: TYPE_SCALAR
|
||||||
|
scalar_type: "uint32_t"
|
||||||
|
}
|
||||||
|
struct_value: {
|
||||||
|
name: "max"
|
||||||
|
type: TYPE_SCALAR
|
||||||
|
scalar_type: "uint32_t"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,4 +2,5 @@
|
|||||||
subdirs = [
|
subdirs = [
|
||||||
"1.0",
|
"1.0",
|
||||||
"1.0/default",
|
"1.0/default",
|
||||||
|
"1.0/vts/functional",
|
||||||
]
|
]
|
||||||
|
|||||||
19
ir/Android.mk
Normal file
19
ir/Android.mk
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2016 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 $(call all-subdir-makefiles)
|
||||||
Reference in New Issue
Block a user