Re: [OE-core] [PATCH] oeqa/selftest: Automate manual pybootchart tests

2019-05-09 Thread akuster808



On 5/9/19 9:58 AM, Richard Purdie wrote:
> Automate the current manual pybootchart tests. This includes a check
> for the cairo dependency, skipping the test if appropriate.
>
> Based on original patch from Armin Kuster 
>
> Signed-off-by: Richard Purdie 

Thanks.

- armin
> ---
>  meta/lib/oeqa/manual/oe-core.json | 26 -
>  meta/lib/oeqa/selftest/cases/oescripts.py | 34 +++
>  2 files changed, 34 insertions(+), 26 deletions(-)
>
> diff --git a/meta/lib/oeqa/manual/oe-core.json 
> b/meta/lib/oeqa/manual/oe-core.json
> index d893d849fb3..3ee0aa95f93 100644
> --- a/meta/lib/oeqa/manual/oe-core.json
> +++ b/meta/lib/oeqa/manual/oe-core.json
> @@ -1,30 +1,4 @@
>  [
> -  {
> -"test": {
> -  "@alias": 
> "oe-core.scripts.Use_scripts/pybootchartgui/pybootchartgui.py_to_generate_build_profiles",
> -  "author": [
> -{
> -  "email": "alexandru.c.george...@intel.com",
> -  "name": "alexandru.c.george...@intel.com"
> -}
> -  ],
> -  "execution": {
> -"1": {
> -  "action": "Run a build for a recipe (e.g. core-image-minimal)",
> -  "expected_results": ""
> -},
> -"2": {
> -  "action": "Run the profiling script, 
> ../scripts/pybootchartgui/pybootchartgui.py  tmp/buildstats/\n\n",
> -  "expected_results": ""
> -},
> -"3": {
> -  "action": "Verify the results ",
> -  "expected_results": "The scripts generates svg files with the 
> profiling results . "
> -}
> -  },
> -  "summary": 
> "Use_scripts/pybootchartgui/pybootchartgui.py_to_generate_build_profiles"
> -}
> -  },
>{
>  "test": {
>"@alias": "oe-core.scripts.Crosstap_script_check",
> diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py 
> b/meta/lib/oeqa/selftest/cases/oescripts.py
> index 56b35b59eb8..217afe3775b 100644
> --- a/meta/lib/oeqa/selftest/cases/oescripts.py
> +++ b/meta/lib/oeqa/selftest/cases/oescripts.py
> @@ -2,6 +2,7 @@
>  # SPDX-License-Identifier: MIT
>  #
>  
> +import os
>  from oeqa.selftest.case import OESelftestTestCase
>  from oeqa.selftest.cases.buildhistory import BuildhistoryBase
>  from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, 
> get_test_layer
> @@ -28,3 +29,36 @@ class BuildhistoryDiffTests(BuildhistoryBase):
>  self.fail('Unexpected line:\n%s\nExpected line endings:\n  
> %s' % (line, '\n  '.join(expected_endlines)))
>  if expected_endlines:
>  self.fail('Missing expected line endings:\n  %s' % '\n  
> '.join(expected_endlines))
> +
> +class OEScriptTests(OESelftestTestCase):
> +
> +@classmethod
> +def setUpClass(cls):
> +super(OEScriptTests, cls).setUpClass()
> +try:
> +import cairo
> +except ImportError:
> +cls.skipTest('Python module cairo is not present')
> +bitbake("core-image-minimal -c rootfs -f")
> +cls.tmpdir = get_bb_var('TMPDIR')
> +cls.buildstats = cls.tmpdir + "/buildstats/" + 
> sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1]
> +
> +scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
> +
> +class OEPybootchartguyTests(OEScriptTests):
> +
> +def test_pybootchartguy_help(self):
> +runCmd('%s/pybootchartgui/pybootchartgui.py  --help' % 
> self.scripts_dir)
> +
> +def test_pybootchartguy_to_generate_build_png_output(self):
> +runCmd('%s/pybootchartgui/pybootchartgui.py  %s -o %s/charts -f png' 
> % (self.scripts_dir, self.buildstats, self.tmpdir))
> +self.assertTrue(os.path.exists(self.tmpdir + "/charts.png"))
> +
> +def test_pybootchartguy_to_generate_build_svg_output(self):
> +runCmd('%s/pybootchartgui/pybootchartgui.py  %s -o %s/charts -f svg' 
> % (self.scripts_dir, self.buildstats, self.tmpdir))
> +self.assertTrue(os.path.exists(self.tmpdir + "/charts.svg"))
> +
> +def test_pybootchartguy_to_generate_build_pdf_output(self):
> +runCmd('%s/pybootchartgui/pybootchartgui.py  %s -o %s/charts -f pdf' 
> % (self.scripts_dir, self.buildstats, self.tmpdir))
> +self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf"))
> +

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


[OE-core] [PATCH] oeqa/selftest: Automate manual pybootchart tests

2019-05-09 Thread Richard Purdie
Automate the current manual pybootchart tests. This includes a check
for the cairo dependency, skipping the test if appropriate.

Based on original patch from Armin Kuster 

Signed-off-by: Richard Purdie 
---
 meta/lib/oeqa/manual/oe-core.json | 26 -
 meta/lib/oeqa/selftest/cases/oescripts.py | 34 +++
 2 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/meta/lib/oeqa/manual/oe-core.json 
b/meta/lib/oeqa/manual/oe-core.json
index d893d849fb3..3ee0aa95f93 100644
--- a/meta/lib/oeqa/manual/oe-core.json
+++ b/meta/lib/oeqa/manual/oe-core.json
@@ -1,30 +1,4 @@
 [
-  {
-"test": {
-  "@alias": 
"oe-core.scripts.Use_scripts/pybootchartgui/pybootchartgui.py_to_generate_build_profiles",
-  "author": [
-{
-  "email": "alexandru.c.george...@intel.com",
-  "name": "alexandru.c.george...@intel.com"
-}
-  ],
-  "execution": {
-"1": {
-  "action": "Run a build for a recipe (e.g. core-image-minimal)",
-  "expected_results": ""
-},
-"2": {
-  "action": "Run the profiling script, 
../scripts/pybootchartgui/pybootchartgui.py  tmp/buildstats/\n\n",
-  "expected_results": ""
-},
-"3": {
-  "action": "Verify the results ",
-  "expected_results": "The scripts generates svg files with the 
profiling results . "
-}
-  },
-  "summary": 
"Use_scripts/pybootchartgui/pybootchartgui.py_to_generate_build_profiles"
-}
-  },
   {
 "test": {
   "@alias": "oe-core.scripts.Crosstap_script_check",
diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py 
b/meta/lib/oeqa/selftest/cases/oescripts.py
index 56b35b59eb8..217afe3775b 100644
--- a/meta/lib/oeqa/selftest/cases/oescripts.py
+++ b/meta/lib/oeqa/selftest/cases/oescripts.py
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: MIT
 #
 
+import os
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.selftest.cases.buildhistory import BuildhistoryBase
 from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, 
get_test_layer
@@ -28,3 +29,36 @@ class BuildhistoryDiffTests(BuildhistoryBase):
 self.fail('Unexpected line:\n%s\nExpected line endings:\n  %s' 
% (line, '\n  '.join(expected_endlines)))
 if expected_endlines:
 self.fail('Missing expected line endings:\n  %s' % '\n  
'.join(expected_endlines))
+
+class OEScriptTests(OESelftestTestCase):
+
+@classmethod
+def setUpClass(cls):
+super(OEScriptTests, cls).setUpClass()
+try:
+import cairo
+except ImportError:
+cls.skipTest('Python module cairo is not present')
+bitbake("core-image-minimal -c rootfs -f")
+cls.tmpdir = get_bb_var('TMPDIR')
+cls.buildstats = cls.tmpdir + "/buildstats/" + 
sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1]
+
+scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
+
+class OEPybootchartguyTests(OEScriptTests):
+
+def test_pybootchartguy_help(self):
+runCmd('%s/pybootchartgui/pybootchartgui.py  --help' % 
self.scripts_dir)
+
+def test_pybootchartguy_to_generate_build_png_output(self):
+runCmd('%s/pybootchartgui/pybootchartgui.py  %s -o %s/charts -f png' % 
(self.scripts_dir, self.buildstats, self.tmpdir))
+self.assertTrue(os.path.exists(self.tmpdir + "/charts.png"))
+
+def test_pybootchartguy_to_generate_build_svg_output(self):
+runCmd('%s/pybootchartgui/pybootchartgui.py  %s -o %s/charts -f svg' % 
(self.scripts_dir, self.buildstats, self.tmpdir))
+self.assertTrue(os.path.exists(self.tmpdir + "/charts.svg"))
+
+def test_pybootchartguy_to_generate_build_pdf_output(self):
+runCmd('%s/pybootchartgui/pybootchartgui.py  %s -o %s/charts -f pdf' % 
(self.scripts_dir, self.buildstats, self.tmpdir))
+self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf"))
+
-- 
2.20.1

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