From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
To: Markus Lehtonen <markus.lehtonen@linux.intel.com>,
openembedded-core@lists.openembedded.org
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Subject: Re: [PATCH v3 03/10] oe-selftest: devtool: add method for checking workspace dir
Date: Mon, 28 Sep 2015 15:25:44 -0500 [thread overview]
Message-ID: <5609A248.8020303@linux.intel.com> (raw)
In-Reply-To: <1443095587-13852-4-git-send-email-markus.lehtonen@linux.intel.com>
On 09/24/2015 06:53 AM, Markus Lehtonen wrote:
> In order to remove some code duplication.
>
> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> ---
> meta/lib/oeqa/selftest/devtool.py | 63 +++++++++++++++------------------------
> 1 file changed, 24 insertions(+), 39 deletions(-)
>
> diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
> index 3a8168c..b8b872c 100644
> --- a/meta/lib/oeqa/selftest/devtool.py
> +++ b/meta/lib/oeqa/selftest/devtool.py
> @@ -84,11 +84,18 @@ class DevtoolBase(oeSelfTest):
>
> class DevtoolTests(DevtoolBase):
>
> + def _get_workspace_dir(self):
> + """Get workspace directory"""
> + workspacedir = os.path.join(self.builddir, 'workspace')
> + self.assertTrue(not os.path.exists(workspacedir),
> + 'This test cannot be run with a workspace directory '
> + 'under the build directory')
> + return workspacedir
> +
> @testcase(1158)
> def test_create_workspace(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
If all tests are using workspacedir, I believe it make sense to have a
setUp method and setting workspacedir there:
.
def setUp(self):
self.workspacedir = # the _get_workspace_dir body code goes here
.
.
> result = runCmd('bitbake-layers show-layers')
> self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf')
> # Try creating a workspace layer with a specific path
> @@ -109,9 +116,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1159)
> def test_devtool_add(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> # Fetch source
> tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> self.track_for_cleanup(tempdir)
> @@ -144,9 +149,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1162)
> def test_devtool_add_library(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> # We don't have the ability to pick up this dependency automatically yet...
> bitbake('libusb1')
> # Fetch source
> @@ -185,9 +188,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1160)
> def test_devtool_add_fetch(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> # Fetch source
> tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> self.track_for_cleanup(tempdir)
> @@ -232,9 +233,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1161)
> def test_devtool_add_fetch_git(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> # Fetch source
> tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> self.track_for_cleanup(tempdir)
> @@ -284,9 +283,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1164)
> def test_devtool_modify(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> # Clean up anything in the workdir/sysroot/sstate cache
> bitbake('mdadm -c cleansstate')
> # Try modifying a recipe
> @@ -336,9 +333,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1166)
> def test_devtool_modify_invalid(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> # Try modifying some recipes
> tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> self.track_for_cleanup(tempdir)
> @@ -400,8 +395,7 @@ class DevtoolTests(DevtoolBase):
> @testcase(1165)
> def test_devtool_modify_git(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> testrecipe = 'mkelfimage'
> src_uri = get_bb_var('SRC_URI', testrecipe)
> self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
> @@ -434,8 +428,7 @@ class DevtoolTests(DevtoolBase):
> @testcase(1167)
> def test_devtool_modify_localfiles(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> testrecipe = 'lighttpd'
> src_uri = (get_bb_var('SRC_URI', testrecipe) or '').split()
> foundlocal = False
> @@ -467,8 +460,7 @@ class DevtoolTests(DevtoolBase):
> @testcase(1169)
> def test_devtool_update_recipe(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> testrecipe = 'minicom'
> recipefile = get_bb_var('FILE', testrecipe)
> src_uri = get_bb_var('SRC_URI', testrecipe)
> @@ -514,8 +506,7 @@ class DevtoolTests(DevtoolBase):
> @testcase(1172)
> def test_devtool_update_recipe_git(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> testrecipe = 'mtd-utils'
> recipefile = get_bb_var('FILE', testrecipe)
> src_uri = get_bb_var('SRC_URI', testrecipe)
> @@ -609,8 +600,7 @@ class DevtoolTests(DevtoolBase):
> @testcase(1170)
> def test_devtool_update_recipe_append(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> testrecipe = 'mdadm'
> recipefile = get_bb_var('FILE', testrecipe)
> src_uri = get_bb_var('SRC_URI', testrecipe)
> @@ -685,8 +675,7 @@ class DevtoolTests(DevtoolBase):
> @testcase(1171)
> def test_devtool_update_recipe_append_git(self):
> # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> testrecipe = 'mtd-utils'
> recipefile = get_bb_var('FILE', testrecipe)
> src_uri = get_bb_var('SRC_URI', testrecipe)
> @@ -781,9 +770,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1163)
> def test_devtool_extract(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> # Try devtool extract
> self.track_for_cleanup(tempdir)
> @@ -795,9 +782,7 @@ class DevtoolTests(DevtoolBase):
>
> @testcase(1168)
> def test_devtool_reset_all(self):
> - # Check preconditions
> - workspacedir = os.path.join(self.builddir, 'workspace')
> - self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> + workspacedir = self._get_workspace_dir()
> tempdir = tempfile.mkdtemp(prefix='devtoolqa')
> self.track_for_cleanup(tempdir)
> self.track_for_cleanup(workspacedir)
> @@ -846,7 +831,7 @@ class DevtoolTests(DevtoolBase):
> break
> else:
> self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test')
> - workspacedir = os.path.join(self.builddir, 'workspace')
> + workspacedir = self._get_workspace_dir()
> self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
> # Definitions
> testrecipe = 'mdadm'
>
next prev parent reply other threads:[~2015-09-28 20:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 11:52 [PATCH v3 00/10] devtool: improve handling of local source files Markus Lehtonen
2015-09-24 11:52 ` [PATCH v3 01/10] recipeutils: implement get_recipe_local_files() Markus Lehtonen
2015-09-24 11:52 ` [PATCH v3 02/10] oe.patch.GitApplyTree: add paths argument to extractPatches Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 03/10] oe-selftest: devtool: add method for checking workspace dir Markus Lehtonen
2015-09-28 20:25 ` Leonardo Sandoval [this message]
2015-09-29 10:57 ` Markus Lehtonen
2015-09-29 12:38 ` Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 04/10] oe-selftest: devtool: add method for checking srctree repo Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 05/10] oe-selftest: devtool: add method for checking repo status Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 06/10] devtool: update-recipe: add new patches in correct order Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 07/10] devtool: update_recipe: refactor patch generation Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 08/10] devtool: file mover function that creates target dir Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 09/10] devtool: better support for local source files Markus Lehtonen
2015-09-24 11:53 ` [PATCH v3 10/10] devtool: modify: make bitbake use local files from srctree Markus Lehtonen
2015-09-28 13:48 ` Paul Eggleton
2015-09-30 9:01 ` Markus Lehtonen
2015-09-30 9:21 ` Paul Eggleton
2015-09-30 10:05 ` Markus Lehtonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5609A248.8020303@linux.intel.com \
--to=leonardo.sandoval.gonzalez@linux.intel.com \
--cc=markus.lehtonen@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul.eggleton@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox