Skip to contentSkip to conversation

10/16] Reorder source code tree,

PATCH New Aníbal Limón 1 participant 7 messages Feb 9, 2016 Licenses and spdx stuff

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 10/16] Reorder source code tree,

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.

---
 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
external/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
tests/toaster/__init__.py deleted +0 -125

125 lines not on this page · raw message

tests/toaster/helpers.py deleted +0 -109

109 lines not on this page · raw message

toaster/__init__.py new file +0 -0
new file mode 100644
index 0000000..e69de29
toaster/helpers.py new file +109 -0

109 lines not on this page · raw message

toaster/toaster.py new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 11/16] README.md: Update with information about setup, toaster and maintainence.

---
 README.md | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)
README.md +31 -3
index 4efe1a8..a07e27f 100644
@@ -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 [email protected] with "[qa-tools]" in the subject also CC the current
+maintainer; Aníbal Limón <[email protected]>.
+
+[1] http://git.yoctoproject.org/cgit/cgit.cgi/qa-tools/
Signature · 1 line
2.1.4
#2 lore raw

PATCH 1/1 12/16] toaster/toaster.py: Add missing shebang to call python.

In reply to Aníbal Limón
---
 toaster/toaster.py | 2 ++
 1 file changed, 2 insertions(+)
toaster/toaster.py +2 -0
index d3c5fff..9f477cb 100755
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 import unittest, time, re, sys, getopt, os, logging, string, errno, exceptions
 import shutil, argparse, ConfigParser, platform
 
Signature · 1 line
2.1.4
#3 lore raw

PATCH 1/1 13/16] toaster: Add header to specify license to MIT.

In reply to Aníbal Limón

Also add the COPYRIGHT.MIT license file.

---
 COPYING.MIT        | 17 +++++++++++++++++
 toaster/helpers.py |  4 ++++
 toaster/toaster.py |  4 ++++
 3 files changed, 25 insertions(+)
 create mode 100644 COPYING.MIT
COPYING.MIT new file +17 -0
new file mode 100644
index 0000000..fb950dc
@@ -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.
toaster/helpers.py +4 -0
index 753bbf0..dca594f 100644
@@ -1,3 +1,7 @@
+# Copyright (C) 2016 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
 import subprocess
 import os
 import shutil
toaster/toaster.py +4 -0
index 9f477cb..8afd286 100755
@@ -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
 
Signature · 1 line
2.1.4
#4 lore raw

PATCH 1/1 14/16] toaster/toaster.py: Add command line options.

In reply to Aníbal Limón

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

---
 toaster/toaster.py | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)
toaster/toaster.py +34 -5
index 8afd286..4b5b077 100755
@@ -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)
Signature · 1 line
2.1.4
#5 lore raw

PATCH 1/1 15/16] toaster/helpers.py: Fix ToasterHelper setup method git checkout.

In reply to Aníbal Limón

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?

---
 toaster/helpers.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
toaster/helpers.py +2 -2
index dca594f..489a60f 100644
@@ -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)
Signature · 1 line
2.1.4
#6 lore raw

PATCH 1/1 16/16] README.md: Add recommendation to use vncserver for run Toaster tests.

In reply to Aníbal Limón
---
 README.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)
README.md +13 -0
index a07e27f..4ffc021 100644
@@ -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
Signature · 1 line
2.1.4