[yocto] [PATCH 1/3] Add -ptest package group

2012-08-23 Thread Björn Stenberg
This patch creates a new package group -ptest to contain the tests for
each package.

---
 meta/classes/distutils-common-base.bbclass |5 -
 meta/classes/image.bbclass |6 --
 meta/classes/package.bbclass   |8 ++--
 meta/classes/task.bbclass  |2 +-
 meta/conf/bitbake.conf |   14 --
 5 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/meta/classes/distutils-common-base.bbclass 
b/meta/classes/distutils-common-base.bbclass
index f66a5cd..7db015b 100644
--- a/meta/classes/distutils-common-base.bbclass
+++ b/meta/classes/distutils-common-base.bbclass
@@ -5,7 +5,7 @@ EXTRA_OEMAKE = ""
 export STAGING_INCDIR
 export STAGING_LIBDIR
 
-PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-doc ${PN}"
+PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-ptest ${PN}-doc ${PN}"
 
 FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
 
@@ -19,3 +19,6 @@ FILES_${PN}-dbg += "\
   ${PYTHON_SITEPACKAGES_DIR}/*/.debug \
   ${PYTHON_SITEPACKAGES_DIR}/*/*/.debug \
 "
+FILES_${PN}-ptest += "\
+  ${PYTHON_SITEPACKAGES_DIR}/${PTEST_NAME} \
+"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 72720f1..c154bc2 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -29,13 +29,13 @@ ROOTFS_BOOTSTRAP_INSTALL = 
"${@base_contains("IMAGE_FEATURES", "package-manageme
 FEATURE_INSTALL = "${@' 
'.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', 
d), d))}"
 FEATURE_INSTALL_OPTIONAL = "${@' 
'.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', 
d), d))}"
 
-# packages to install from features, excluding dev/dbg/doc
+# packages to install from features, excluding dev/dbg/doc/ptest
 NORMAL_FEATURE_INSTALL = "${@' 
'.join(oe.packagegroup.required_packages(normal_groups(d), d))}"
 NORMAL_FEATURE_INSTALL_OPTIONAL = "${@' 
'.join(oe.packagegroup.optional_packages(normal_groups(d), d))}"
 
 def normal_groups(d):
 """Return all the IMAGE_FEATURES, with the exception of our special 
package groups"""
-extras = set(['dev-pkgs', 'staticdev-pkgs', 'doc-pkgs', 'dbg-pkgs'])
+extras = set(['dev-pkgs', 'staticdev-pkgs', 'doc-pkgs', 'dbg-pkgs', 
'ptest-pkgs'])
 features = set(oe.data.typed_value('IMAGE_FEATURES', d))
 return features.difference(extras)
 
@@ -53,6 +53,8 @@ def complementary_globs(featurevar, d):
 globs.append('*-doc')
 elif feature == 'dbg-pkgs':
 globs.append('*-dbg')
