diff --git a/meta-iotqa/conf/test/refkit-image-gateway-flatpak-runtime.manifest b/meta-iotqa/conf/test/refkit-image-gateway-flatpak-runtime.manifest index e0b0843e70..1536e8be30 100644 --- a/meta-iotqa/conf/test/refkit-image-gateway-flatpak-runtime.manifest +++ b/meta-iotqa/conf/test/refkit-image-gateway-flatpak-runtime.manifest @@ -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 diff --git a/meta-iotqa/conf/test/refkit-image-gateway.manifest b/meta-iotqa/conf/test/refkit-image-gateway.manifest index 1b85610db4..bc75860bcd 100644 --- a/meta-iotqa/conf/test/refkit-image-gateway.manifest +++ b/meta-iotqa/conf/test/refkit-image-gateway.manifest @@ -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 diff --git a/meta-iotqa/lib/oeqa/runtime/sanity/files/flatpak_cmd_runapp.py b/meta-iotqa/lib/oeqa/runtime/sanity/files/flatpak_cmd_runapp.py new file mode 100644 index 0000000000..5b956fe99f --- /dev/null +++ b/meta-iotqa/lib/oeqa/runtime/sanity/files/flatpak_cmd_runapp.py @@ -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() diff --git a/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py b/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py new file mode 100644 index 0000000000..41181e9633 --- /dev/null +++ b/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py @@ -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))