Merge "Add testcase to verify existence of hwbinder."
diff --git a/api/hwbinder/Android.mk b/api/hwbinder/Android.mk
new file mode 100644
index 0000000..c9fcaf8
--- /dev/null
+++ b/api/hwbinder/Android.mk
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := VtsKernelHwBinder
+include test/vts/tools/build/Android.host_config.mk
diff --git a/api/hwbinder/AndroidTest.xml b/api/hwbinder/AndroidTest.xml
new file mode 100644
index 0000000..8193b01
--- /dev/null
+++ b/api/hwbinder/AndroidTest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for VTS VtsKernelBinderTest.">
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+ <option name="push-group" value="HostDrivenTest.push"/>
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"/>
+ <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+ <option name="test-module-name" value="VtsKernelHwBinder"/>
+ <option name="test-case-path" value="vts/testcases/kernel/api/hwbinder/VtsKernelHwBinderTest" />
+ <option name="test-timeout" value="1m"/>
+ </test>
+</configuration>
diff --git a/api/hwbinder/VtsKernelHwBinderTest.py b/api/hwbinder/VtsKernelHwBinderTest.py
new file mode 100644
index 0000000..8fd24e0
--- /dev/null
+++ b/api/hwbinder/VtsKernelHwBinderTest.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import logging
+
+from vts.runners.host import asserts
+from vts.runners.host import base_test
+from vts.runners.host import const
+from vts.runners.host import test_runner
+from vts.utils.python.controllers import android_device
+from vts.utils.python.file import file_utils
+
+HWBINDER_PATH = "/dev/hwbinder"
+
+class VtsKernelHwBinderTest(base_test.BaseTestClass):
+ """Test case to validate existence of hwbinder node.
+ """
+
+ def setUpClass(self):
+ self.dut = self.registerController(android_device)[0]
+ self.dut.shell.InvokeTerminal(
+ "VtsKernelHwBinderTest") # creates a remote shell instance.
+ self.shell = self.dut.shell.VtsKernelHwBinderTest
+
+ def testHwbinderExistence(self):
+ """Checks that hwbinder node exists.
+ """
+ logging.info("Testing existence of %s", HWBINDER_PATH)
+ asserts.assertTrue(
+ file_utils.Exists(HWBINDER_PATH, self.shell),
+ "%s: File does not exist." % HWBINDER_PATH)
+
+ try:
+ permissions = file_utils.GetPermission(HWBINDER_PATH, self.shell)
+ asserts.assertTrue(file_utils.IsReadWrite(permissions),
+ "%s: File has invalid permissions (%s)" %
+ (HWBINDER_PATH, permissions))
+ except (ValueError, IOError) as e:
+ asserts.fail("Failed to assert permissions: %s" % str(e))
+
+if __name__ == "__main__":
+ test_runner.main()
diff --git a/api/hwbinder/__init__.py b/api/hwbinder/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/api/hwbinder/__init__.py