Enable hdcp sanity test:
 - test that hdcp shared libray enable compiling of hdcp application
 - test that hdcp daemon monitoring calling to hdcp API

Signed-off-by: Yeoh Ee Peng <[email protected]>
---
 lib/oeqa/runtime/cases/hdcp.py              | 33 +++++++++++++++++++++++++
 lib/oeqa/runtime/files/hdcp/hdcp-sample.cpp | 32 +++++++++++++++++++++++++
 lib/oeqa/runtime/miutils/tests/hdcp_test.py | 37 +++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 lib/oeqa/runtime/cases/hdcp.py
 create mode 100644 lib/oeqa/runtime/files/hdcp/hdcp-sample.cpp
 create mode 100644 lib/oeqa/runtime/miutils/tests/hdcp_test.py

diff --git a/lib/oeqa/runtime/cases/hdcp.py b/lib/oeqa/runtime/cases/hdcp.py
new file mode 100644
index 0000000..7fbec84
--- /dev/null
+++ b/lib/oeqa/runtime/cases/hdcp.py
@@ -0,0 +1,33 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.runtime.decorator.package import OEHasPackage
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.miutils.targets.oeqatarget import OEQATarget
+from oeqa.runtime.miutils.tests.hdcp_test import HdcpTest
+
+class Hdcp(OERuntimeTestCase):
+    
+    @classmethod
+    def setUpClass(cls):
+        cls.hdcp = HdcpTest(OEQATarget(cls.tc.target))
+        cls.hdcp.setup()
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.hdcp.tear_down()
+
+    @OEHasPackage(['hdcp'])
+    @OEHasPackage(['hdcp-dev'])
+    @OEHasPackage(['gcc'])
+    @OEHasPackage(['gcc-symlinks'])
+    @OEHasPackage(['libstdc++-dev'])
+    @OEHasPackage(['binutils'])
+    def test_hdcp_can_compile(self):
+        (status, output) = self.hdcp.test_hdcp_can_compile()
+        self.assertEqual(status, 0, msg='status and output: %s and %s' % 
(status, output))
+    
+    @OETestDepends(['hdcp.Hdcp.test_hdcp_can_compile'])
+    def test_hdcp_can_create_session_with_hdcp_daemon_initialized(self):
+        (status, output) = self.hdcp.start_hdcp_daemon()
+        self.assertEqual(status, 0, msg='status and output: %s and %s' % 
(status, output))
+        (status, output) = 
self.hdcp.test_hdcp_can_create_session_with_hdcp_daemon_initialized()
+        self.assertEqual(status, 0, msg='status and output: %s and %s' % 
(status, output))
diff --git a/lib/oeqa/runtime/files/hdcp/hdcp-sample.cpp 
b/lib/oeqa/runtime/files/hdcp/hdcp-sample.cpp
new file mode 100644
index 0000000..4d21a68
--- /dev/null
+++ b/lib/oeqa/runtime/files/hdcp/hdcp-sample.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+#include <stdio.h>
+#include <hdcpapi.h>
+
+using std::cout;  // program uses cout
+using std::endl;  // program uses endl
+
+class HdcpApiTest
+{
+public:
+    static void CallBackFunction(uint32_t hdcpHandle, uint32_t portId, 
PORT_EVENT portEvent, void *context) 
+    {
+        cout << "Entering hdcp call back function" << endl;
+    }
+};
+
+int main()
+{
+    uint32_t * pHdcpHandle;
+    HDCP_STATUS hdcpStatus = HDCP_STATUS_ERROR_INTERNAL;
+    HdcpApiTest hdcpTest;
+
+    hdcpStatus = HDCPCreate(pHdcpHandle, HdcpApiTest::CallBackFunction, (void 
*)&hdcpTest);
+    if (hdcpStatus == HDCP_STATUS_SUCCESSFUL)
+    {
+        cout << "HDCPCreate Succeeded" << endl;
+        return 0;
+    } 
+    
+    cout << "HDCP status: " << hdcpStatus << endl;
+    return -1;
+}
\ No newline at end of file
diff --git a/lib/oeqa/runtime/miutils/tests/hdcp_test.py 
b/lib/oeqa/runtime/miutils/tests/hdcp_test.py
new file mode 100644
index 0000000..c347d72
--- /dev/null
+++ b/lib/oeqa/runtime/miutils/tests/hdcp_test.py
@@ -0,0 +1,37 @@
+import os
+script_path = os.path.dirname(os.path.realpath(__file__))
+files_path = os.path.join(script_path, '../../files/')
+
+class HdcpTest(object):
+    hdcp_src_dir = '/tmp/'
+    hdcp_src_filename = 'hdcp-sample.cpp'
+    hdcp_target_filename = 'hdcp-sample'
+
+    def __init__(self, target):
+        self.target = target
+
+    def setup(self):
+        self.target.copy_to(os.path.join(files_path, 'hdcp', 
self.hdcp_src_filename), self.hdcp_src_dir)
+
+    def tear_down(self):
+        files = '%s%s %s%s' % (self.hdcp_src_dir, 
+                               self.hdcp_src_filename, 
+                               self.hdcp_src_dir, 
+                               self.hdcp_target_filename) 
+        self.target.run('rm %s' % files)
+        self.stop_hdcp_daemon()
+
+    def test_hdcp_can_compile(self):
+        return self.target.run('c++ %s%s -o %s%s -lhdcpsdk' % 
(self.hdcp_src_dir,
+                                                               
self.hdcp_src_filename, 
+                                                               
self.hdcp_src_dir, 
+                                                               
self.hdcp_target_filename))
+
+    def start_hdcp_daemon(self):
+        return self.target.run('systemctl start hdcpd')
+
+    def test_hdcp_can_create_session_with_hdcp_daemon_initialized(self):
+        return self.target.run('cd /tmp; ./%s' % self.hdcp_target_filename)
+
+    def stop_hdcp_daemon(self):
+        return self.target.run('systemctl stop hdcpd')
-- 
2.7.4

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#6417): 
https://lists.yoctoproject.org/g/meta-intel/message/6417
Mute This Topic: https://lists.yoctoproject.org/mt/72042493/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to