+elif feature == 'ptest-pkgs':
+globs.append('*-ptest')
 return ' '.join(globs)
 
 IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index d122cd9..6483a1f 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1236,7 +1236,7 @@ python package_do_filedeps() {
 
 # Determine dependencies
 for pkg in packages.split():
-if pkg.endswith('-dbg') or pkg.endswith('-doc') or 
pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or 
pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or 
pkg.startswith('kernel-module-'):
+if pkg.endswith('-dbg') or pkg.endswith('-doc') or 
pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or 
pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or 
pkg.startswith('kernel-module-') or pkg.endswith('-ptest'):
 continue
 
 provides_files = []
@@ -1330,7 +1330,7 @@ python package_do_shlibs() {
 combos.append("-".join(options[0:i]))
 return combos
 
-if (file.endswith('.dylib') or file.endswith('.so')) and not 
pkg.endswith('-dev') and not pkg.endswith('-dbg'):
+if (file.endswith('.dylib') or file.endswith('.so')) and not 
pkg.endswith('-dev') and not pkg.endswith('-dbg') and not 
pkg.endswith('-ptest'):
 # Drop suffix
 name = file.rsplit(".",1)[0]
 # Find all combinations
@@ -1648,6 +1648,8 @@ python package_depchains() {
 depend = depend.replace('-dev', '')
 if depend.endswith('-dbg'):
 depend = depend.replace('-dbg', '')
+if depend.endswith('-ptest'):
+depend = depend.replace('-ptest', '')
 pkgname = getname(depend, suffix)
 #bb.note("Adding %s for %s" % (pkgname, depend))
 if pkgname not in rreclist and pkgname != pkg:
@@ -1669,6 +1671,8 @@ python package_depchains() {
 depend = depend.replace('-dev', '')
 if depend.endswith('-dbg'):
 depend = depend.replace('-dbg', '')
+if depend.endswith('-ptest'):
+depend = depend.replace('-ptest', '')
 pkgname = getname(depend, suffix)
 #bb.note("Adding %s for %s" % (pkgname, depend))
 if pkgname not in rreclist and pkgname != pkg:
diff --git a/meta/classes/task.b

Re: [yocto] [PATCH 1/3] Add -ptest package group

2012-08-23 Thread Paul Eggleton
On Thursday 23 August 2012 16:20:00 Björn Stenberg wrote:
> This patch creates a new package group -ptest to contain the tests for
> each package.
>...
> @@ -242,7 +246,7 @@ HOMEPAGE = "unknown"
>  # Ensure that -dev packages recommend the corresponding -dev packages of
> their # deps, and the same for -dbg.
>  DEPCHAIN_PRE  = ""
> -DEPCHAIN_POST = "-dev -dbg"
> +DEPCHAIN_POST = "-dev -dbg -ptest"

Is this really what you want? Surely the tests for a particular piece of 
software are mostly independent of those of its dependencies?

Rest of it looks good.

Cheers,
Paul
 
-- 

Paul Eggleton
Intel Open Source Technology Centre
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [PATCH 1/3] Add -ptest package group

2012-08-23 Thread Björn Stenberg
Paul Eggleton wrote:
> > +DEPCHAIN_POST = "-dev -dbg -ptest"
> 
> Is this really what you want? Surely the tests for a particular piece of 
> software are mostly independent of those of its dependencies?

You're right, that change is not necessary. I misunderstood the purpose of 
DEPCHAIN_POST.

-- 
Björn
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [PATCH 1/3] Add -ptest package group

2012-08-24 Thread Richard Purdie
On Thu, 2012-08-23 at 16:20 +0200, Björn Stenberg wrote:
> This patch creates a new package group -ptest to contain the tests for
> each package.
> 
> ---
>  meta/classes/distutils-common-base.bbclass |5 -
>  meta/classes/image.bbclass |6 --
>  meta/classes/package.bbclass   |8 ++--
>  meta/classes/task.bbclass  |2 +-
>  meta/conf/bitbake.conf |   14 --
>  5 files changed, 27 insertions(+), 8 deletions(-)
> 
> diff --git a/meta/classes/distutils-common-base.bbclass 
> b/meta/classes/distutils-common-base.bbclass
> index f66a5cd..7db015b 100644
> --- a/meta/classes/distutils-common-base.bbclass
> +++ b/meta/classes/distutils-common-base.bbclass
> @@ -5,7 +5,7 @@ EXTRA_OEMAKE = ""
>  export STAGING_INCDIR
>  export STAGING_LIBDIR
>  
> -PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-doc ${PN}"
> +PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-ptest ${PN}-doc ${PN}"
>  
>  FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
>  
> @@ -19,3 +19,6 @@ FILES_${PN}-dbg += "\
>${PYTHON_SITEPACKAGES_DIR}/*/.debug \
>${PYTHON_SITEPACKAGES_DIR}/*/*/.debug \
>  "
> +FILES_${PN}-ptest += "\
> +  ${PYTHON_SITEPACKAGES_DIR}/${PTEST_NAME} \
> +"
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 72720f1..c154bc2 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -29,13 +29,13 @@ ROOTFS_BOOTSTRAP_INSTALL = 
> "${@base_contains("IMAGE_FEATURES", "package-manageme
>  FEATURE_INSTALL = "${@' 
> '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES',
>  d), d))}"
>  FEATURE_INSTALL_OPTIONAL = "${@' 
> '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES',
>  d), d))}"
>  
> -# packages to install from features, excluding dev/dbg/doc
> +# packages to install from features, excluding dev/dbg/doc/ptest
>  NORMAL_FEATURE_INSTALL = "${@' 
> '.join(oe.packagegroup.required_packages(normal_groups(d), d))}"
>  NORMAL_FEATURE_INSTALL_OPTIONAL = "${@' 
> '.join(oe.packagegroup.optional_packages(normal_groups(d), d))}"
>  
>  def normal_groups(d):
>  """Return all the IMAGE_FEATURES, with the exception of our special 
> package groups"""
> -extras = set(['dev-pkgs', 'staticdev-pkgs', 'doc-pkgs', 'dbg-pkgs'])
> +extras = set(['dev-pkgs', 'staticdev-pkgs', 'doc-pkgs', 'dbg-pkgs', 
> 'ptest-pkgs'])
>  features = set(oe.data.typed_value('IMAGE_FEATURES', d))
>  return features.difference(extras)
>  
> @@ -53,6 +53,8 @@ def complementary_globs(featurevar, d):
>  globs.append('*-doc')
>  elif feature == 'dbg-pkgs':
>  globs.append('*-dbg')
> +elif feature == 'ptest-pkgs':
> +globs.append('*-ptest')
>  return ' '.join(globs)
>  
>  IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index d122cd9..6483a1f 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1236,7 +1236,7 @@ python package_do_filedeps() {
>  
>  # Determine dependencies
>  for pkg in packages.split():
> -if pkg.endswith('-dbg') or pkg.endswith('-doc') or 
> pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or 
> pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or 
> pkg.startswith('kernel-module-'):
> +if pkg.endswith('-dbg') or pkg.endswith('-doc') or 
> pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or 
> pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or 
> pkg.startswith('kernel-module-') or pkg.endswith('-ptest'):
>  continue

I think filedeps could be useful in this case, autodetecting any
dependencies scripts in the -ptest package could have for example so I'd
not do the above.

>  
>  provides_files = []
> @@ -1330,7 +1330,7 @@ python package_do_shlibs() {
>  combos.append("-".join(options[0:i]))
>  return combos
>  
> -if (file.endswith('.dylib') or file.endswith('.so')) and not 
> pkg.endswith('-dev') and not pkg.endswith('-dbg'):
> +if (file.endswith('.dylib') or file.endswith('.so')) and not 
> pkg.endswith('-dev') and not pkg.endswith('-dbg') and not 
> pkg.endswith('-ptest'):


ditto, we want to detect shlib dependencies.

>  # Drop suffix
>  name = file.rsplit(".",1)[0]
>  # Find all combinations
> @@ -1648,6 +1648,8 @@ python package_depchains() {
>  depend = depend.replace('-dev', '')
>  if depend.endswith('-dbg'):
>  depend = depend.replace('-dbg', '')
> +if depend.endswith('-ptest'):
> +depend = depend.replace('-ptest', '')
>  pkgname = getname(depend, suffix)
>  #bb.note("Adding %s for %s" % (pkgname, depend))
>  if pkgname not in rreclist and pkgname != pkg:
> @@ -1669,6 +

Re: [yocto] [PATCH 1/3] Add -ptest package group

2012-08-28 Thread Björn Stenberg
Richard Purdie wrote:
> Would a ptest.bbclass containing the above make more sense? How
> widespread do we think these tests will be?

Most source packages include some form of test suite that we want to make into 
a -ptest package. I would guesstimate the number to be somewhere between the 
number of -dbg and the number of -dev packages. This is why I felt it made 
sense to add the handling of -ptest side-by-side with the handling of -dev and 
-dbg.

> My biggest worry is the overhead of the patches to
> software to enable the tests. Are you planning to engage the upstreams
> and see if we can get them to accept the patches?

Upstreaming is absolutely the idea, both for the benefit of the entire 
ecosystem and of course to reduce the number of patches.

However I won't downplay the effort required to get hundreds of upstream 
projects to agree on a common concept for test cross compilation and result 
formatting.

I see two main options: Implement first or discuss first.

a) Implement first: We design and implement a good system for yocto/oe and 
then, once it has proven itself, engage the larger open source community with 
our already tested concept.

Pro: It's easier to discuss an already working system
Con: We'll have to manage patches for all packages until agreement

b) Discuss first: We invite the whole open source community to discuss and try 
to agree on how to handle cross-compiled test cases and test result formatting 
before we implement anything.

Pro: No increased patch load until agreement
Con: No result until agreement, which could potentially take a long time

My suggestion is a). I'm open for any and all suggestions that would make the 
patch load easier to manage.

> Also these patches are against OE-Core so need to go to the
> openembedded-code mailing list.

I'll update the patches with the feedback I've got and post them to oe-core for 
further discussion.

Thanks.

-- 
Björn
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto