Re: [yocto] [PATCH] runtime: add BSP test case for usb storage

2018-10-01 Thread Mike Looijmans

On 24-09-18 23:01, Paul Eggleton wrote:

On Monday, 24 September 2018 3:02:28 PM NZST Hussin, Mohamad Noor Alim wrote:

...

Otherwise I agree with Mike's reply, we should avoid writing to the storage 
device as part of the test.


It is mean that just do test like mount and unmount only? To read something in 
storage device we need to write at first place?


That's true - but you can still do a read test if you make it a precondition of 
the test
that you write some known file to the storage device before running the test
(as part of setup, just as you need to set up the board/device before
running any tests - you just need to ensure this gets documented somewhere).


You're not testing the USB device, you're testing the USB stack. To do that, 
just reading some data from "/dev/sda" is sufficient. You don't even need to 
mount it. If this works, the stack is okay. If there are transfer errors or 
problems, the USB stack will tell you about it.

--
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [PATCH] runtime: add BSP test case for usb storage

2018-09-24 Thread Paul Eggleton
On Monday, 24 September 2018 3:02:28 PM NZST Hussin, Mohamad Noor Alim wrote:
> This patch is my supersede of earlier "manualbsp" which I split into 2 parts 
> called usb test and microsd test.

OK thanks.

> I would use MACHINE_FEATURES = "usbhost" instead of introducing new variable 
> as it would eliminate problem in case someone try to execute the usb test 
> case without enable the "HARDWARE_TEST = 1" 

Sorry I don't understand - do you mean you will use it or you can't?

> or download the image form public autobuilder.

The test won't do anything in an image by default, only when you're running 
the test. In any case if the test isn't writing to the device there shouldn't 
be any major risk.

> > Otherwise I agree with Mike's reply, we should avoid writing to the storage 
> > device as part of the test.
> 
> It is mean that just do test like mount and unmount only? To read something 
> in storage device we need to write at first place? 

That's true - but you can still do a read test if you make it a precondition of 
the test
that you write some known file to the storage device before running the test 
(as part of setup, just as you need to set up the board/device before
running any tests - you just need to ensure this gets documented somewhere).

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [PATCH] runtime: add BSP test case for usb storage

2018-09-23 Thread Hussin, Mohamad Noor Alim
HI Paul,

This patch is my supersede of earlier "manualbsp" which I split into 2 parts 
called usb test and microsd test.
I would use MACHINE_FEATURES = "usbhost" instead of introducing new variable as 
it would eliminate problem in case someone try to execute the usb test case 
without enable the "HARDWARE_TEST = 1" or download the image form public 
autobuilder.

> Otherwise I agree with Mike's reply, we should avoid writing to the storage 
> device as part of the test.

It is mean that just do test like mount and unmount only? To read something in 
storage device we need to write at first place? 


Regards,
Alim Hussin

-Original Message-
From: Paul Eggleton [mailto:paul.eggle...@linux.intel.com] 
Sent: Monday, September 24, 2018 4:50 AM
To: Hussin, Mohamad Noor Alim 
Cc: yocto@yoctoproject.org
Subject: Re: [yocto] [PATCH] runtime: add BSP test case for usb storage

Hi Alim,

On Monday, 20 August 2018 3:22:09 AM NZST mohamad.noor.alim.hus...@intel.com 
wrote:
> From: Mohamad Noor Alim Hussin 
> 
> Contain test cases to test mount/unmount the usb stick on target 
> platform such as minnowboard and beaglebone. The test assume that the 
> usb storage device such as usb thumb drive was plugged into the target 
> device otherwise the test for would failed. It also test to read and 
> write from usb thumb drive. Usb test cases start with mount the usb 
> thumb drive then write and read from it. Lastly, it will unmount it. 
> If the usb thumb drive unable to mount due to corrupt of partition or 
> not exists, then the mount test will failed and the following test 
> would skip.

Does this supersede part of your earlier "manualbsp" patch? It's not made clear 
here or in the cover letter but it looks like it might.

The helper script patch needs to come before this patch rather than after it, 
since this patch won't work without it.
 
