Enable libyami sanity test:
 - test that libyami library enable decode (H264, H265)

Signed-off-by: Yeoh Ee Peng <[email protected]>
---
 lib/oeqa/runtime/cases/libyami.py            | 69 ++++++++++++++++++++++++++++
 lib/oeqa/runtime/files/libyami/20-intel.conf |  5 ++
 2 files changed, 74 insertions(+)
 create mode 100644 lib/oeqa/runtime/cases/libyami.py
 create mode 100644 lib/oeqa/runtime/files/libyami/20-intel.conf

diff --git a/lib/oeqa/runtime/cases/libyami.py 
b/lib/oeqa/runtime/cases/libyami.py
new file mode 100644
index 0000000..4845ace
--- /dev/null
+++ b/lib/oeqa/runtime/cases/libyami.py
@@ -0,0 +1,69 @@
+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__))
+files_path = os.path.join(script_path, '../files/')
+
+class LibyamiTest(OERuntimeTestCase):
+    libyami_xorg_dir = '/etc/X11/xorg.conf.d/'
+    libyami_xorg_config_file = '20-intel.conf'
+
+    @classmethod
+    def setUpClass(cls):
+        cls.tc.target.run('mkdir -p %s' % cls.libyami_xorg_dir)
+        cls.tc.target.copyTo(os.path.join(files_path, 'libyami', 
cls.libyami_xorg_config_file),
+                             cls.libyami_xorg_dir)
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.tc.target.run("rm /tmp/libyami*")
+        cls.tc.target.run("rm -rf %s" % cls.libyami_xorg_dir)
+
+    def check_vaapi_profile(self, profile):
+        (__, 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):
+        (status, output) = self.target.run('yamiinfo', 0)
+        if status:
+            self.skipTest("No libyami packages are installed in the image 
(%s)" % output)
+
+    @OEHasPackage(['gstreamer1.0-plugins-base'])
+    @OEHasPackage(['gstreamer1.0-plugins-good'])
+    @OEHasPackage(['gstreamer1.0-plugins-bad'])
+    @OEHasPackage(['intel-mediasdk'])
+    def test_msdk_gstreamer_plugin(self):
+        (status, output) = self.target.run('gst-inspect-1.0 msdk')
+        self.assertEqual(status, 0, msg='status and output: %s and %s' % 
(status, output))
+
+    @OETestDepends(['libyami.LibyamiTest.test_libyami'])
+    @OETestDepends(['libyami.LibyamiTest.test_msdk_gstreamer_plugin'])
+    @OEHasPackage(['intel-media-driver', 'libigfxcmrt7'])
+    def test_decode_h264(self):
+        (status, output) = self.target.run('export LIBVA_DRIVER_NAME=iHD; '
+                                           'gst-launch-1.0 -ev videotestsrc 
num-buffers=120 ! timeoverlay ! '
+                                           'msdkh264enc ! 
video/x-h264,profile=main ! h264parse ! '
+                                           'filesink 
location=/tmp/libyamitest.h264')
+        self.assertEqual(status, 0, msg='status and output: %s and %s' % 
(status, output))
+
+        (status, output) = self.target.run('export DISPLAY=:0; yamidecode -i 
/tmp/libyamitest.h264')
+        self.assertEqual(status, 0, msg="Error messages: %s" % output)
+
+    @OETestDepends(['libyami.LibyamiTest.test_libyami'])
+    @OETestDepends(['libyami.LibyamiTest.test_msdk_gstreamer_plugin'])
+    @OEHasPackage(['intel-media-driver', 'libigfxcmrt7'])
+    @OEHasPackage(['libva-utils'])
+    def test_decode_h265(self):
+        self.check_vaapi_profile('VAProfileHEVCMain')
+        (status, output) = self.target.run('export LIBVA_DRIVER_NAME=iHD; '
+                                           'gst-launch-1.0 -ev videotestsrc 
num-buffers=120 ! timeoverlay ! '
+                                           'msdkh265enc ! 
video/x-h265,profile=main ! h265parse ! '
+                                           'filesink 
location=/tmp/libyamitest.h265')
+        self.assertEqual(status, 0, msg='status and output: %s and %s' % 
(status, output))
+
+        (status, output) = self.target.run('export DISPLAY=:0; yamidecode -i 
/tmp/libyamitest.h265')
+        self.assertEqual(status, 0, msg="Error messages: %s" % output)
diff --git a/lib/oeqa/runtime/files/libyami/20-intel.conf 
b/lib/oeqa/runtime/files/libyami/20-intel.conf
new file mode 100644
index 0000000..a60be00
--- /dev/null
+++ b/lib/oeqa/runtime/files/libyami/20-intel.conf
@@ -0,0 +1,5 @@
+Contain:
+Section "Device"
+   Identifier "Intel Graphics"
+   Driver "intel"
+EndSection
-- 
2.7.4

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

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

Reply via email to