| Submitter | Joshua Lock |
|---|---|
| Date | June 18, 2011, 3:04 a.m. |
| Message ID | <f0a7d48483260e9251d74216d7569de1a029d035.1308365562.git.josh@linux.intel.com> |
| Download | mbox | patch |
| Permalink | /patch/6089/ |
| State | New, archived |
| Headers | show |
Comments
> + 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.
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
Patch
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__
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(-)