> This test need to enable flag 'HARDWARE_TEST = "1"' on conf/local.conf 
> file in order to run on target device. This test should be skip on qemu.

Can we use "usbhost" being in MACHINE_FEATURES and MACHINE not starting with 
"qemu" to enable this instead of adding another variable? (Assuming that sounds 
reasonable to everyone else)

Otherwise I agree with Mike's reply, we should avoid writing to the storage 
device as part of the test.

Also, as this is patching OE-Core, the patch needs to be sent to the 
openembedded-c...@lists.openembedded.org mailing list, if you could please use 
that for the next revision that would be great.

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [PATCH] runtime: add BSP test case for usb storage

2018-09-23 Thread Paul Eggleton
Hi Alim,

On Monday, 20 August 2018 3:22:09 AM NZST mohamad.noor.alim.hus...@intel.com 
wrote:
> From: Mohamad Noor Alim Hussin 
> 
> Contain test cases to test mount/unmount the usb stick on target
> platform such as minnowboard and beaglebone. The test assume that
> the usb storage device such as usb thumb drive was plugged into
> the target device otherwise the test for would failed. It also test
> to read and write from usb thumb drive. Usb test cases start with
> mount the usb thumb drive then write and read from it. Lastly, it
> will unmount it. If the usb thumb drive unable to mount due to corrupt
> of partition or not exists, then the mount test will failed and the
> following test would skip.

Does this supersede part of your earlier "manualbsp" patch? It's not made
clear here or in the cover letter but it looks like it might.

The helper script patch needs to come before this patch rather than after it,
since this patch won't work without it.
 
> This test need to enable flag 'HARDWARE_TEST = "1"' on conf/local.conf
> file in order to run on target device. This test should be skip on qemu.

Can we use "usbhost" being in MACHINE_FEATURES and MACHINE not starting
with "qemu" to enable this instead of adding another variable? (Assuming that
sounds reasonable to everyone else)

Otherwise I agree with Mike's reply, we should avoid writing to the storage
device as part of the test.

Also, as this is patching OE-Core, the patch needs to be sent to the 
openembedded-c...@lists.openembedded.org mailing list, if you could
please use that for the next revision that would be great.

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [PATCH] runtime: add BSP test case for usb storage

2018-08-20 Thread Mike Looijmans
I would not write to flash media in this test. It's pointless, if you can read 
the the device, it means that you can already send commands and data to it, 
and reading will thus test data going in both directions already. Writing to 
the media will just wear it out, and if there's a problem unmounting it, it 
may lead to a corrupted filesystem and yield unpredictable future results.



On 19-08-18 17:22, mohamad.noor.alim.hus...@intel.com wrote:

From: Mohamad Noor Alim Hussin 

Contain test cases to test mount/unmount the usb stick on target
platform such as minnowboard and beaglebone. The test assume that
the usb storage device such as usb thumb drive was plugged into
the target device otherwise the test for would failed. It also test
to read and write from usb thumb drive. Usb test cases start with
mount the usb thumb drive then write and read from it. Lastly, it
will unmount it. If the usb thumb drive unable to mount due to corrupt
of partition or not exists, then the mount test will failed and the
following test would skip.

This test need to enable flag 'HARDWARE_TEST = "1"' on conf/local.conf
file in order to run on target device. This test should be skip on qemu.

Signed-off-by: Mohamad Noor Alim Hussin 
---
  meta/lib/oeqa/runtime/cases/usb.py | 54 ++
  1 file changed, 54 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/usb.py

diff --git a/meta/lib/oeqa/runtime/cases/usb.py 
b/meta/lib/oeqa/runtime/cases/usb.py
new file mode 100644
index 000..3e17645
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/usb.py
@@ -0,0 +1,54 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotDataVar
+
+class USBTest(OERuntimeTestCase):
+@classmethod
+def setUpClass(cls):
+cls.hw_test_path = '~/test'
+cls.usb_path = os.path.join(cls.hw_test_path, 'stick')
+cls.usb_file = os.path.join(cls.usb_path, 'hello_stick')
+src = os.path.join(cls.tc.runtime_files_dir, 'bsp-test-helper')
+cls.tc.target.run('mkdir -p %s' % (cls.usb_path))
+cls.tc.target.copyTo(src, '/usr/bin')
+
+@classmethod
+def tearDownClass(cls):
+cls.tc.target.run('rm -rf %s' % (cls.hw_test_path))
+
+@skipIfNotDataVar('HARDWARE_TEST','1',
+'Usb test only run on platform. It will skip on qemu.')
+@OETestID(216)
+def test_usb_mount(self):
+command = ('bsp-test-helper --mount pendrive %s' % (self.usb_path))
+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(['usb.USBTest.test_usb_write_file'])
+def test_usb_read_file(self):
+command = ('cat %s' % (self.usb_file))
+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(['usb.USBTest.test_usb_mount'])
+@OETestID(219)
+def test_usb_write_file(self):
+command = ('echo hello_world > %s' % (self.usb_file))
+status, output = self.target.run(command)
+msg = ('Status and  output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestDepends(['usb.USBTest.test_usb_mount'])
+@OETestID(218)
+def test_usb_unmount(self):
+command = ('bsp-test-helper --umount %s' % (self.usb_path))
+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)



--
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [PATCH] runtime: add BSP test case for usb storage

2018-08-19 Thread mohamad . noor . alim . hussin
From: Mohamad Noor Alim Hussin 

Contain test cases to test mount/unmount the usb stick on target
platform such as minnowboard and beaglebone. The test assume that
the usb storage device such as usb thumb drive was plugged into
the target device otherwise the test for would failed. It also test
to read and write from usb thumb drive. Usb test cases start with
mount the usb thumb drive then write and read from it. Lastly, it
will unmount it. If the usb thumb drive unable to mount due to corrupt
of partition or not exists, then the mount test will failed and the
following test would skip.

This test need to enable flag 'HARDWARE_TEST = "1"' on conf/local.conf
file in order to run on target device. This test should be skip on qemu.

Signed-off-by: Mohamad Noor Alim Hussin 
---
 meta/lib/oeqa/runtime/cases/usb.py | 54 ++
 1 file changed, 54 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/usb.py

diff --git a/meta/lib/oeqa/runtime/cases/usb.py 
b/meta/lib/oeqa/runtime/cases/usb.py
new file mode 100644
index 000..3e17645
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/usb.py
@@ -0,0 +1,54 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotDataVar
+
+class USBTest(OERuntimeTestCase):
+@classmethod
+def setUpClass(cls):
+cls.hw_test_path = '~/test'
+cls.usb_path = os.path.join(cls.hw_test_path, 'stick')
+cls.usb_file = os.path.join(cls.usb_path, 'hello_stick')
+src = os.path.join(cls.tc.runtime_files_dir, 'bsp-test-helper')
+cls.tc.target.run('mkdir -p %s' % (cls.usb_path))
+cls.tc.target.copyTo(src, '/usr/bin')
+
+@classmethod
+def tearDownClass(cls):
+cls.tc.target.run('rm -rf %s' % (cls.hw_test_path))
+
+@skipIfNotDataVar('HARDWARE_TEST','1',
+'Usb test only run on platform. It will skip on qemu.')
+@OETestID(216)
+def test_usb_mount(self):
+command = ('bsp-test-helper --mount pendrive %s' % (self.usb_path))
+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(['usb.USBTest.test_usb_write_file'])
+def test_usb_read_file(self):
+command = ('cat %s' % (self.usb_file))
+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(['usb.USBTest.test_usb_mount'])
+@OETestID(219)
+def test_usb_write_file(self):
+command = ('echo hello_world > %s' % (self.usb_file))
+status, output = self.target.run(command)
+msg = ('Status and  output:%s and %s.' % (status, output))
+self.assertEqual(status, 0, msg = msg)
+
+@OETestDepends(['usb.USBTest.test_usb_mount'])
+@OETestID(218)
+def test_usb_unmount(self):
+command = ('bsp-test-helper --umount %s' % (self.usb_path))
+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)
-- 
2.7.4

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto