All of lore.kernel.org
 help / color / mirror / Atom feed
* [[PATCHv2][autobuilder] 1/4] autobuilder/lib: Add buildsteps module for provide helpers
@ 2016-02-22 15:15 Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 2/4] autobuilder/buildsteps: Add Toaster buildsteps Aníbal Limón
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Aníbal Limón @ 2016-02-22 15:15 UTC (permalink / raw)
  To: yocto

Add ShellCommandCleanEnv helper for run command in a clean
enviroment a shell for run the command can be specified also
the variables to preserve in the new enviroment.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 .../site-packages/autobuilder/lib/buildsteps.py    | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 lib/python2.7/site-packages/autobuilder/lib/buildsteps.py

diff --git a/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py b/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
new file mode 100644
index 0000000..3693a7a
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/lib/buildsteps.py
@@ -0,0 +1,42 @@
+'''
+Created on Feb 15, 2016
+
+__author__ = "Anibal (alimon) Limon"
+__copyright__ = "Copyright 2016, Intel Corp."
+__credits__ = ["Anibal Limon"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Anibal Limon"
+__email__ = "anibal.limon@linux.intel.com"
+'''
+
+import os
+from buildbot.steps.shell import ShellCommand
+
+DEFAULT_SHELL = 'bash'
+
+class ShellCommandCleanEnv(ShellCommand):
+    def __init__(self, factory, argdict=None, **kwargs):
+        shell = DEFAULT_SHELL
+        if 'SHELL' in kwargs:
+            shell = kwargs['SHELL']
+            del kwargs['SHELL']
+
+        if 'PENV' in kwargs:
+            preserve_env = kwargs['PENV']
+            del kwargs['PENV']
+        else:
+            preserve_env = ['HOME', 'PWD', 'PATH',
+                            'http_proxy', 'https_proxy',
+                            'ftp_proxy', 'no_proxy', 'GIT_PROXY_COMMAND']
+
+        env_command = self._get_env_cleaned_command(shell, preserve_env)
+        self.command = "%s \'%s\'" % (env_command, self.command)
+        ShellCommand.__init__(self, **kwargs)
+
+    def _get_env_cleaned_command(self, shell, preserve_env):
+        pe_cmd = ''
+        for pe in preserve_env:
+            pe_cmd += "%s=\"$%s\" " % (pe, pe)
+
+        return "env -i %s %s -c " % (pe_cmd, shell)
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [[PATCHv2][autobuilder] 2/4] autobuilder/buildsteps: Add Toaster buildsteps.
  2016-02-22 15:15 [[PATCHv2][autobuilder] 1/4] autobuilder/lib: Add buildsteps module for provide helpers Aníbal Limón
