All of lore.kernel.org
 help / color / mirror / Atom feed
* [[PATCH][qa-tools] 10/16] Reorder source code tree,
@ 2016-02-09 22:45 Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 11/16] README.md: Update with information about setup, toaster and maintainence Aníbal Limón
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

Get rid of unnecessary level of tests folder.

Move toaster/__init__.py to toaster/toaster.py program.

Add empty toaster/__init__.py and external/__init__.py for said
to python to use folder as module.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 external/__init__.py      |   0
 tests/toaster/__init__.py | 125 ----------------------------------------------
 tests/toaster/helpers.py  | 109 ----------------------------------------
 toaster/__init__.py       |   0
 toaster/helpers.py        | 109 ++++++++++++++++++++++++++++++++++++++++
 toaster/toaster.py        | 125 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 234 insertions(+), 234 deletions(-)
 create mode 100644 external/__init__.py
 delete mode 100755 tests/toaster/__init__.py
 delete mode 100644 tests/toaster/helpers.py
 create mode 100644 toaster/__init__.py
 create mode 100644 toaster/helpers.py
 create mode 100755 toaster/toaster.py

diff --git a/external/__init__.py b/external/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/toaster/__init__.py b/tests/toaster/__init__.py
deleted file mode 100755
index d3c5fff..0000000
--- a/tests/toaster/__init__.py
+++ /dev/null
@@ -1,125 +0,0 @@
-import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions
-import shutil, argparse, ConfigParser, platform
-
-from selenium import webdriver
-from selenium.common.exceptions import NoSuchElementException
-from selenium import selenium
-from selenium.webdriver.common.by import By
-from selenium.webdriver.common.keys import Keys
-from selenium.webdriver.support.ui import Select
-
-sys.path.insert(0, os.path.join(os.path.dirname(
-    os.path.abspath(__file__)), '../'))
-from toaster.helpers import ToasterHelper
-
-WORK_DIRECTORY = '/tmp/toaster'
-POKY_URL = 'http://git.yoctoproject.org/git/poky.git'
-
-class InitToaster(unittest.TestCase):
-    @classmethod
-    def setUpClass(self):
-        self.toaster_helper = ToasterHelper(WORK_DIRECTORY, POKY_URL)
-        self.toaster_helper.clone(rm=True)
-        self.toaster_helper.setup()
-        self.toaster_helper.start()
-
-        self.driver = webdriver.Firefox()
-        self.timeout = 320
-
-    @classmethod
-    def tearDownClass(self):
-        self.toaster_helper.stop(force=True)
-        self.driver.close()
-
-    def is_text_present (self, patterns):
-        for pattern in patterns:
-            if str(pattern) not in self.driver.page_source:
-                print pattern
-                return False
-        return True
-
-    def test_setupToaster(self):
-        self.driver.maximize_window()
-        self.driver.get("localhost:8000")
-        try:
-            self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
-        except:
-            self.driver.find_element_by_id("new-project-button").click()
-            self.driver.find_element_by_id("new-project-name").send_keys("selenium-project")
-            self.driver.find_element_by_id("create-project-button").click()
-        try:
-            self.driver.find_element_by_link_text("selenium-project").click()
-        except:
-            self.driver.find_element_by_id("new-project-button").click()
-            self.driver.find_element_by_id("new-project-name").send_keys("selenium-project")
-            self.driver.find_element_by_id("create-project-button").click()
-        time.sleep(5)
-        #workaround
-#        self.driver.find_element_by_partial_link_text("Bitbake").click()
-#        self.driver.find_element_by_id("config_var_trash_10").click()
-#        time.sleep(5)
-        #queue up a core-image-minimal
-        self.driver.find_element_by_id("build-input").send_keys("core-image-minimal")
-        self.driver.find_element_by_id("build-button").click()
-        time.sleep(20)
-        #queue up a core-image-sato
-        self.driver.find_element_by_id("build-input").send_keys("core-image-sato")
-        self.driver.find_element_by_id("build-button").click()
-        time.sleep(20)
-        #go back to the main project page
-        self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
-        self.driver.find_element_by_link_text("selenium-project").click()
-        #check if meta-selftest layer is added and import it if it's not
-        if not (self.is_text_present("meta-selftest")):
-            self.driver.find_element_by_css_selector("a[href='/toastergui/project/2/importlayer']").click()
-            self.driver.find_element_by_id("import-layer-name").send_keys("meta-selftest")
-            self.driver.find_element_by_id("layer-git-repo-url").send_keys("git://git.yoctoproject.org/poky")
-            self.driver.find_element_by_id("layer-subdir").send_keys("meta-selftest")
-            self.driver.find_element_by_id("layer-git-ref").send_keys("HEAD")
-            self.driver.find_element_by_id("import-and-add-btn").click()
-        #queue up an error-image build
-        self.driver.find_element_by_id("build-input").send_keys("error-image")
-        self.driver.find_element_by_id("build-button").click()
-        time.sleep(5)
-        #move to all builds page
-        self.driver.find_element_by_css_selector("a[href='/toastergui/builds/']").click()
-        time.sleep(5)
-        self.driver.refresh()
-        #check progress bar is displayed to signal a build has started
-        try:
-            self.driver.find_element_by_xpath("//div[@class='progress']").is_displayed()
-        except:
-            print "Unable to start new build"
-            self.fail(msg="Unable to start new build")
-        count = 0
-        failflag = False
-        try:
-            self.driver.refresh()
-            time.sleep(1)
-            print "First check starting"
-            while (self.driver.find_element_by_xpath("//div[@class='progress']").is_displayed()):
-                #print "Looking for build in progress"
-                print 'Builds running for '+str(count)+' minutes'
-                count += 5
-                #timeout default is at 179 minutes(3 hours); see set_up method to change
-                if (count > self.timeout):
-                    failflag = True
-                    print 'Builds took longer than expected to complete; Failing due to possible build stuck.'
-                    self.fail()
-                time.sleep(300)
-                self.driver.refresh()
-        except:
-           try:
-                if failflag:
-                    self.fail(msg="Builds took longer than expected to complete; Failing due to possible build stuck.")
-                print "Looking for successful build"
-                self.driver.find_element_by_xpath("//div[@class='alert build-result alert-success']").is_displayed()
-           except:
-                if failflag:
-                    self.fail(msg="Builds took longer than expected to complete; Failing due to possible build stuck.")
-                print 'Builds did not complete successfully'
-                self.fail(msg="Builds did not complete successfully.")
-        print "Builds complete!"
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/tests/toaster/helpers.py b/tests/toaster/helpers.py
deleted file mode 100644
index 753bbf0..0000000
--- a/tests/toaster/helpers.py
+++ /dev/null
@@ -1,109 +0,0 @@
-import subprocess
-import os
-import shutil
-import signal
-import tempfile
-
-from proc.core import find_processes
-
-TOASTER_TEST_BRANCH = 'toaster_tests'
-VENV_NAME = 'venv'
-SHELL_CMD = os.environ['SHELL'] if 'SHELL' in os.environ else "/bin/bash"
-
-def _check_output1(*popenargs, **kwargs):
-    """
-        Almost the same as subprocess.check_output but change the stdout from
-        PIPE to tempfile to avoid deadlocks when trying to read the PIPE using
-        communicate(). This scenario can be seen calling toaster_start on failure
-        scenarios.
-
-        This causes a little overhead by the tempfile.
-    """
-
-    f = tempfile.TemporaryFile(mode='rw+')
-    if 'stdout' in kwargs:
-        raise ValueError('stdout argument not allowed, it will be overridden.')
-    process = subprocess.Popen(stdout=f, *popenargs, **kwargs)
-    retcode = process.wait()
-
-    f.flush()
-    os.fsync(f.fileno())
-    f.seek(0, 0)
-    output = f.read()
-    f.close()
-
-    if retcode:
-        cmd = kwargs.get("args")
-        if cmd is None:
-            cmd = popenargs[0]
-        raise subprocess.CalledProcessError(retcode, cmd, output=output)
-    return output
-
-class ToasterHelper(object):
-    def __init__(self, directory, repo, repo_ref='master'):
-        self.directory = directory
-        self.repo = repo
-        self.repo_ref = repo_ref
-
-    def _execute_command(self, cmd):
-        return _check_output1([SHELL_CMD, "-c", "cd %s; %s" % \
-            (self.directory, cmd)], stderr=subprocess.STDOUT)
-
-    def _execute_command_venv(self, venv, cmd):
-        return self._execute_command("source %s/%s/bin/activate; %s"\
-                % (self.directory, venv, cmd))
-
-    def clone(self, rm=False):
-        if os.path.exists(self.directory):
-            if rm:
-                shutil.rmtree(self.directory)
-            else:
-                raise IOError
-
-        subprocess.check_output([SHELL_CMD, "-c", "git clone %s %s" % \
-            (self.repo, self.directory)], stderr=subprocess.STDOUT)
-        self._execute_command("git checkout %s -b %s" % \
-            (self.repo_ref, TOASTER_TEST_BRANCH))
-
-    def setup(self):
-        self._execute_command("virtualenv %s" % VENV_NAME)
-        self._execute_command_venv(VENV_NAME, "pip install -r" \
-            " bitbake/toaster-requirements.txt")
-
-    def start(self):
-        return self._execute_command_venv(VENV_NAME,
-            "source %s/oe-init-build-env; source %s/bitbake/bin/toaster start" % \
-            (self.directory, self.directory))
-
-    def _stop_force(self):
-        """
-            The _stop_force method iterates over the /proc and search for toaster path
-            in the process cmdline then send SIGKILL for every matched process.
-        """
-        pids = []
-        for p in find_processes():
-            if len(p.cmdline) > 1 and \
-                os.path.basename(p.cmdline[0]) == 'python' and \
-                p.cmdline[1].startswith(self.directory):
-                    pids.append(p.pid)
-
-        for pid in pids:
-            try:
-                os.kill(pid, signal.SIGKILL)
-            except:
-                pass
-
-        return ''
-
-    def stop(self, force=False):
-        """
-            The stop method have force mode because toaster without production 
-            setup have known issues when is on load, the server response 503
-            service unavailable.
-        """
-        if force:
-            return self._stop_force()
-        else:
-            return self._execute_command_venv(VENV_NAME,
-                "source %s/oe-init-build-env; source %s/bitbake/bin/toaster stop" % \
-                (self.directory, self.directory))
diff --git a/toaster/__init__.py b/toaster/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/toaster/helpers.py b/toaster/helpers.py
new file mode 100644
index 0000000..753bbf0
--- /dev/null
+++ b/toaster/helpers.py
@@ -0,0 +1,109 @@
+import subprocess
+import os
+import shutil
+import signal
+import tempfile
+
+from proc.core import find_processes
+
+TOASTER_TEST_BRANCH = 'toaster_tests'
+VENV_NAME = 'venv'
+SHELL_CMD = os.environ['SHELL'] if 'SHELL' in os.environ else "/bin/bash"
+
+def _check_output1(*popenargs, **kwargs):
+    """
+        Almost the same as subprocess.check_output but change the stdout from
+        PIPE to tempfile to avoid deadlocks when trying to read the PIPE using
+        communicate(). This scenario can be seen calling toaster_start on failure
+        scenarios.
+
+        This causes a little overhead by the tempfile.
+    """
+
+    f = tempfile.TemporaryFile(mode='rw+')
+    if 'stdout' in kwargs:
+        raise ValueError('stdout argument not allowed, it will be overridden.')
+    process = subprocess.Popen(stdout=f, *popenargs, **kwargs)
+    retcode = process.wait()
+
+    f.flush()
+    os.fsync(f.fileno())
+    f.seek(0, 0)
+    output = f.read()
+    f.close()
+
+    if retcode:
+        cmd = kwargs.get("args")
+        if cmd is None:
+            cmd = popenargs[0]
+        raise subprocess.CalledProcessError(retcode, cmd, output=output)
+    return output
+
+class ToasterHelper(object):
+    def __init__(self, directory, repo, repo_ref='master'):
+        self.directory = directory
+        self.repo = repo
+        self.repo_ref = repo_ref
+
+    def _execute_command(self, cmd):
+        return _check_output1([SHELL_CMD, "-c", "cd %s; %s" % \
+            (self.directory, cmd)], stderr=subprocess.STDOUT)
+
+    def _execute_command_venv(self, venv, cmd):
+        return self._execute_command("source %s/%s/bin/activate; %s"\
+                % (self.directory, venv, cmd))
+
+    def clone(self, rm=False):
+        if os.path.exists(self.directory):
+            if rm:
+                shutil.rmtree(self.directory)
+            else:
+                raise IOError
+
+        subprocess.check_output([SHELL_CMD, "-c", "git clone %s %s" % \
+            (self.repo, self.directory)], stderr=subprocess.STDOUT)
+        self._execute_command("git checkout %s -b %s" % \
+            (self.repo_ref, TOASTER_TEST_BRANCH))
+
+    def setup(self):
+        self._execute_command("virtualenv %s" % VENV_NAME)
+        self._execute_command_venv(VENV_NAME, "pip install -r" \
+            " bitbake/toaster-requirements.txt")
+
+    def start(self):
+        return self._execute_command_venv(VENV_NAME,
+            "source %s/oe-init-build-env; source %s/bitbake/bin/toaster start" % \
+            (self.directory, self.directory))
+
+    def _stop_force(self):
+        """
+            The _stop_force method iterates over the /proc and search for toaster path
+            in the process cmdline then send SIGKILL for every matched process.
+        """
+        pids = []
+        for p in find_processes():
+            if len(p.cmdline) > 1 and \
+                os.path.basename(p.cmdline[0]) == 'python' and \
+                p.cmdline[1].startswith(self.directory):
+                    pids.append(p.pid)
+
+        for pid in pids:
+            try:
+                os.kill(pid, signal.SIGKILL)
+            except:
+                pass
+
+        return ''
+
+    def stop(self, force=False):
+        """
+            The stop method have force mode because toaster without production 
+            setup have known issues when is on load, the server response 503
+            service unavailable.
+        """
+        if force:
+            return self._stop_force()
+        else:
+            return self._execute_command_venv(VENV_NAME,
+                "source %s/oe-init-build-env; source %s/bitbake/bin/toaster stop" % \
+                (self.directory, self.directory))
diff --git a/toaster/toaster.py b/toaster/toaster.py
new file mode 100755
index 0000000..d3c5fff
--- /dev/null
+++ b/toaster/toaster.py
@@ -0,0 +1,125 @@
+import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions
+import shutil, argparse, ConfigParser, platform
+
+from selenium import webdriver
+from selenium.common.exceptions import NoSuchElementException
+from selenium import selenium
+from selenium.webdriver.common.by import By
+from selenium.webdriver.common.keys import Keys
+from selenium.webdriver.support.ui import Select
+
+sys.path.insert(0, os.path.join(os.path.dirname(
+    os.path.abspath(__file__)), '../'))
+from toaster.helpers import ToasterHelper
+
+WORK_DIRECTORY = '/tmp/toaster'
+POKY_URL = 'http://git.yoctoproject.org/git/poky.git'
+
+class InitToaster(unittest.TestCase):
+    @classmethod
+    def setUpClass(self):
+        self.toaster_helper = ToasterHelper(WORK_DIRECTORY, POKY_URL)
+        self.toaster_helper.clone(rm=True)
+        self.toaster_helper.setup()
+        self.toaster_helper.start()
+
+        self.driver = webdriver.Firefox()
+        self.timeout = 320
+
+    @classmethod
+    def tearDownClass(self):
+        self.toaster_helper.stop(force=True)
+        self.driver.close()
+
+    def is_text_present (self, patterns):
+        for pattern in patterns:
+            if str(pattern) not in self.driver.page_source:
+                print pattern
+                return False
+        return True
+
+    def test_setupToaster(self):
+        self.driver.maximize_window()
+        self.driver.get("localhost:8000")
+        try:
+            self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
+        except:
+            self.driver.find_element_by_id("new-project-button").click()
+            self.driver.find_element_by_id("new-project-name").send_keys("selenium-project")
+            self.driver.find_element_by_id("create-project-button").click()
+        try:
+            self.driver.find_element_by_link_text("selenium-project").click()
+        except:
+            self.driver.find_element_by_id("new-project-button").click()
+            self.driver.find_element_by_id("new-project-name").send_keys("selenium-project")
+            self.driver.find_element_by_id("create-project-button").click()
+        time.sleep(5)
+        #workaround
+#        self.driver.find_element_by_partial_link_text("Bitbake").click()
+#        self.driver.find_element_by_id("config_var_trash_10").click()
+#        time.sleep(5)
+        #queue up a core-image-minimal
+        self.driver.find_element_by_id("build-input").send_keys("core-image-minimal")
+        self.driver.find_element_by_id("build-button").click()
+        time.sleep(20)
+        #queue up a core-image-sato
+        self.driver.find_element_by_id("build-input").send_keys("core-image-sato")
+        self.driver.find_element_by_id("build-button").click()
+        time.sleep(20)
+        #go back to the main project page
+        self.driver.find_element_by_css_selector("a[href='/toastergui/projects/']").click()
+        self.driver.find_element_by_link_text("selenium-project").click()
+        #check if meta-selftest layer is added and import it if it's not
+        if not (self.is_text_present("meta-selftest")):
+            self.driver.find_element_by_css_selector("a[href='/toastergui/project/2/importlayer']").click()
+            self.driver.find_element_by_id("import-layer-name").send_keys("meta-selftest")
+            self.driver.find_element_by_id("layer-git-repo-url").send_keys("git://git.yoctoproject.org/poky")
+            self.driver.find_element_by_id("layer-subdir").send_keys("meta-selftest")
+            self.driver.find_element_by_id("layer-git-ref").send_keys("HEAD")
+            self.driver.find_element_by_id("import-and-add-btn").click()
+        #queue up an error-image build
+        self.driver.find_element_by_id("build-input").send_keys("error-image")
+        self.driver.find_element_by_id("build-button").click()
+        time.sleep(5)
+        #move to all builds page
+        self.driver.find_element_by_css_selector("a[href='/toastergui/builds/']").click()
+        time.sleep(5)
+        self.driver.refresh()
+        #check progress bar is displayed to signal a build has started
+        try:
+            self.driver.find_element_by_xpath("//div[@class='progress']").is_displayed()
+        except:
+            print "Unable to start new build"
+            self.fail(msg="Unable to start new build")
+        count = 0
+        failflag = False
+        try:
+            self.driver.refresh()
+            time.sleep(1)
+            print "First check starting"
+            while (self.driver.find_element_by_xpath("//div[@class='progress']").is_displayed()):
+                #print "Looking for build in progress"
+                print 'Builds running for '+str(count)+' minutes'
+                count += 5
+                #timeout default is at 179 minutes(3 hours); see set_up method to change
+                if (count > self.timeout):
+                    failflag = True
+                    print 'Builds took longer than expected to complete; Failing due to possible build stuck.'
+                    self.fail()
+                time.sleep(300)
+                self.driver.refresh()
+        except:
+           try:
+                if failflag:
+                    self.fail(msg="Builds took longer than expected to complete; Failing due to possible build stuck.")
+                print "Looking for successful build"
+                self.driver.find_element_by_xpath("//div[@class='alert build-result alert-success']").is_displayed()
+           except:
+                if failflag:
+                    self.fail(msg="Builds took longer than expected to complete; Failing due to possible build stuck.")
+                print 'Builds did not complete successfully'
+                self.fail(msg="Builds did not complete successfully.")
+        print "Builds complete!"
+
+if __name__ == "__main__":
+    unittest.main()
-- 
2.1.4



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

* [[PATCH][qa-tools] 11/16] README.md: Update with information about setup, toaster and maintainence.
  2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
@ 2016-02-09 22:45 ` Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 12/16] toaster/toaster.py: Add missing shebang to call python Aníbal Limón
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 README.md | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 4efe1a8..a07e27f 100644
--- a/README.md
+++ b/README.md
@@ -2,18 +2,46 @@
 
 Scripts used by Yocto QA Team for automatize QA process.
 
-= Host requirements =
+== Host requirements ==
 
 All the test components REQUIRE bash as your default shell, you
 need to review if /bin/sh points to bash because some problems are
 detected when use dash.
 
-== Toaster ==
+=== General ===
 
 - virtualenv for python
 - pip for python
+
+=== Toaster ===
+
 - firefox web browser for use selenium
 
-=== Debian install ===
+=== Debian INSTALL ===
 
 # apt-get install iceweasel python-virtualenv python-pip
+
+== Setup ==
+
+For run any of the tests scripts you need to setup virtualenv and install
+requirements with pip.
+
+$ virtualenv venv
+$ source venv/bin/activate
+$ pip install -r requirements.txt
+
+== Toaster ==
+
+For run toaster tests a python script is located at toaster/toaster.py,
+it can take sometime because it setup a toaster instance and run testsuite
+over it.
+
+$ ./toaster/toaster.py
+
+== Maintenance ==
+
+The GIT repository is here [1], if you want to contribute please send patches
+to ML yocto@yoctoproject.org with "[qa-tools]" in the subject also CC the current
+maintainer; Aníbal Limón <anibal.limon@linux.intel.com>.
+
+[1] http://git.yoctoproject.org/cgit/cgit.cgi/qa-tools/
-- 
2.1.4



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

* [[PATCH][qa-tools] 12/16] toaster/toaster.py: Add missing shebang to call python.
  2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 11/16] README.md: Update with information about setup, toaster and maintainence Aníbal Limón
@ 2016-02-09 22:45 ` Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 13/16] toaster: Add header to specify license to MIT Aníbal Limón
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 toaster/toaster.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/toaster/toaster.py b/toaster/toaster.py
index d3c5fff..9f477cb 100755
--- a/toaster/toaster.py
+++ b/toaster/toaster.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions
 import shutil, argparse, ConfigParser, platform
 
