[OE-core] [PATCH] oeqa/runtime/cases/manualbsp: Add BSP testcases

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

Manualbsp.py contain test cases that was converted from manual testcases
to auto which would run on Yocto reference boards such as Minnowboard,
NUC, edgerouter and beaglebone. The testcase was added to support QA
automation which target devices attached with removable media and would
boot up using LAVA faramework. The testcase ID was taken form existing
manual testcase on Testopia[1].

There are 2 scripts called manualbsp.py and bsphardware that needed
to execute the test cases.

Manualbsp.py contain testcases that need to run on target devices.
There are 2 classes in this patch, BSPRuntimeTest and BSPHardwareTest.
BSPRuntimeTest class used to run test such as check runlevel 3 or 5
at runtime and check bash package.

BSPHardware class would run test on removeable media such as USB stick,
hard disk and MicroSD. The test cases are mount/unmount, read & write
to removable media.

Bsphardware script was written to reduce complexity of code from
Manualbsp.py. It is used for device detection, mount/unmount and
check runlevel on target device under test. This script would copy
to target device as Manualbsp.py depend on it.

Reference:
[1] https://bugzilla.yoctoproject.org/tr_show_run.cgi?run_id=9635.

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.targ

[OE-core] [PATCH] recipetool: Change srcuri mirror to yoctoproject site

2018-11-09 Thread mohamad . noor . alim . hussin
From: Mohamad Noor Alim Hussin 

This patch resolve bug 12979 due to checksum of navit-0.5.0
has changed from sourceforge. The srcuri mirror was change to
yoctoproject.org.

Signed-off-by: Mohamad Noor Alim Hussin 
---
 meta/lib/oeqa/selftest/cases/recipetool.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py 
b/meta/lib/oeqa/selftest/cases/recipetool.py
index cd15df1..06f980e 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -433,12 +433,12 @@ class RecipetoolTests(RecipetoolBase):
 temprecipe = os.path.join(self.tempdir, 'recipe')
 os.makedirs(temprecipe)
 recipefile = os.path.join(temprecipe, 'navit_0.5.0.bb')
-srcuri = 
'http://downloads.sourceforge.net/project/navit/v0.5.0/navit-0.5.0.tar.gz'
+srcuri = 
'http://downloads.yoctoproject.org/mirror/sources/navit-0.5.0.tar.gz'
 result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
 self.assertTrue(os.path.isfile(recipefile))
 checkvars = {}
 checkvars['LICENSE'] = set(['Unknown', 'GPLv2', 'LGPLv2'])
-checkvars['SRC_URI'] = 
'http://downloads.sourceforge.net/project/navit/v${PV}/navit-${PV}.tar.gz'
+checkvars['SRC_URI'] = 
'http://downloads.yoctoproject.org/mirror/sources/navit-${PV}.tar.gz'
 checkvars['SRC_URI[md5sum]'] = '242f398e979a6b8c0f3c802b63435b68'
 checkvars['SRC_URI[sha256sum]'] = 
'13353481d7fc01a4f64e385dda460b51496366bba0fd2cc85a89a0747910e94d'
 checkvars['DEPENDS'] = set(['freetype', 'zlib', 'openssl', 'glib-2.0', 
'virtual/libgl', 'virtual/egl', 'gtk+', 'libpng', 'libsdl', 'freeglut', 
'dbus-glib', 'fribidi'])
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core