libyami test validate that libyami utility can perform decode
using libyami library.

Signed-off-by: Yeoh Ee Peng <[email protected]>
---
 lib/oeqa/runtime/cases/libyami.py | 74 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 lib/oeqa/runtime/cases/libyami.py

diff --git a/lib/oeqa/runtime/cases/libyami.py 
b/lib/oeqa/runtime/cases/libyami.py
new file mode 100644
index 0000000..3bee5fc
--- /dev/null
+++ b/lib/oeqa/runtime/cases/libyami.py
@@ -0,0 +1,74 @@
+import os
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.decorator.package import OEHasPackage
+script_path = os.path.dirname(os.path.realpath(__file__))
+
+
+class LibyamiTest(OERuntimeTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        # Configure X11 for libyami
+        (status, output) = cls.tc.target.run('mkdir -p /etc/X11/xorg.conf.d/')
+        config_dst = '/etc/X11/xorg.conf.d'
+        config_file = os.path.join(script_path, '../config/20-intel.conf')
+        cls.tc.target.copyTo(config_file, config_dst)
+        
+        # Copy libyami test files to target
+        dst = '/home/root'
+        media_file = os.path.join(script_path, '../media/libyami.tar')
+        cls.tc.target.copyTo(media_file, dst)
+        
+        # Untar libyami test files on target
+        cls.tc.target.run('tar -xvf libyami.tar')
+
+    @classmethod
+    def tearDownClass(cls):
+        # Remove the libyami test files
+        cls.tc.target.run("rm -rf libyami*")
+    
+    def check_vaapi_profile(self, profile):
+        (status, output) = self.target.run('vainfo')
+        if profile not in output:
+            self.skipTest("Vaapi profile (%s) not available" % profile)
+
+    @OEHasPackage(['libyami', 'libyami1'])
+    @OEHasPackage(['libyami-utils'])
+    def test_libyami(self):
+        # Check the libyami library
+        (status, output) = self.target.run('yamiinfo', 0)
+        if status != 0:
+            self.skipTest("No libyami packages are installed in the image")
+
+    @OETestDepends(['libyami.LibyamiTest.test_libyami'])
+    def test_decode_h264(self):
+        # Decode H264 using libyami
+        (status, output) = self.target.run(
+            'export DISPLAY=:0; yamidecode -i libyami/sample.h264')
+        self.assertEqual(status, 0, msg="Error messages: %s" % output)
+
+    @OETestDepends(['libyami.LibyamiTest.test_libyami'])
+    @OEHasPackage(['libva-utils'])
+    def test_decode_h265(self):
+        self.check_vaapi_profile('VAProfileHEVCMain')
+        # Decode H265 using libyami
+        (status, output) = self.target.run(
+            'export DISPLAY=:0; yamidecode -i libyami/sample.h265')
+        self.assertEqual(status, 0, msg="Error messages: %s" % output)
+
+    @OETestDepends(['libyami.LibyamiTest.test_libyami'])
+    @OEHasPackage(['libva-utils'])
+    def test_decode_vp8(self):
+        self.check_vaapi_profile('VAProfileVP8Version')
+        # Decode VP8 using libyami
+        (status, output) = self.target.run(
+            'export DISPLAY=:0; yamidecode -i libyami/sample.ivf')
+        self.assertEqual(status, 0, msg="Error messages: %s" % output)
+
+    @OETestDepends(['libyami.LibyamiTest.test_libyami'])
+    def test_decode_jpeg(self):
+        # Decode JPEG using libyami
+        (status, output) = self.target.run(
+            'export DISPLAY=:0; yamidecode -i libyami/sample.jpeg')
+        self.assertEqual(status, 0, msg="Error messages: %s" % output)
-- 
2.7.4

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

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

Reply via email to