Adding all nfc vts related things back.

Test: none
Merged-In: I84a42ae27d36a5479f2ca859849bb1b4536bdbad
Change-Id: I84a42ae27d36a5479f2ca859849bb1b4536bdbad
This commit is contained in:
Steven Moreland 2017-01-18 11:01:01 -08:00
parent ab16b319f4
commit 70f34a6330
27 changed files with 496 additions and 5 deletions

View file

@ -5,7 +5,7 @@
# 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
# 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,

View file

@ -87,6 +87,13 @@ interface: {
next: "powerCycle"
next: "controlGranted"
}
callflow: {
next: "write"
next: "close"
next: "coreInitialized"
next: "powerCycle"
next: "controlGranted"
}
}
api: {
@ -98,6 +105,9 @@ interface: {
callflow: {
exit: true
}
callflow: {
exit: true
}
}
api: {
@ -113,6 +123,13 @@ interface: {
next: "coreInitialized"
next: "powerCycle"
}
callflow: {
next: "write"
next: "close"
next: "prediscover"
next: "coreInitialized"
next: "powerCycle"
}
}
api: {
@ -128,6 +145,13 @@ interface: {
next: "controlGranted"
next: "close"
}
callflow: {
next: "write"
next: "coreInitialized"
next: "prediscover"
next: "controlGranted"
next: "close"
}
}
}

View file

