Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

meta-iotqa: add qa tests for flatpak. #260

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ oeqa.runtime.core.iotivity.client
oeqa.runtime.multimedia.audio.pulseaudio
oeqa.runtime.sanity.flatpak
oeqa.runtime.sanity.flatpak-session
oeqa.runtime.sanity.flatpak-commandline
1 change: 1 addition & 0 deletions meta-iotqa/conf/test/refkit-image-gateway.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ oeqa.runtime.peripherals.upm.upm
oeqa.runtime.programming.nodejs.apprt_nodejs
oeqa.runtime.sanity.flatpak
oeqa.runtime.sanity.flatpak-session
oeqa.runtime.sanity.flatpak-commandline
13 changes: 13 additions & 0 deletions meta-iotqa/lib/oeqa/runtime/sanity/files/flatpak_cmd_runapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import subprocess
import time

'''
Run the flatpak application and then terminate the process.
'''

def flatpak_cmd_runapp():
p = subprocess.Popen('flatpak run org.example.BasePlatform/x86_64/refkit.0', shell=True, stdout=subprocess.PIPE)
time.sleep(2)
p.terminate()

if __name__ == '__main__':flatpak_cmd_runapp()
66 changes: 66 additions & 0 deletions meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
from oeqa.oetest import oeRuntimeTest


class SanityTestFlatpakCommandline(oeRuntimeTest):
"""
@class SanityTestFlatpak
"""

flatpak_cmd_runapp = 'flatpak_cmd_runapp.py'

flatpak_cmd_runapp_target = '/tmp/%s' % flatpak_cmd_runapp

def setUp(self):
'''
Copy all necessary files for test to the target device.
@fn setUp
@param self
@return
'''
self.target.copy_to(
os.path.join(
os.path.dirname(__file__),
'files',
SanityTestFlatpakCommandline.flatpak_cmd_runapp),
SanityTestFlatpakCommandline.flatpak_cmd_runapp_target)

def test_flatpak_cmd_version(self):
'''
Test the version of flatpak.
@fn test_version
'''
# ************Flatpak Version************
(status, output) = self.target.run("flatpak --version")
self.assertEqual(status, 0, msg="flatpak version command failed: %s " % output)

def test_flatpak_cmd_list(self):
'''
Test to list down all flatpak app.
@fn test_list
'''
# ************Flatpak List************
(status, output) = self.target.run("flatpak list")
self.assertEqual(status, 0, msg="flatpak list command failed: %s " % output)

def test_flatpak_cmd_run(self):
'''
Test to run an application using flatpak.
@fn test_run
@param self
@return
'''
# ************Flatpak Run************
(status, output) = self.target.run('python %s' % SanityTestFlatpakCommandline.flatpak_cmd_runapp_target)
self.assertEqual(status, 0, msg="flatpak run command failed: %s " % output)

def tearDown(self):
'''
Clean work: remove all the files copied to the target device.
@fn tearDown
@param self
@return
'''
self.target.run(
'rm -f %s' %
(SanityTestFlatpakCommandline.flatpak_cmd_runapp_target))