* [RFC PATCH 1/2] sanity.bbclass: pass the data object to the less frequent test harnesses
2011-06-18 3:04 [RFC PATCH 0/2] Sanity testing network connectivity Joshua Lock
@ 2011-06-18 3:04 ` Joshua Lock
2011-06-18 3:04 ` [RFC PATCH 2/2] sanity: implement network connectivity test Joshua Lock
2011-06-18 3:09 ` [RFC PATCH 0/2] Sanity testing network connectivity Joshua Lock
2 siblings, 0 replies; 6+ messages in thread
From: Joshua Lock @ 2011-06-18 3:04 UTC (permalink / raw)
To: openembedded-core
By passing the data object to the less frequently run test harnesses
(check_sanity_tmpdir_change(), check_sanity_sstate_dir_change() and
check_sanity_version_change()) we can run tests against BitBake data here
too.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
meta/classes/sanity.bbclass | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index fc005aa..bffa4f5 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -21,7 +21,7 @@ def check_conf_exists(fn, data):
return True
return False
-def check_sanity_sstate_dir_change(sstate_dir):
+def check_sanity_sstate_dir_change(sstate_dir, data):
# Sanity checks to be done when the value of SSTATE_DIR changes
# Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
@@ -30,14 +30,14 @@ def check_sanity_sstate_dir_change(sstate_dir):
testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
return testmsg
-def check_sanity_tmpdir_change(tmpdir):
+def check_sanity_tmpdir_change(tmpdir, data):
# Sanity checks to be done when the value of TMPDIR changes
# Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
testmsg = check_create_long_filename(tmpdir, "TMPDIR")
return testmsg
-def check_sanity_version_change():
+def check_sanity_version_change(data):
# Sanity checks to be done when SANITY_VERSION changes
return ""
@@ -262,14 +262,14 @@ def check_sanity(e):
sanity_version = int(data.getVar('SANITY_VERSION', e.data, True) or 1)
if last_sanity_version < sanity_version:
- messages = messages + check_sanity_version_change()
- messages = messages + check_sanity_tmpdir_change(tmpdir)
- messages = messages + check_sanity_sstate_dir_change(sstate_dir)
+ messages = messages + check_sanity_version_change(e.data)
+ messages = messages + check_sanity_tmpdir_change(tmpdir, e.data)
+ messages = messages + check_sanity_sstate_dir_change(sstate_dir, e.data)
else:
if last_tmpdir != tmpdir:
- messages = messages + check_sanity_tmpdir_change(tmpdir)
+ messages = messages + check_sanity_tmpdir_change(tmpdir, e.data)
if last_sstate_dir != sstate_dir:
- messages = messages + check_sanity_sstate_dir_change(sstate_dir)
+ messages = messages + check_sanity_sstate_dir_change(sstate_dir, e.data)
if os.path.exists("conf"):
f = file(sanityverfile, 'w')
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [RFC PATCH 2/2] sanity: implement network connectivity test
2011-06-18 3:04 [RFC PATCH 0/2] Sanity testing network connectivity Joshua Lock
2011-06-18 3:04 ` [RFC PATCH 1/2] sanity.bbclass: pass the data object to the less frequent test harnesses Joshua Lock
@ 2011-06-18 3:04 ` Joshua Lock
2011-06-19 15:03 ` Jeremy Puhlman
2011-06-18 3:09 ` [RFC PATCH 0/2] Sanity testing network connectivity Joshua Lock
2 siblings, 1 reply; 6+ messages in thread
From: Joshua Lock @ 2011-06-18 3:04 UTC (permalink / raw)
To: openembedded-core
Sanity test to verify files can be fetched from the network using git, http and
https fetchers point users at a page to help get set up in the case of a failure
Addresses [YOCTO #933]
Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
meta/classes/sanity.bbclass | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index bffa4f5..83a9887 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -35,6 +35,8 @@ def check_sanity_tmpdir_change(tmpdir, data):
# Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
testmsg = check_create_long_filename(tmpdir, "TMPDIR")
+ # Check that we can fetch from various network transports
+ testmsg = testmsg + check_connectivity(data)
return testmsg
def check_sanity_version_change(data):
@@ -75,6 +77,33 @@ def check_create_long_filename(filepath, pathname):
return "Failed to create a file in %s: %s" % (pathname, strerror)
return ""
+def check_connectivity(d):
+ test_uris= ["http://yoctoproject.org/about",
+ "https://eula-downloads.yoctoproject.org/crownbay/crownbay-bernard-5.0.0",
+ "git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=HEAD"]
+ retval = ""
+
+ # Only check connectivity if network and this check enabled
+ # Because it's a fairy heavy test allow disabling of just this sanity test
+ # by setting DISABLE_NETWORK_SANITY
+ data = bb.data.createCopy(d)
+ network_disabled = not bb.data.getVar('BB_NO_NETWORK', data, True)
+ check_disabled = bb.data.getVar('DISABLE_NETWORK_SANITY', data, True)
+ if check_disabled or network_disabled:
+ dldir = bb.data.expand('${TMPDIR}/sanity', data)
+ bb.data.setVar('DL_DIR', dldir, data)
+
+ try:
+ fetcher = bb.fetch2.Fetch(test_uris, data)
+ fetcher.download()
+ fetcher.clean(test_uris)
+ except Exception, e:
+ retval = "Error connecting to the network to fetch, http/https and git checked.\nPlease check the wiki (https://wiki.yoctoproject.org/wiki/Connectivity%20Troubleshooting) for more suggestions.\n" % e
+ finally:
+ # Make sure we tidy up the cruft
+ oe.path.remove(dldir)
+ return retval
+
def check_sanity(e):
from bb import note, error, data, __version__
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [RFC PATCH 2/2] sanity: implement network connectivity test
2011-06-18 3:04 ` [RFC PATCH 2/2] sanity: implement network connectivity test Joshua Lock
@ 2011-06-19 15:03 ` Jeremy Puhlman
2011-06-20 16:20 ` Joshua Lock
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Puhlman @ 2011-06-19 15:03 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
> + test_uris= ["http://yoctoproject.org/about",
> + "https://eula-downloads.yoctoproject.org/crownbay/crownbay-bernard-5.0.0",
> + "git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=HEAD"]
> + retval = ""
These should probably be set as setable from the meta data. It is a
reasonable default, but hard coding it with out a way to change it is
probably not what we want.
> +
> + # Only check connectivity if network and this check enabled
> + # Because it's a fairy heavy test allow disabling of just this sanity test
> + # by setting DISABLE_NETWORK_SANITY
> + data = bb.data.createCopy(d)
> + network_disabled = not bb.data.getVar('BB_NO_NETWORK', data, True)
> + check_disabled = bb.data.getVar('DISABLE_NETWORK_SANITY', data, True)
> + if check_disabled or network_disabled:
Completely minor gnit. The copy here isn't needed until you start
setting the DL_DIR. Why not wait til after the check to see if we need
to do it.
Otherwise seem like a solid idea.
--
Jeremy Puhlman
Montavista Sofware, LLC.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFC PATCH 2/2] sanity: implement network connectivity test
2011-06-19 15:03 ` Jeremy Puhlman
@ 2011-06-20 16:20 ` Joshua Lock
0 siblings, 0 replies; 6+ messages in thread
From: Joshua Lock @ 2011-06-20 16:20 UTC (permalink / raw)
To: openembedded-core
On Sun, 2011-06-19 at 08:03 -0700, Jeremy Puhlman wrote:
> > + test_uris= ["http://yoctoproject.org/about",
> > + "https://eula-downloads.yoctoproject.org/crownbay/crownbay-bernard-5.0.0",
> > + "git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=HEAD"]
> > + retval = ""
>
> These should probably be set as setable from the meta data. It is a
> reasonable default, but hard coding it with out a way to change it is
> probably not what we want.
Agreed.
>
> > +
> > + # Only check connectivity if network and this check enabled
> > + # Because it's a fairy heavy test allow disabling of just this sanity test
> > + # by setting DISABLE_NETWORK_SANITY
> > + data = bb.data.createCopy(d)
> > + network_disabled = not bb.data.getVar('BB_NO_NETWORK', data, True)
> > + check_disabled = bb.data.getVar('DISABLE_NETWORK_SANITY', data, True)
> > + if check_disabled or network_disabled:
>
> Completely minor gnit. The copy here isn't needed until you start
> setting the DL_DIR. Why not wait til after the check to see if we need
> to do it.
Good catch!
>
> Otherwise seem like a solid idea.
>
Thanks for the review Jeremy, v2 on it's way later today.
Cheers,
Joshua
--
Joshua Lock
Yocto Project Build Monkey
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH 0/2] Sanity testing network connectivity
2011-06-18 3:04 [RFC PATCH 0/2] Sanity testing network connectivity Joshua Lock
2011-06-18 3:04 ` [RFC PATCH 1/2] sanity.bbclass: pass the data object to the less frequent test harnesses Joshua Lock
2011-06-18 3:04 ` [RFC PATCH 2/2] sanity: implement network connectivity test Joshua Lock
@ 2011-06-18 3:09 ` Joshua Lock
2 siblings, 0 replies; 6+ messages in thread
From: Joshua Lock @ 2011-06-18 3:09 UTC (permalink / raw)
To: openembedded-core
On Fri, 2011-06-17 at 20:04 -0700, Joshua Lock wrote:
> In response to a Yocto Bugzilla request[1] I've written a sanity test to check
> whether BitBake is able to fecth from http, https and git sources. The idea
> being that if the user is behing a proxy and this test fails we can more easily
> help them diagnose and fix their problem.
>
> I've built on the existing infrastructure for less frequent sanity tests so
> whilst this test is reasonably heavy it will only run when TMPDIR changes
> (usually first run?). Further I added a variable to disable just this sanity
> check. People shipping offline installs to customers should just be able to
> set the variable in their shipped configuration and not worry about this
> sanity check irritating people.
>
> The error message points to a wiki page[2] which is pretty vanilla right now
> but the intention would be to flesh it out with guidance on common proxy/nat/etc
> issues.
I cunningly forgot the url's I referenced. Friday evening, sorry.
1. http://bugzilla.pokylinux.org/show_bug.cgi?id=933
2. https://wiki.yoctoproject.org/wiki/Connectivity_Troubleshooting
Joshua
--
Joshua Lock
Yocto Build System Monkey
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 6+ messages in thread