-- 
2.1.4



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

* [[PATCH][qa-tools] 13/16] toaster: Add header to specify license to MIT.
  2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 11/16] README.md: Update with information about setup, toaster and maintainence Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 12/16] toaster/toaster.py: Add missing shebang to call python Aníbal Limón
@ 2016-02-09 22:45 ` Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 14/16] toaster/toaster.py: Add command line options Aníbal Limón
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

Also add the COPYRIGHT.MIT license file.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 COPYING.MIT        | 17 +++++++++++++++++
 toaster/helpers.py |  4 ++++
 toaster/toaster.py |  4 ++++
 3 files changed, 25 insertions(+)
 create mode 100644 COPYING.MIT

diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy 
+of this software and associated documentation files (the "Software"), to deal 
+in the Software without restriction, including without limitation the rights 
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
+copies of the Software, and to permit persons to whom the Software is 
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in 
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
+THE SOFTWARE.
diff --git a/toaster/helpers.py b/toaster/helpers.py
index 753bbf0..dca594f 100644
--- a/toaster/helpers.py
+++ b/toaster/helpers.py
@@ -1,3 +1,7 @@
+# Copyright (C) 2016 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
 import subprocess
 import os
 import shutil
diff --git a/toaster/toaster.py b/toaster/toaster.py
index 9f477cb..8afd286 100755
--- a/toaster/toaster.py
+++ b/toaster/toaster.py
@@ -1,5 +1,9 @@
 #!/usr/bin/env python
 
+# Copyright (C) 2013 - 2016 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
 import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions
 import shutil, argparse, ConfigParser, platform
 
-- 
2.1.4



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

* [[PATCH][qa-tools] 14/16] toaster/toaster.py: Add command line options.
  2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
                   ` (2 preceding siblings ...)
  2016-02-09 22:45 ` [[PATCH][qa-tools] 13/16] toaster: Add header to specify license to MIT Aníbal Limón
@ 2016-02-09 22:45 ` Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 15/16] toaster/helpers.py: Fix ToasterHelper setup method git checkout Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 16/16] README.md: Add recommendation to use vncserver for run Toaster tests Aníbal Limón
  5 siblings, 0 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

Now toaster script can receive options from command line like
the repository/branch and the work directory to use.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 toaster/toaster.py | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/toaster/toaster.py b/toaster/toaster.py
index 8afd286..4b5b077 100755
--- a/toaster/toaster.py
+++ b/toaster/toaster.py
@@ -18,13 +18,25 @@ sys.path.insert(0, os.path.join(os.path.dirname(
     os.path.abspath(__file__)), '../'))
 from toaster.helpers import ToasterHelper
 
-WORK_DIRECTORY = '/tmp/toaster'
-POKY_URL = 'http://git.yoctoproject.org/git/poky.git'
+DEFAULT_WORK_DIRECTORY = '/tmp/toaster'
+DEFAULT_POKY_URL = 'http://git.yoctoproject.org/git/poky.git'
+DEFAULT_POKY_BRANCH = 'master'
 
-class InitToaster(unittest.TestCase):
+args = None
+help_text = """Usage examples:
+
+* To execute the Toaster test suite over poky master:
+    $ ./toaster/toaster.py
+
+* To execute the Toaster test suite over poky release:
+    $ ./toaster/toaster.py -r jethro
+"""
+
+class ToasterTests(unittest.TestCase):
     @classmethod
     def setUpClass(self):
-        self.toaster_helper = ToasterHelper(WORK_DIRECTORY, POKY_URL)
+        self.toaster_helper = ToasterHelper(args.work_directory,
+            args.url_repository, repo_ref=args.revision)
         self.toaster_helper.clone(rm=True)
         self.toaster_helper.setup()
         self.toaster_helper.start()
@@ -128,4 +140,21 @@ class InitToaster(unittest.TestCase):
         print "Builds complete!"
 
 if __name__ == "__main__":
-    unittest.main()
+    parser = argparse.ArgumentParser(description='Toaster Test suite',
+                                     formatter_class=argparse.RawTextHelpFormatter,
+                                     epilog=help_text)
+    parser.add_argument("-d", "--work-directory", default=DEFAULT_WORK_DIRECTORY,
+                        help="Directory for setup toaster")
+    parser.add_argument("-u", "--url-repository", default=DEFAULT_POKY_URL,
+                        help="GIT repository for setup toaster")
+    parser.add_argument("-r", "--revision", default=DEFAULT_POKY_BRANCH,
+                        help="GIT repository revision (branch, tag, hash) for setup toaster")
+
+    parser.add_argument("-v", "--verbose", type=int, default=1, choices=range(1, 6),
+                        help="Verbose level")
+
+    args = parser.parse_args()
+
+    runner = unittest.TextTestRunner(verbosity=args.verbose)
+    suite = unittest.TestLoader().loadTestsFromTestCase(ToasterTests)
+    runner.run(suite)
-- 
2.1.4



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

* [[PATCH][qa-tools] 15/16] toaster/helpers.py: Fix ToasterHelper setup method git checkout.
  2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
                   ` (3 preceding siblings ...)
  2016-02-09 22:45 ` [[PATCH][qa-tools] 14/16] toaster/toaster.py: Add command line options Aníbal Limón
@ 2016-02-09 22:45 ` Aníbal Limón
  2016-02-09 22:45 ` [[PATCH][qa-tools] 16/16] README.md: Add recommendation to use vncserver for run Toaster tests Aníbal Limón
  5 siblings, 0 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

When try to checkout from branch to another branch it fails because
this operation isn't permited.

So first create a branch before checkout.

Example:

git checkout jethro -b tmp
fatal: Cannot update paths and switch to branch 'tmp' at the same time.
Did you intend to checkout 'jethro' which can not be resolved as commit?

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 toaster/helpers.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/toaster/helpers.py b/toaster/helpers.py
index dca594f..489a60f 100644
--- a/toaster/helpers.py
+++ b/toaster/helpers.py
@@ -66,8 +66,8 @@ class ToasterHelper(object):
 
         subprocess.check_output([SHELL_CMD, "-c", "git clone %s %s" % \
             (self.repo, self.directory)], stderr=subprocess.STDOUT)
-        self._execute_command("git checkout %s -b %s" % \
-            (self.repo_ref, TOASTER_TEST_BRANCH))
+        self._execute_command("git checkout %s; git branch %s; git checkout %s;" \
+            % (self.repo_ref, TOASTER_TEST_BRANCH, TOASTER_TEST_BRANCH))
 
     def setup(self):
         self._execute_command("virtualenv %s" % VENV_NAME)
-- 
2.1.4



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

* [[PATCH][qa-tools] 16/16] README.md: Add recommendation to use vncserver for run Toaster tests.
  2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
                   ` (4 preceding siblings ...)
  2016-02-09 22:45 ` [[PATCH][qa-tools] 15/16] toaster/helpers.py: Fix ToasterHelper setup method git checkout Aníbal Limón
@ 2016-02-09 22:45 ` Aníbal Limón
  5 siblings, 0 replies; 7+ messages in thread
From: Aníbal Limón @ 2016-02-09 22:45 UTC (permalink / raw)
  To: yocto; +Cc: richard.purdie, benjamin.esquivel

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 README.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/README.md b/README.md
index a07e27f..4ffc021 100644
--- a/README.md
+++ b/README.md
@@ -16,11 +16,16 @@ detected when use dash.
 === Toaster ===
 
 - firefox web browser for use selenium
+- vncserver (optional)
 
 === Debian INSTALL ===
 
 # apt-get install iceweasel python-virtualenv python-pip
 
+Optional:
+
+# apt-get install vnc4server
+
 == Setup ==
 
 For run any of the tests scripts you need to setup virtualenv and install
@@ -38,6 +43,14 @@ over it.
 
 $ ./toaster/toaster.py
 
+Optional: Toaster test suite uses selenium and spawn Firefox web browser for
+run the tests, if you are in a development machine may be is a good idea to
+start vncserver and set DISPLAY before run to don't interfer with your tasks,
+example:
+
+$ vncserver :10
+$ export DISPLAY=:10
+
 == Maintenance ==
 
 The GIT repository is here [1], if you want to contribute please send patches
-- 
2.1.4



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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 22:45 [[PATCH][qa-tools] 10/16] Reorder source code tree, Aníbal Limón
2016-02-09 22:45 ` [[PATCH][qa-tools] 11/16] README.md: Update with information about setup, toaster and maintainence Aníbal Limón
2016-02-09 22:45 ` [[PATCH][qa-tools] 12/16] toaster/toaster.py: Add missing shebang to call python Aníbal Limón
2016-02-09 22:45 ` [[PATCH][qa-tools] 13/16] toaster: Add header to specify license to MIT Aníbal Limón
2016-02-09 22:45 ` [[PATCH][qa-tools] 14/16] toaster/toaster.py: Add command line options Aníbal Limón
2016-02-09 22:45 ` [[PATCH][qa-tools] 15/16] toaster/helpers.py: Fix ToasterHelper setup method git checkout Aníbal Limón
2016-02-09 22:45 ` [[PATCH][qa-tools] 16/16] README.md: Add recommendation to use vncserver for run Toaster tests 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.