Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-12-13 Thread Burton, Ross
On 13 December 2016 at 16:53, Jose Perez Carranza <
jose.perez.carra...@linux.intel.com> wrote:

> at my host is very fast the load (1 second)
>

Okay, proof that I need a new build machine. :)


> Ok, just wondering if oe-selftest -l will also list those test cases ??
>

Huh.  -l doesn't, but -m does.

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


Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-12-13 Thread Jose Perez Carranza



On 12/13/2016 10:32 AM, Burton, Ross wrote:


On 13 December 2016 at 16:17, Burton, Ross > wrote:


It took over a minute to load a few tests.  Do you have any idea
why the discovery is so slow?



at my host is very fast the load (1 second)

jgperezc@jgperezc:~/poky-oetest/build$ oe-selftest  -r oelib-tests.elf 
oelib-tests.license oelib-tests.path oelib-tests.types oelib-tests.utils

2016-12-13 10:48:28,333 - selftest - INFO - Running bitbake -e to get BBPATH
2016-12-13 10:48:29,125 - selftest - INFO - Checking that everything is 
in order before running the tests

2016-12-13 10:48:29,833 - selftest - INFO - Running bitbake -p
2016-12-13 10:48:52,181 - selftest - INFO - test runner init'ed like 
unittest
2016-12-13 10:48:52,995 - selftest - INFO - Loading tests from: 
oeqa.selftest.oelib-tests.elf
2016-12-13 10:48:52,998 - selftest - INFO - Loading tests from: 
oeqa.selftest.oelib-tests.license
2016-12-13 10:48:53,000 - selftest - INFO - Loading tests from: 
oeqa.selftest.oelib-tests.path
2016-12-13 10:48:53,001 - selftest - INFO - Loading tests from: 
oeqa.selftest.oelib-tests.types
2016-12-13 10:48:53,003 - selftest - INFO - Loading tests from: 
oeqa.selftest.oelib-tests.utils
2016-12-13 10:48:53,005 - selftest - INFO - Adding: "include 
selftest.inc" in local.conf
2016-12-13 10:48:53,005 - selftest - INFO - Adding: "include 
bblayers.inc" in bblayers.conf



Oh, it's because oeselftest does bitbake calls isn't it.

Good news: you don't need to use oeSelfTest at all, the discovery 
works fine with standard unittest.TestCase objects.


Patch incoming. :)


Ok, just wondering if oe-selftest -l will also list those test cases ??

Ross



--
Saludos
José

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


Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-12-13 Thread Burton, Ross
On 13 December 2016 at 16:17, Burton, Ross  wrote:

> It took over a minute to load a few tests.  Do you have any idea why the
> discovery is so slow?
>

Oh, it's because oeselftest does bitbake calls isn't it.

Good news: you don't need to use oeSelfTest at all, the discovery works
fine with standard unittest.TestCase objects.

Patch incoming. :)

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


Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-12-13 Thread Burton, Ross
On 15 November 2016 at 16:24,  wrote:

> Currently the unittests for scripts on meta/lib/oe/tests are not being
> executed by any suite hence the best option is migrate them to
> meta/lib/oeqa/selftest/oelib-tests to be executed along with the selftest
> suite.
>

For some reason the discovery is very slow:

$ oe-selftest  -r oelib-tests.elf oelib-tests.license oelib-tests.path
oelib-tests.types oelib-tests.utils
2016-12-13 16:15:00,014 - selftest - INFO - Running bitbake -e to get BBPATH
2016-12-13 16:15:03,143 - selftest - INFO - Checking that everything is in
order before running the tests
2016-12-13 16:15:06,512 - selftest - INFO - Running bitbake -p
2016-12-13 16:15:10,203 - selftest - INFO - test runner init'ed like
unittest
2016-12-13 16:15:13,428 - selftest - INFO - Loading tests from:
oeqa.selftest.oelib-tests.elf
2016-12-13 16:15:16,489 - selftest - INFO - Loading tests from:
oeqa.selftest.oelib-tests.license
2016-12-13 16:15:29,391 - selftest - INFO - Loading tests from:
oeqa.selftest.oelib-tests.path
2016-12-13 16:15:38,822 - selftest - INFO - Loading tests from:
oeqa.selftest.oelib-tests.types
2016-12-13 16:15:57,719 - selftest - INFO - Loading tests from:
oeqa.selftest.oelib-tests.utils

It took over a minute to load a few tests.  Do you have any idea why the
discovery is so slow?

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


Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-11-15 Thread Benjamin Esquivel
Looks good to me, thanks for sending the v2.

> -Original Message-
> From: openembedded-core-boun...@lists.openembedded.org
> [mailto:openembedded-core-boun...@lists.openembedded.org] On Behalf
> Of jose.perez.carra...@linux.intel.com
> Sent: Tuesday, November 15, 2016 10:25 AM
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to
> /oeqa/selftest/oe-tests
> 
> From: Jose Perez Carranza <jose.perez.carra...@linux.intel.com>
> 
> Currently the unittests for scripts on meta/lib/oe/tests are not being
> executed by any suite hence the best option is migrate them to
> meta/lib/oeqa/selftest/oelib-tests to be executed along with the selftest
> suite.
> 
> [YOCTO #7376]
> 
> Signed-off-by: Jose Perez Carranza <jose.perez.carra...@linux.intel.com>
> ---
>  meta/lib/oe/tests/__init__.py  |  0
>  meta/lib/oe/tests/test_elf.py  | 21 --
>  meta/lib/oe/tests/test_license.py  | 68 ---
>  meta/lib/oe/tests/test_path.py | 89
-
>  meta/lib/oe/tests/test_types.py| 62 --
>  meta/lib/oe/tests/test_utils.py| 51 ---
>  meta/lib/oeqa/selftest/oelib-tests/__init__.py |  0
>  meta/lib/oeqa/selftest/oelib-tests/elf.py  | 22 +++
>  meta/lib/oeqa/selftest/oelib-tests/license.py  | 69
> 
>  meta/lib/oeqa/selftest/oelib-tests/path.py | 90
> ++
>  meta/lib/oeqa/selftest/oelib-tests/types.py| 61 +
>  meta/lib/oeqa/selftest/oelib-tests/utils.py| 52 +++
>  12 files changed, 294 insertions(+), 291 deletions(-)  delete mode 100644
> meta/lib/oe/tests/__init__.py  delete mode 100644
> meta/lib/oe/tests/test_elf.py  delete mode 100644
> meta/lib/oe/tests/test_license.py  delete mode 100644
> meta/lib/oe/tests/test_path.py  delete mode 100644
> meta/lib/oe/tests/test_types.py  delete mode 100644
> meta/lib/oe/tests/test_utils.py  create mode 100644
> meta/lib/oeqa/selftest/oelib-tests/__init__.py
>  create mode 100644 meta/lib/oeqa/selftest/oelib-tests/elf.py
>  create mode 100644 meta/lib/oeqa/selftest/oelib-tests/license.py
>  create mode 100644 meta/lib/oeqa/selftest/oelib-tests/path.py
>  create mode 100644 meta/lib/oeqa/selftest/oelib-tests/types.py
>  create mode 100644 meta/lib/oeqa/selftest/oelib-tests/utils.py
> 
> diff --git a/meta/lib/oe/tests/__init__.py b/meta/lib/oe/tests/__init__.py
> deleted file mode 100644 index e69de29..000 diff --git
> a/meta/lib/oe/tests/test_elf.py b/meta/lib/oe/tests/test_elf.py deleted
file
> mode 100644 index 1f59037..000
> --- a/meta/lib/oe/tests/test_elf.py
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -import unittest
> -import oe.qa
> -
> -class TestElf(unittest.TestCase):
> -def test_machine_name(self):
> -"""
> -Test elf_machine_to_string()
> -"""
> -self.assertEqual(oe.qa.elf_machine_to_string(0x02), "SPARC")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x03), "x86")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x08), "MIPS")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x14), "PowerPC")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x28), "ARM")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x2A), "SuperH")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x32), "IA-64")
> -self.assertEqual(oe.qa.elf_machine_to_string(0x3E), "x86-64")
> -self.assertEqual(oe.qa.elf_machine_to_string(0xB7), "AArch64")
> -
> -self.assertEqual(oe.qa.elf_machine_to_string(0x00), "Unknown
(0)")
> -self.assertEqual(oe.qa.elf_machine_to_string(0xDEADBEEF),
"Unknown
> (3735928559)")
> -self.assertEqual(oe.qa.elf_machine_to_string("foobar"), "Unknown
> ('foobar')")
> diff --git a/meta/lib/oe/tests/test_license.py
> b/meta/lib/oe/tests/test_license.py
> deleted file mode 100644
> index c36..000
> --- a/meta/lib/oe/tests/test_license.py
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -import unittest
> -import oe.license
> -
> -class SeenVisitor(oe.license.LicenseVisitor):
> -def __init__(self):
> -self.seen = []
> -oe.license.LicenseVisitor.__init__(self)
> -
> -def visit_Str(self, node):
> -self.seen.append(node.s)
> -
> -class TestSingleLicense(unittest.TestCase):
> -licenses = [
> -"GPLv2",
> -"LGPL-2.0",
> 

Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-11-15 Thread Jose Perez Carranza



On 11/15/2016 11:16 AM, Burton, Ross wrote:


On 15 November 2016 at 16:24, > wrote:


+class TestPackagesFilterOutSystem(oeSelfTest):


As the tests don't need anything special that oeSelfTest provides, can 
they remain as testcase.TestCase instances? There's a lot of 
complication from oeSelfTest that isn't required.


In order to the test cases be recognized and executed as part of the 
suite they need to be in the same context of selftest hence be an 
instance of oeSelftest.

Ross


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


Re: [OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-11-15 Thread Burton, Ross
On 15 November 2016 at 16:24,  wrote:

> +class TestPackagesFilterOutSystem(oeSelfTest):
>

As the tests don't need anything special that oeSelfTest provides, can they
remain as testcase.TestCase instances?  There's a lot of complication from
oeSelfTest that isn't required.

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


[OE-core] [PATCH v2] oe-tests: Migrate tests from /oe/test to /oeqa/selftest/oe-tests

2016-11-15 Thread jose . perez . carranza
From: Jose Perez Carranza 

Currently the unittests for scripts on meta/lib/oe/tests are not being
executed by any suite hence the best option is migrate them to
meta/lib/oeqa/selftest/oelib-tests to be executed along with the selftest suite.

[YOCTO #7376]

Signed-off-by: Jose Perez Carranza 
---
 meta/lib/oe/tests/__init__.py  |  0
 meta/lib/oe/tests/test_elf.py  | 21 --
 meta/lib/oe/tests/test_license.py  | 68 ---
 meta/lib/oe/tests/test_path.py | 89 -
 meta/lib/oe/tests/test_types.py| 62 --
 meta/lib/oe/tests/test_utils.py| 51 ---
 meta/lib/oeqa/selftest/oelib-tests/__init__.py |  0
 meta/lib/oeqa/selftest/oelib-tests/elf.py  | 22 +++
 meta/lib/oeqa/selftest/oelib-tests/license.py  | 69 
 meta/lib/oeqa/selftest/oelib-tests/path.py | 90 ++
 meta/lib/oeqa/selftest/oelib-tests/types.py| 61 +
 meta/lib/oeqa/selftest/oelib-tests/utils.py| 52 +++
 12 files changed, 294 insertions(+), 291 deletions(-)
 delete mode 100644 meta/lib/oe/tests/__init__.py
 delete mode 100644 meta/lib/oe/tests/test_elf.py
 delete mode 100644 meta/lib/oe/tests/test_license.py
 delete mode 100644 meta/lib/oe/tests/test_path.py
 delete mode 100644 meta/lib/oe/tests/test_types.py
 delete mode 100644 meta/lib/oe/tests/test_utils.py
 create mode 100644 meta/lib/oeqa/selftest/oelib-tests/__init__.py
 create mode 100644 meta/lib/oeqa/selftest/oelib-tests/elf.py
 create mode 100644 meta/lib/oeqa/selftest/oelib-tests/license.py
 create mode 100644 meta/lib/oeqa/selftest/oelib-tests/path.py
 create mode 100644 meta/lib/oeqa/selftest/oelib-tests/types.py
 create mode 100644 meta/lib/oeqa/selftest/oelib-tests/utils.py

diff --git a/meta/lib/oe/tests/__init__.py b/meta/lib/oe/tests/__init__.py
deleted file mode 100644
index e69de29..000
diff --git a/meta/lib/oe/tests/test_elf.py b/meta/lib/oe/tests/test_elf.py
deleted file mode 100644
index 1f59037..000
--- a/meta/lib/oe/tests/test_elf.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import unittest
-import oe.qa
-
-class TestElf(unittest.TestCase):
-def test_machine_name(self):
-"""
-Test elf_machine_to_string()
-"""
-self.assertEqual(oe.qa.elf_machine_to_string(0x02), "SPARC")
-self.assertEqual(oe.qa.elf_machine_to_string(0x03), "x86")
-self.assertEqual(oe.qa.elf_machine_to_string(0x08), "MIPS")
-self.assertEqual(oe.qa.elf_machine_to_string(0x14), "PowerPC")
-self.assertEqual(oe.qa.elf_machine_to_string(0x28), "ARM")
-self.assertEqual(oe.qa.elf_machine_to_string(0x2A), "SuperH")
-self.assertEqual(oe.qa.elf_machine_to_string(0x32), "IA-64")
-self.assertEqual(oe.qa.elf_machine_to_string(0x3E), "x86-64")
-self.assertEqual(oe.qa.elf_machine_to_string(0xB7), "AArch64")
-
-self.assertEqual(oe.qa.elf_machine_to_string(0x00), "Unknown (0)")
-self.assertEqual(oe.qa.elf_machine_to_string(0xDEADBEEF), "Unknown 
(3735928559)")
-self.assertEqual(oe.qa.elf_machine_to_string("foobar"), "Unknown 
('foobar')")
diff --git a/meta/lib/oe/tests/test_license.py 
b/meta/lib/oe/tests/test_license.py
deleted file mode 100644
index c36..000
--- a/meta/lib/oe/tests/test_license.py
+++ /dev/null
@@ -1,68 +0,0 @@
-import unittest
-import oe.license
-
-class SeenVisitor(oe.license.LicenseVisitor):
-def __init__(self):
-self.seen = []
-oe.license.LicenseVisitor.__init__(self)
-
-def visit_Str(self, node):
-self.seen.append(node.s)
-
-class TestSingleLicense(unittest.TestCase):
-licenses = [
-"GPLv2",
-"LGPL-2.0",
-"Artistic",
-"MIT",
-"GPLv3+",
-"FOO_BAR",
-]
-invalid_licenses = ["GPL/BSD"]
-
-@staticmethod
-def parse(licensestr):
-visitor = SeenVisitor()
-visitor.visit_string(licensestr)
-return visitor.seen
-
-def test_single_licenses(self):
-for license in self.licenses:
-licenses = self.parse(license)
-self.assertListEqual(licenses, [license])
-
-def test_invalid_licenses(self):
-for license in self.invalid_licenses:
-with self.assertRaises(oe.license.InvalidLicense) as cm:
-self.parse(license)
-self.assertEqual(cm.exception.license, license)
-
-class TestSimpleCombinations(unittest.TestCase):
-tests = {
-"FOO": ["FOO", "BAR"],
-"BAZ & MOO": ["BAZ", "MOO"],
-"ALPHA|BETA": ["ALPHA"],
-"BAZ|FOO": ["FOO"],
-"FOO|BAZ": ["FOO", "BAR"],
-}
-preferred = ["ALPHA", "FOO", "BAR"]
-
-def test_tests(self):
-def choose(a, b):
-if all(lic in self.preferred for lic in b):
-return b
-