From 4e6315e137661186f0598859906cf6b52c6b9702 Mon Sep 17 00:00:00 2001 From: Shashwat Pandey Date: Wed, 26 Jul 2017 19:43:50 +0800 Subject: [PATCH 1/2] Flatpak: add qa tests for flatpak. Add tests for flatpak command line. Signed-off-by: Shashwat Pandey --- ...kit-image-gateway-flatpak-runtime.manifest | 1 + .../conf/test/refkit-image-gateway.manifest | 1 + .../runtime/sanity/flatpak-commandline.py | 41 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py 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/flatpak-commandline.py b/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py new file mode 100644 index 0000000000..9484bfd6db --- /dev/null +++ b/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py @@ -0,0 +1,41 @@ +import time +import subprocess +from oeqa.oetest import oeRuntimeTest + + +class SanityTestFlatpakCommandline(oeRuntimeTest): + """ + @class SanityTestFlatpak + """ + + def test_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_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_run(self): + ''' + Test to run an application using flatpak. + @fn test_run + @param self + @return + ''' + # ************Flatpak Run************ + p = subprocess.Popen('flatpak run org.example.BasePlatform/x86_64/refkit.0', shell=True, stdout=subprocess.PIPE) + time.sleep(2) + p.terminate() From 765494a3448006df9c2fcd9a459467e0e2caa5dd Mon Sep 17 00:00:00 2001 From: Shashwat Pandey Date: Tue, 15 Aug 2017 19:18:36 +0800 Subject: [PATCH 2/2] Create seperate python script for flatpak run application. Signed-off-by: Shashwat Pandey --- .../sanity/files/flatpak_cmd_runapp.py | 13 ++++++ .../runtime/sanity/flatpak-commandline.py | 45 ++++++++++++++----- 2 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 meta-iotqa/lib/oeqa/runtime/sanity/files/flatpak_cmd_runapp.py 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 index 9484bfd6db..41181e9633 100644 --- a/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py +++ b/meta-iotqa/lib/oeqa/runtime/sanity/flatpak-commandline.py @@ -1,5 +1,4 @@ -import time -import subprocess +import os from oeqa.oetest import oeRuntimeTest @@ -8,7 +7,25 @@ class SanityTestFlatpakCommandline(oeRuntimeTest): @class SanityTestFlatpak """ - def test_version(self): + 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 @@ -17,8 +34,7 @@ def test_version(self): (status, output) = self.target.run("flatpak --version") self.assertEqual(status, 0, msg="flatpak version command failed: %s " % output) - - def test_list(self): + def test_flatpak_cmd_list(self): ''' Test to list down all flatpak app. @fn test_list @@ -27,8 +43,7 @@ def test_list(self): (status, output) = self.target.run("flatpak list") self.assertEqual(status, 0, msg="flatpak list command failed: %s " % output) - - def test_run(self): + def test_flatpak_cmd_run(self): ''' Test to run an application using flatpak. @fn test_run @@ -36,6 +51,16 @@ def test_run(self): @return ''' # ************Flatpak Run************ - p = subprocess.Popen('flatpak run org.example.BasePlatform/x86_64/refkit.0', shell=True, stdout=subprocess.PIPE) - time.sleep(2) - p.terminate() + (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))