@ -11,11 +11,11 @@ interface: {
name: "sendEvent"
arg: {
type: TYPE_ENUM
predefined_type: "NfcEvent"
predefined_type: "::android::hardware::nfc::V1_0::NfcEvent"
}
arg: {
type: TYPE_ENUM
predefined_type: "NfcStatus"
predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
}

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View file

@ -0,0 +1,111 @@
#!/usr/bin/env python3.4
#
# 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.
#
import logging
import time
from vts.runners.host import asserts
from vts.runners.host import base_test_with_webdb
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
from vts.utils.python.coverage import coverage_utils
PASSTHROUGH_MODE_KEY = "passthrough_mode"
class NfcHidlBasicTest(base_test_with_webdb.BaseTestWithWebDbClass):
"""A simple testcase for the NFC HIDL HAL."""
def setUpClass(self):
"""Creates a mirror and turns on the framework-layer NFC service."""
self.dut = self.registerController(android_device)[0]
self.getUserParams(opt_param_names=[PASSTHROUGH_MODE_KEY])
self.dut.shell.InvokeTerminal("one")
self.dut.shell.one.Execute("setenforce 0") # SELinux permissive mode
self.dut.shell.one.Execute("svc nfc disable") # Turn off
time.sleep(5)
if getattr(self, PASSTHROUGH_MODE_KEY, True):
self.dut.shell.one.Execute(
"setprop vts.hal.vts.hidl.get_stub true")
else:
self.dut.shell.one.Execute(
"setprop vts.hal.vts.hidl.get_stub false")
self.dut.hal.InitHidlHal(
target_type="nfc",
target_basepaths=self.dut.libPaths,
target_version=1.0,
target_package="android.hardware.nfc",
target_component_name="INfc",
hw_binder_service_name="nfc_nci",
bits=64 if self.dut.is64Bit else 32)
def tearDownClass(self):
"""Turns off the framework-layer NFC service."""
# Ideally, we would want to store the nfc service's state before
# turning that off in setUpClass and restore the original state.
self.dut.shell.one.Execute("svc nfc disable") # make sure it's off
def testBase(self):
"""A simple test case which just calls each registered function."""
# TODO: extend to make realistic testcases
# For example, call after CORE_INIT_RSP is received.
# result = self.dut.hal.nfc.coreInitialized([1])
# logging.info("coreInitialized result: %s", result)
def send_event(NfcEvent, NfcStatus):
logging.info("callback send_event")
logging.info("arg0 %s", NfcEvent)
logging.info("arg1 %s", NfcStatus)
def send_data(NfcData):
logging.info("callback send_data")
logging.info("arg0 %s", NfcData)
client_callback = self.dut.hal.nfc.GetHidlCallbackInterface(
"INfcClientCallback",
sendEvent=send_event,
sendData=send_data)
result = self.dut.hal.nfc.open(client_callback)
logging.info("open result: %s", result)
result = self.dut.hal.nfc.prediscover()
logging.info("prediscover result: %s", result)
result = self.dut.hal.nfc.controlGranted()
logging.info("controlGranted result: %s", result)
result = self.dut.hal.nfc.powerCycle()
logging.info("powerCycle result: %s", result)
nfc_types = self.dut.hal.nfc.GetHidlTypeInterface("types")
logging.info("nfc_types: %s", nfc_types)
result = self.dut.hal.nfc.write([0, 1, 2, 3, 4, 5])
logging.info("write result: %s", result)
result = self.dut.hal.nfc.close()
logging.info("close result: %s", result)
self.SetCoverageData(coverage_utils.GetGcdaDict(self.dut))
if __name__ == "__main__":
test_runner.main()

View file

@ -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 := NfcHidlBinderizeBasicTest
VTS_CONFIG_SRC_DIR := testcases/hal/nfc/hidl/host/binderize
include test/vts/tools/build/Android.host_config.mk

View file

@ -0,0 +1,30 @@
<?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 HAL NFC (Binder Mode) test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
<option name="push-group" value="HidlHalTest.push" />
<option name="cleanup" value="true" />
<option name="push" value="spec/hardware/interfaces/nfc/1.0/vts/Nfc.vts->/data/local/tmp/spec/Nfc.vts" />
<option name="push" value="spec/hardware/interfaces/nfc/1.0/vts/NfcClientCallback.vts->/data/local/tmp/spec/NfcClientCallback.vts" />
<option name="push" value="spec/hardware/interfaces/nfc/1.0/vts/types.vts->/data/local/tmp/spec/types.vts" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
<option name="test-module-name" value="NfcHidlBinderizeBasicTest" />
<option name="test-case-path" value="vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest" />
<option name="test-config-path" value="vts/testcases/hal/nfc/hidl/host/binderize/NfcHidlBinderizeBasicTest.config" />
</test>
</configuration>

View file

@ -0,0 +1,3 @@
{
"passthrough_mode": False
}

View file

@ -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 := NfcHidlPassthroughBasicTest
VTS_CONFIG_SRC_DIR := testcases/hal/nfc/hidl/host/passthrough
include test/vts/tools/build/Android.host_config.mk

View file

@ -0,0 +1,30 @@
<?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 HAL NFC (Passthrough) test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
<option name="push-group" value="HidlHalTest.push" />
<option name="cleanup" value="true" />
<option name="push" value="spec/hardware/interfaces/nfc/1.0/vts/Nfc.vts->/data/local/tmp/spec/Nfc.vts" />
<option name="push" value="spec/hardware/interfaces/nfc/1.0/vts/NfcClientCallback.vts->/data/local/tmp/spec/NfcClientCallback.vts" />
<option name="push" value="spec/hardware/interfaces/nfc/1.0/vts/types.vts->/data/local/tmp/spec/types.vts" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
<option name="test-module-name" value="NfcHidlPassthroughBasicTest" />
<option name="test-case-path" value="vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest" />
<option name="test-config-path" value="vts/testcases/hal/nfc/hidl/host/passthrough/NfcHidlPassthroughBasicTest.config" />
</test>
</configuration>

View file

@ -0,0 +1,3 @@
{
"passthrough_mode": true
}

View file

@ -0,0 +1,25 @@
#
# 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)
include $(CLEAR_VARS)
LOCAL_MODULE := HalNfcHidlTargetBasicTest
VTS_CONFIG_SRC_DIR := testcases/hal/nfc/hidl/target
include test/vts/tools/build/Android.host_config.mk

View file

@ -0,0 +1,30 @@
<?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 NFC HIDL HAL's basic 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="HalNfcHidlTargetBasicTest" />
<option name="binary-test-sources" value="
_32bit::DATA/nativetest/nfc_hidl_hal_test/nfc_hidl_hal_test,
_64bit::DATA/nativetest64/nfc_hidl_hal_test/nfc_hidl_hal_test,
"/>
<option name="binary-test-type" value="gtest" />
<option name="test-timeout" value="10m" />
</test>
</configuration>

View file

@ -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 := NfcHidlTargetProfilingTest
VTS_CONFIG_SRC_DIR := testcases/hal/nfc/hidl/target_profiling
include test/vts/tools/build/Android.host_config.mk

View file

@ -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 NFC HIDL HAL's target-side profiling 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="NfcHidlTargetProfilingTest" />
<option name="binary-test-sources" value="
_32bit::DATA/nativetest/nfc_hidl_hal_test/nfc_hidl_hal_test,
_64bit::DATA/nativetest64/nfc_hidl_hal_test/nfc_hidl_hal_test,
"/>
<option name="binary-test-type" value="gtest" />
<option name="test-timeout" value="20m" />
<option name="enable-profiling" value="true" />
</test>
</configuration>

View file

@ -4,8 +4,9 @@ component_name: "types"
package: "android.hardware.nfc"
attribute: {
name: "NfcEvent"
name: "::android::hardware::nfc::V1_0::NfcEvent"
type: TYPE_ENUM
enum_value: {
scalar_type: "uint32_t"
@ -42,7 +43,7 @@ attribute: {
}
attribute: {
name: "NfcStatus"
name: "::android::hardware::nfc::V1_0::NfcStatus"
type: TYPE_ENUM
enum_value: {
scalar_type: "uint32_t"

View file

@ -2,4 +2,5 @@
subdirs = [
"1.0",
"1.0/default",
"1.0/vts/functional",
]