Re: [yocto] [PATCH] runtime: Add support to manual BSP test cases

2018-07-15 Thread Hussin, Mohamad Noor Alim
TestID was determined from testopia, 
https://bugzilla.yoctoproject.org/tr_show_run.cgi?run_id=9635.

Regards,
Alim Hussin

-Original Message-
From: akuster808 [mailto:akuster...@gmail.com] 
Sent: Friday, July 13, 2018 10:52 PM
To: Hussin, Mohamad Noor Alim ; 
yocto@yoctoproject.org; richard.pur...@linuxfoundation.org
Subject: Re: [yocto] [PATCH] runtime: Add support to manual BSP test cases



On 07/13/2018 05:08 AM, mohamad.noor.alim.hus...@intel.com wrote:
> From: Mohamad Noor Alim Hussin 
>
> This is manual BSP test cases that have converted to auto test cases 
> for QA release. Manualbsp.py has dependency on file bsphardware that 
> run on hardware.
How do the TestID get determined?

Also, I think this patch needs to be cc'd to 
"openembedded-c...@lists.openembedded.org"
>
> Signed-off-by: Mohamad Noor Alim Hussin 
> 
> ---
>  meta/lib/oeqa/runtime/cases/manualbsp.py | 122 
>   meta/lib/oeqa/runtime/files/bsphardware  
> | 132 +++
>  2 files changed, 254 insertions(+)
>  create mode 100644 meta/lib/oeqa/runtime/cases/manualbsp.py
>  create mode 100755 meta/lib/oeqa/runtime/files/bsphardware
>
> diff --git a/meta/lib/oeqa/runtime/cases/manualbsp.py 
> b/meta/lib/oeqa/runtime/cases/manualbsp.py
> new file mode 100644
> index 000..22d0d33
> --- /dev/null
> +++ b/meta/lib/oeqa/runtime/cases/manualbsp.py
> @@ -0,0 +1,122 @@
> +from oeqa.runtime.case import OERuntimeTestCase from 
> +oeqa.core.decorator.depends import OETestDepends from 
> +oeqa.core.decorator.oeid import OETestID import subprocess import 
> +time
> +
> +class BspRuntimeTest(OERuntimeTestCase):
> +
> +@OETestID(240)
> +def test_check_bash(self):
> +status, output = self.target.run('which bash')
> +msg = ('bash shell not working as expected. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(228)
> +def test_runlevel_5(self):
> +status, output = self.target.run('init 5')
> +msg = ('System unable to init 5 '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 255, msg = msg)
> +time.sleep(2)
> +command = 'bsphardware -r 5'
> +status, output = self.target.run(command)
> +msg = ('System did not start from runlevel 5. '
> +'Status:%s.' % (status))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(198)
> +def test_runlevel_3(self):
> +status, output = self.target.run('init 3')
> +msg = ('System unable to start with runlevel 3. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 255, msg = msg)
> +time.sleep(2)
> +command = 'bsphardware -r 3'
> +status, output = self.target.run(command)
> +msg = ('Unable to change from runlevel 5 to 3. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +class BspHardwareTest(OERuntimeTestCase):
> +
> +@classmethod
> +def setUpClass(cls):
> +src = os.path.join(cls.tc.runtime_files_dir, 'bsphardware')
> +cls.tc.target.run('mkdir ~/test')
> +cls.tc.target.copyTo(src, '/usr/bin')
> +
> +@classmethod
> +def tearDownClass(cls):
> +cls.tc.target.run('rm -rf ~/test')
> +
> +@OETestID(216)
> +def test_USB_mount(self):
> +command = 'bsphardware -d sd -sp 1 -m ~/test/stick'
> +status, output = self.target.run(command)
> +msg = ('Unable to mount USB stick. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(217)
> +@OETestDepends(['manualbsp.BspHardwareTest.test_USB_write_file'])
> +def test_USB_read_file(self):
> +command = 'cat ~/test/stick/hello_stick'
> +status, output = self.target.run(command)
> +msg = ('Unable to read file from USB stick. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestDepends(['manualbsp.BspHardwareTest.test_USB_mount'])
> +@OETestID(219)
> +def test_USB_write_file(self):
> +command = 'touch ~/test/stick/hello_stick'
> +status, output = self.target.run(command)
> +msg = ('Status and  output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestDepends(['manualbsp.BspHardwareTest.test_USB_mount'])
> +@OETest

Re: [yocto] [PATCH] runtime: Add support to manual BSP test cases

2018-07-13 Thread akuster808



On 07/13/2018 05:08 AM, mohamad.noor.alim.hus...@intel.com wrote:
> From: Mohamad Noor Alim Hussin 
>
> This is manual BSP test cases that have converted to auto test cases
> for QA release. Manualbsp.py has dependency on file bsphardware that run
> on hardware.
How do the TestID get determined?

Also, I think this patch needs to be cc'd to
"openembedded-c...@lists.openembedded.org"
>
> Signed-off-by: Mohamad Noor Alim Hussin 
> ---
>  meta/lib/oeqa/runtime/cases/manualbsp.py | 122 
>  meta/lib/oeqa/runtime/files/bsphardware  | 132 
> +++
>  2 files changed, 254 insertions(+)
>  create mode 100644 meta/lib/oeqa/runtime/cases/manualbsp.py
>  create mode 100755 meta/lib/oeqa/runtime/files/bsphardware
>
> diff --git a/meta/lib/oeqa/runtime/cases/manualbsp.py 
> b/meta/lib/oeqa/runtime/cases/manualbsp.py
> new file mode 100644
> index 000..22d0d33
> --- /dev/null
> +++ b/meta/lib/oeqa/runtime/cases/manualbsp.py
> @@ -0,0 +1,122 @@
> +from oeqa.runtime.case import OERuntimeTestCase
> +from oeqa.core.decorator.depends import OETestDepends
> +from oeqa.core.decorator.oeid import OETestID
> +import subprocess
> +import time
> +
> +class BspRuntimeTest(OERuntimeTestCase):
> +
> +@OETestID(240)
> +def test_check_bash(self):
> +status, output = self.target.run('which bash')
> +msg = ('bash shell not working as expected. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(228)
> +def test_runlevel_5(self):
> +status, output = self.target.run('init 5')
> +msg = ('System unable to init 5 '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 255, msg = msg)
> +time.sleep(2)
> +command = 'bsphardware -r 5'
> +status, output = self.target.run(command)
> +msg = ('System did not start from runlevel 5. '
> +'Status:%s.' % (status))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(198)
> +def test_runlevel_3(self):
> +status, output = self.target.run('init 3')
> +msg = ('System unable to start with runlevel 3. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 255, msg = msg)
> +time.sleep(2)
> +command = 'bsphardware -r 3'
> +status, output = self.target.run(command)
> +msg = ('Unable to change from runlevel 5 to 3. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +class BspHardwareTest(OERuntimeTestCase):
> +
> +@classmethod
> +def setUpClass(cls):
> +src = os.path.join(cls.tc.runtime_files_dir, 'bsphardware')
> +cls.tc.target.run('mkdir ~/test')
> +cls.tc.target.copyTo(src, '/usr/bin')
> +
> +@classmethod
> +def tearDownClass(cls):
> +cls.tc.target.run('rm -rf ~/test')
> +
> +@OETestID(216)
> +def test_USB_mount(self):
> +command = 'bsphardware -d sd -sp 1 -m ~/test/stick'
> +status, output = self.target.run(command)
> +msg = ('Unable to mount USB stick. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(217)
> +@OETestDepends(['manualbsp.BspHardwareTest.test_USB_write_file'])
> +def test_USB_read_file(self):
> +command = 'cat ~/test/stick/hello_stick'
> +status, output = self.target.run(command)
> +msg = ('Unable to read file from USB stick. '
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestDepends(['manualbsp.BspHardwareTest.test_USB_mount'])
> +@OETestID(219)
> +def test_USB_write_file(self):
> +command = 'touch ~/test/stick/hello_stick'
> +status, output = self.target.run(command)
> +msg = ('Status and  output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestDepends(['manualbsp.BspHardwareTest.test_USB_mount'])
> +@OETestID(218)
> +def test_USB_unmount(self):
> +command = 'bsphardware -u ~/test/stick'
> +status, output = self.target.run(command)
> +msg = ('Unable to unmount USB stick. ' 
> +'Status and output:%s and %s.' % (status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +@OETestID(241)
> +def test_MicroSD_mount(self):
> +command = 'bsphardware -d mmc -sp p1 -m ~/test/microsd'
> +status, output = self.target.run(command)
> +msg = ('Unable to mount MicroSD. '
> +'Status and output:%s and %s.' %(status, output))
> +self.assertEqual(status, 0, msg = msg)
> +
> +

[yocto] [PATCH] runtime: Add support to manual BSP test cases

2018-07-13 Thread mohamad . noor . alim . hussin
From: Mohamad Noor Alim Hussin 

This is manual BSP test cases that have converted to auto test cases
for QA release. Manualbsp.py has dependency on file bsphardware that run
on hardware.

Signed-off-by: Mohamad Noor Alim Hussin 
---
 meta/lib/oeqa/runtime/cases/manualbsp.py | 122 
 meta/lib/oeqa/runtime/files/bsphardware  | 132 +++
 2 files changed, 254 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/manualbsp.py
 create mode 100755 meta/lib/oeqa/runtime/files/bsphardware

diff --git a/meta/lib/oeqa/runtime/cases/manualbsp.py 
b/meta/lib/oeqa/runtime/cases/manualbsp.py
new file mode 100644
index 000..22d0d33
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/manualbsp.py
@@ -0,0 +1,122 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+import subprocess
+import time
+
+class BspRuntimeTest(OERuntimeTestCase):
+
+@OETestID(240)
+def test_check_bash(self):
+status, output = self.target.run('which bash')
+msg = ('bash shell not working as expected. '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestID(228)
+def test_runlevel_5(self):
+status, output = self.target.run('init 5')
+msg = ('System unable to init 5 '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 255, msg = msg)
+time.sleep(2)
+command = 'bsphardware -r 5'
+status, output = self.target.run(command)
+msg = ('System did not start from runlevel 5. '
+'Status:%s.' % (status))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestID(198)
+def test_runlevel_3(self):
+status, output = self.target.run('init 3')
+msg = ('System unable to start with runlevel 3. '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 255, msg = msg)
+time.sleep(2)
+command = 'bsphardware -r 3'
+status, output = self.target.run(command)
+msg = ('Unable to change from runlevel 5 to 3. '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+class BspHardwareTest(OERuntimeTestCase):
+
+@classmethod
+def setUpClass(cls):
+src = os.path.join(cls.tc.runtime_files_dir, 'bsphardware')
+cls.tc.target.run('mkdir ~/test')
+cls.tc.target.copyTo(src, '/usr/bin')
+
+@classmethod
+def tearDownClass(cls):
+cls.tc.target.run('rm -rf ~/test')
+
+@OETestID(216)
+def test_USB_mount(self):
+command = 'bsphardware -d sd -sp 1 -m ~/test/stick'
+status, output = self.target.run(command)
+msg = ('Unable to mount USB stick. '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestID(217)
+@OETestDepends(['manualbsp.BspHardwareTest.test_USB_write_file'])
+def test_USB_read_file(self):
+command = 'cat ~/test/stick/hello_stick'
+status, output = self.target.run(command)
+msg = ('Unable to read file from USB stick. '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestDepends(['manualbsp.BspHardwareTest.test_USB_mount'])
+@OETestID(219)
+def test_USB_write_file(self):
+command = 'touch ~/test/stick/hello_stick'
+status, output = self.target.run(command)
+msg = ('Status and  output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestDepends(['manualbsp.BspHardwareTest.test_USB_mount'])
+@OETestID(218)
+def test_USB_unmount(self):
+command = 'bsphardware -u ~/test/stick'
+status, output = self.target.run(command)
+msg = ('Unable to unmount USB stick. ' 
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestID(241)
+def test_MicroSD_mount(self):
+command = 'bsphardware -d mmc -sp p1 -m ~/test/microsd'
+status, output = self.target.run(command)
+msg = ('Unable to mount MicroSD. '
+'Status and output:%s and %s.' %(status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestDepends(['manualbsp.BspHardwareTest.test_MicroSD_write_file'])
+@OETestID(242)
+def test_MicroSD_read_file(self):
+command = 'cat ~/test/microsd/hello_mmc'
+status, output = self.target.run(command)
+msg = ('Unable to read MicroSD. '
+'Status and output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestDepends(['manualbsp.BspHardwareTest.test_MicroSD_mount'])
+@OETestID(244)
+