@ 2016-02-22 15:15 ` Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 3/4] buildset-config.toaster: Add toaster-tests.conf buildset Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build Aníbal Limón
  2 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2016-02-22 15:15 UTC (permalink / raw)
  To: yocto

Adds Toaster buildsteps for setup toaster environment (installs
requirements), start/stop a toaster instance and run tests.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 .../autobuilder/buildsteps/ToasterRunTests.py      | 31 ++++++++++++++++++++
 .../autobuilder/buildsteps/ToasterSetupVenv.py     | 31 ++++++++++++++++++++
 .../autobuilder/buildsteps/ToasterStart.py         | 32 +++++++++++++++++++++
 .../autobuilder/buildsteps/ToasterStop.py          | 33 ++++++++++++++++++++++
 4 files changed, 127 insertions(+)
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ToasterRunTests.py
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ToasterSetupVenv.py
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStart.py
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStop.py

diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterRunTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterRunTests.py
new file mode 100644
index 0000000..141768c
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterRunTests.py
@@ -0,0 +1,31 @@
+'''
+Created on Feb 15, 2016
+
+__author__ = "Anibal (alimon) Limon"
+__copyright__ = "Copyright 2016, Intel Corp."
+__credits__ = ["Anibal Limon"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Anibal Limon"
+__email__ = "anibal.limon@linux.intel.com"
+'''
+
+from lib.buildsteps import ShellCommandCleanEnv
+import os
+
+class ToasterRunTests(ShellCommandCleanEnv):
+    haltOnFailure = True
+    flunkOnFailure = True
+    name = "ToasterRunTests"
+
+    def __init__(self, factory, argdict=None, **kwargs):
+        self.factory = factory
+        self.description = "Running toaster tests..."
+
+        oe_cmd = "source ./oe-init-build-env;"
+        venv_cmd = "source venv/bin/activate;"
+        cmd = "DISPLAY=:1 toaster-test --run-all-tests --verbose"
+
+        self.command = oe_cmd + venv_cmd + cmd
+
+        ShellCommandCleanEnv.__init__(self, factory, argdict, **kwargs)
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterSetupVenv.py b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterSetupVenv.py
new file mode 100644
index 0000000..54cf1e7
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterSetupVenv.py
@@ -0,0 +1,31 @@
+'''
+Created on Feb 15, 2016
+
+__author__ = "Anibal (alimon) Limon"
+__copyright__ = "Copyright 2016, Intel Corp."
+__credits__ = ["Anibal Limon"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Anibal Limon"
+__email__ = "anibal.limon@linux.intel.com"
+'''
+
+from lib.buildsteps import ShellCommandCleanEnv
+
+class ToasterSetupVenv(ShellCommandCleanEnv):
+    haltOnFailure = True
+    flunkOnFailure = True
+    name = "ToasterSetupVenv"
+
+    def __init__(self, factory, argdict=None, **kwargs):
+        self.factory = factory
+        self.description = "Creating virtualenv..."
+
+        oe_cmd = "source ./oe-init-build-env;"
+        venv_cmd = "virtualenv venv; source venv/bin/activate;"
+        install_cmd = "pip install -r ../bitbake/toaster-requirements.txt;"
+        install_tests_cmd = "pip install -r ../bitbake/toaster-tests-requirements.txt;"
+
+        self.command = oe_cmd + venv_cmd + install_cmd + install_tests_cmd 
+
+        ShellCommandCleanEnv.__init__(self, factory, argdict, **kwargs)
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStart.py b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStart.py
new file mode 100644
index 0000000..14cf9db3
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStart.py
@@ -0,0 +1,32 @@
+'''
+Created on Feb 15, 2016
+
+__author__ = "Anibal (alimon) Limon"
+__copyright__ = "Copyright 2016, Intel Corp."
+__credits__ = ["Anibal Limon"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Anibal Limon"
+__email__ = "anibal.limon@linux.intel.com"
+'''
+
+from lib.buildsteps import ShellCommandCleanEnv
+import os
+
+class ToasterStart(ShellCommandCleanEnv):
+    haltOnFailure = True
+    flunkOnFailure = True
+    name = "ToasterStart"
+
+    def __init__(self, factory, argdict=None, **kwargs):
+        self.factory = factory
+        self.description = "Starting toaster..."
+
+        oe_cmd = "source ./oe-init-build-env;"
+        venv_cmd = "source venv/bin/activate;"
+        start_cmd = "../bitbake/lib/toaster/tests/helpers.py -a start" \
+            " -d $(readlink -e ../)"
+
+        self.command = oe_cmd + venv_cmd + start_cmd
+
+        ShellCommandCleanEnv.__init__(self, factory, argdict, **kwargs)
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStop.py b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStop.py
new file mode 100644
index 0000000..6fda0e8
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ToasterStop.py
@@ -0,0 +1,33 @@
+'''
+Created on Feb 15, 2016
+
+__author__ = "Anibal (alimon) Limon"
+__copyright__ = "Copyright 2016, Intel Corp."
+__credits__ = ["Anibal Limon"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Anibal Limon"
+__email__ = "anibal.limon@linux.intel.com"
+'''
+
+from lib.buildsteps import ShellCommandCleanEnv
+import os
+
+class ToasterStop(ShellCommandCleanEnv):
+    alwaysRun = True
+    haltOnFailure = True
+    flunkOnFailure = True
+    name = "ToasterStop"
+
+    def __init__(self, factory, argdict=None, **kwargs):
+        self.factory = factory
+        self.description = "Stopping toaster..."
+
+        oe_cmd = "source ./oe-init-build-env;"
+        venv_cmd = "source venv/bin/activate;"
+        start_cmd = "../bitbake/lib/toaster/tests/helpers.py -a stop" \
+            " -d $(readlink -e ../)"
+
+        self.command = oe_cmd + venv_cmd + start_cmd
+
+        ShellCommandCleanEnv.__init__(self, factory, argdict, **kwargs)
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [[PATCHv2][autobuilder] 3/4] buildset-config.toaster: Add toaster-tests.conf buildset.
  2016-02-22 15:15 [[PATCHv2][autobuilder] 1/4] autobuilder/lib: Add buildsteps module for provide helpers Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 2/4] autobuilder/buildsteps: Add Toaster buildsteps Aníbal Limón
@ 2016-02-22 15:15 ` Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build Aníbal Limón
  2 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2016-02-22 15:15 UTC (permalink / raw)
  To: yocto

The toaster-tests buildset contains steps for run toaster tests
in a clean way, a Sleep step is needed after setup toaster for
give certain time to let toaster ends setup.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 buildset-config.toaster/toaster-tests.conf | 21 +++++++++++++++++++++
 buildset-config.toaster/yoctoAB.conf       |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 buildset-config.toaster/toaster-tests.conf

diff --git a/buildset-config.toaster/toaster-tests.conf b/buildset-config.toaster/toaster-tests.conf
new file mode 100644
index 0000000..0aa6b46
--- /dev/null
+++ b/buildset-config.toaster/toaster-tests.conf
@@ -0,0 +1,21 @@
+[toaster-tests]
+builders: 'example-worker'
+repos: [{'poky':
+            {'repourl':'git://git.yoctoproject.org/poky',
+             'layerversion':{'core':'meta', 'yoctobsp':'meta-yocto-bsp', 'yocto':'meta-yocto', 'poky':'meta-poky'},
+             'branch':'master' }}]
+steps: [{'SetDest':{}},
+        {'CheckOutLayers': {}},
+        {'RunPreamble': {}},
+        {'GetDistroVersion' : {'distro': 'poky'}},
+        {'CreateAutoConf': {'machine': 'qemux86', 'SDKMACHINE' : 'i686',
+                            'distro': 'poky', 'buildhistory' : True}},
+        {'CreateBBLayersConf': {'buildprovider' : 'yocto'}},
+        {'SyncPersistDB' : {'distro' : 'poky'}},
+        {'GetBitbakeVersion': {}},
+	{'ToasterSetupVenv': {}},
+	{'ToasterStart': {}},
+	{'Sleep': {'time': '120'}},
+	{'ToasterRunTests': {}},
+	{'ToasterStop': {}},
+       ]
diff --git a/buildset-config.toaster/yoctoAB.conf b/buildset-config.toaster/yoctoAB.conf
index 4f3fa00..614e39c 100644
--- a/buildset-config.toaster/yoctoAB.conf
+++ b/buildset-config.toaster/yoctoAB.conf
@@ -1,2 +1,2 @@
 [BuildSets]
-order: [] 
+order: ['toaster-tests']
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build.
  2016-02-22 15:15 [[PATCHv2][autobuilder] 1/4] autobuilder/lib: Add buildsteps module for provide helpers Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 2/4] autobuilder/buildsteps: Add Toaster buildsteps Aníbal Limón
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 3/4] buildset-config.toaster: Add toaster-tests.conf buildset Aníbal Limón
@ 2016-02-22 15:15 ` Aníbal Limón
  2016-02-22 15:37   ` Flanagan, Elizabeth
  2 siblings, 1 reply; 6+ messages in thread
From: Aníbal Limón @ 2016-02-22 15:15 UTC (permalink / raw)
  To: yocto

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 buildset-config.toaster/toaster-build.conf | 29 -----------------------------
 1 file changed, 29 deletions(-)
 delete mode 100644 buildset-config.toaster/toaster-build.conf

diff --git a/buildset-config.toaster/toaster-build.conf b/buildset-config.toaster/toaster-build.conf
deleted file mode 100644
index 09a03e2..0000000
--- a/buildset-config.toaster/toaster-build.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-[toaster-build]
-builders: 'example-worker'
-props: [{'atext':{'prop_type':'StringParameter',
-                       'size': 15,
-                       'name': 'atext',
-                       'default': '',
-                       'label':'<hr><h3> auto.conf:</h3>'}},
-        {'bbtext':{'prop_type':'StringParameter',
-                       'size': 15,
-                       'name': 'bbtext',
-                       'default': '',
-                       'label':'<hr><h3> bblayers.conf:</h3>'}},
-        {'images':{'prop_type':'StringParameter',
-                       'size': 15,
-                       'name': 'images',
-                       'default': '',
-                       'label':'<hr><h3> images:</h3>'}},
-        {'layers':{'prop_type':'StringParameter',
-                       'size': 15,
-                       'name': 'layers',
-                       'default': '',
-                       'label':'<hr><h3> repo string (ast):</h3>'}}]
-steps: [{'SetDest':{}},
-        {'CheckOutToasterLayers': {}},
-        {'RunPreamble': {}},
-        {'GetDistroVersion' : {'distro': 'poky'}},
-        {'CreateAutoConf': {'atext' : '#TOASTER'}},
-        {'CreateBBLayersConf': {'bbtext' : '#TOASTER'}},
-        {'BuildImages': {'images': '#TOASTER'}}]
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build.
  2016-02-22 15:15 ` [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build Aníbal Limón
@ 2016-02-22 15:37   ` Flanagan, Elizabeth
  2016-02-22 15:47     ` Aníbal Limón
  0 siblings, 1 reply; 6+ messages in thread
From: Flanagan, Elizabeth @ 2016-02-22 15:37 UTC (permalink / raw)
  To: Aníbal Limón; +Cc: yocto@yoctoproject.org

I'm going to pull all but this patch (4/4), because I'll eventually
need this configuration.

-b

On 22 February 2016 at 15:15, Aníbal Limón <anibal.limon@linux.intel.com> wrote:
> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
> ---
>  buildset-config.toaster/toaster-build.conf | 29 -----------------------------
>  1 file changed, 29 deletions(-)
>  delete mode 100644 buildset-config.toaster/toaster-build.conf
>
> diff --git a/buildset-config.toaster/toaster-build.conf b/buildset-config.toaster/toaster-build.conf
> deleted file mode 100644
> index 09a03e2..0000000
> --- a/buildset-config.toaster/toaster-build.conf
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -[toaster-build]
> -builders: 'example-worker'
> -props: [{'atext':{'prop_type':'StringParameter',
> -                       'size': 15,
> -                       'name': 'atext',
> -                       'default': '',
> -                       'label':'<hr><h3> auto.conf:</h3>'}},
> -        {'bbtext':{'prop_type':'StringParameter',
> -                       'size': 15,
> -                       'name': 'bbtext',
> -                       'default': '',
> -                       'label':'<hr><h3> bblayers.conf:</h3>'}},
> -        {'images':{'prop_type':'StringParameter',
> -                       'size': 15,
> -                       'name': 'images',
> -                       'default': '',
> -                       'label':'<hr><h3> images:</h3>'}},
> -        {'layers':{'prop_type':'StringParameter',
> -                       'size': 15,
> -                       'name': 'layers',
> -                       'default': '',
> -                       'label':'<hr><h3> repo string (ast):</h3>'}}]
> -steps: [{'SetDest':{}},
> -        {'CheckOutToasterLayers': {}},
> -        {'RunPreamble': {}},
> -        {'GetDistroVersion' : {'distro': 'poky'}},
> -        {'CreateAutoConf': {'atext' : '#TOASTER'}},
> -        {'CreateBBLayersConf': {'bbtext' : '#TOASTER'}},
> -        {'BuildImages': {'images': '#TOASTER'}}]
> --
> 2.1.4
>



-- 
Elizabeth Flanagan
Yocto Project
Build and Release


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build.
  2016-02-22 15:37   ` Flanagan, Elizabeth
@ 2016-02-22 15:47     ` Aníbal Limón
  0 siblings, 0 replies; 6+ messages in thread
From: Aníbal Limón @ 2016-02-22 15:47 UTC (permalink / raw)
  To: Flanagan, Elizabeth; +Cc: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 2211 bytes --]

Agree.


On 02/22/2016 09:37 AM, Flanagan, Elizabeth wrote:
> I'm going to pull all but this patch (4/4), because I'll eventually
> need this configuration.
> 
> -b
> 
> On 22 February 2016 at 15:15, Aníbal Limón <anibal.limon@linux.intel.com> wrote:
>> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
>> ---
>>  buildset-config.toaster/toaster-build.conf | 29 -----------------------------
>>  1 file changed, 29 deletions(-)
>>  delete mode 100644 buildset-config.toaster/toaster-build.conf
>>
>> diff --git a/buildset-config.toaster/toaster-build.conf b/buildset-config.toaster/toaster-build.conf
>> deleted file mode 100644
>> index 09a03e2..0000000
>> --- a/buildset-config.toaster/toaster-build.conf
>> +++ /dev/null
>> @@ -1,29 +0,0 @@
>> -[toaster-build]
>> -builders: 'example-worker'
>> -props: [{'atext':{'prop_type':'StringParameter',
>> -                       'size': 15,
>> -                       'name': 'atext',
>> -                       'default': '',
>> -                       'label':'<hr><h3> auto.conf:</h3>'}},
>> -        {'bbtext':{'prop_type':'StringParameter',
>> -                       'size': 15,
>> -                       'name': 'bbtext',
>> -                       'default': '',
>> -                       'label':'<hr><h3> bblayers.conf:</h3>'}},
>> -        {'images':{'prop_type':'StringParameter',
>> -                       'size': 15,
>> -                       'name': 'images',
>> -                       'default': '',
>> -                       'label':'<hr><h3> images:</h3>'}},
>> -        {'layers':{'prop_type':'StringParameter',
>> -                       'size': 15,
>> -                       'name': 'layers',
>> -                       'default': '',
>> -                       'label':'<hr><h3> repo string (ast):</h3>'}}]
>> -steps: [{'SetDest':{}},
>> -        {'CheckOutToasterLayers': {}},
>> -        {'RunPreamble': {}},
>> -        {'GetDistroVersion' : {'distro': 'poky'}},
>> -        {'CreateAutoConf': {'atext' : '#TOASTER'}},
>> -        {'CreateBBLayersConf': {'bbtext' : '#TOASTER'}},
>> -        {'BuildImages': {'images': '#TOASTER'}}]
>> --
>> 2.1.4
>>
> 
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-22 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 15:15 [[PATCHv2][autobuilder] 1/4] autobuilder/lib: Add buildsteps module for provide helpers Aníbal Limón
2016-02-22 15:15 ` [[PATCHv2][autobuilder] 2/4] autobuilder/buildsteps: Add Toaster buildsteps Aníbal Limón
2016-02-22 15:15 ` [[PATCHv2][autobuilder] 3/4] buildset-config.toaster: Add toaster-tests.conf buildset Aníbal Limón
2016-02-22 15:15 ` [[PATCHv2][autobuilder] 4/4] buildset-config.toaster: Remove unused template toaster-build Aníbal Limón
2016-02-22 15:37   ` Flanagan, Elizabeth
2016-02-22 15:47     ` Aníbal Limón

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.