Skip to contentSkip to conversation

fix for oeqa/core/loader.py and image_types.bbclass

PATCH In review Robert Yang 1 participant 4 messages Dec 21, 2017 – Dec 26, 2017

lore
Share & tools
lore
#0 lore raw

cover fix for oeqa/core/loader.py and image_types.bbclass

The following changes since commit 978472c58629d1448399207873bbead96b27102e:

image.bbclass: Add additional bb.debug to help track 12304 (2017-12-18 18:02:12 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/2fixes
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/2fixes

Robert Yang (2):
oeqa/core/loader.py: fix re for module image_types.bbclass: use stat to get sparse file's size

 meta/classes/image_types.bbclass | 2 +-
 meta/lib/oeqa/core/loader.py     | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 oeqa/core/loader.py: fix re for module

Fixed:

$ oe-selftest -r eSDK.oeSDKExtSelfTest.test_image_generation_binary_feeds
Traceback (most recent call last):
[snip]
  File "/workspace2/lyang1/poky/meta/lib/oeqa/core/loader.py", line 49, in _built_modules_dict
    module_name, class_name, test_name = m.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

The old code assumed the arg should be:
module.Class.test

Note about the module and Class, the lower and upper cases matters, which can't handle the testcases like eSDK.oeSDKExtSelfTest.test_image_generation_binary_feeds and gotoolchain.oeGoToolchainSelfTest.test_go_dep_build. Use a new re to fix the problem, now all of the following commmands can work:

$ oe-selftest -r eSDK
$ oe-selftest -r eSDK.oeSDKExtSelfTest
$ oe-selftest -r eSDK.oeSDKExtSelfTest.test_image_generation_binary_feeds

[YOCTO #12438]

---
 meta/lib/oeqa/core/loader.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/lib/oeqa/core/loader.py +4 -3
index 975a081..25078ba 100644
@@ -41,9 +41,10 @@ def _built_modules_dict(modules):
         return modules_dict
 
     for module in modules:
-        # Assumption: package and module names do not contain upper case
-        # characters, whereas class names do
-        m = re.match(r'^([^A-Z]+)(?:\.([A-Z][^.]*)(?:\.([^.]+))?)?$', module)
+        # The format is module.class.test, while .class and .test is optional.
+        m = re.match(r'([^\.]+)(?:\.([^\.]+))?(?:\.([^\.]*))?', module)
+        if not m:
+            raise OEQATestNotFound("Not found %s in loaded test cases" % module)
 
         module_name, class_name, test_name = m.groups()
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] oeqa/core/loader.py: fix re for module

Please drop patch 1/2 since Leo has sent patch for it:

core/loader.py: fix regex to include all available test cases

// Robert

Quoted 45 lines · Robert Yang

Fixed:

$ oe-selftest -r eSDK.oeSDKExtSelfTest.test_image_generation_binary_feeds
Traceback (most recent call last):
[snip]
   File "/workspace2/lyang1/poky/meta/lib/oeqa/core/loader.py", line 49, in _built_modules_dict
     module_name, class_name, test_name = m.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

The old code assumed the arg should be:
module.Class.test

Note about the module and Class, the lower and upper cases matters, which can't handle the testcases like eSDK.oeSDKExtSelfTest.test_image_generation_binary_feeds and gotoolchain.oeGoToolchainSelfTest.test_go_dep_build. Use a new re to fix the problem, now all of the following commmands can work:

$ oe-selftest -r eSDK
$ oe-selftest -r eSDK.oeSDKExtSelfTest
$ oe-selftest -r eSDK.oeSDKExtSelfTest.test_image_generation_binary_feeds

[YOCTO #12438]

---
  meta/lib/oeqa/core/loader.py | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
meta/lib/oeqa/core/loader.py +4 -3
index 975a081..25078ba 100644
@@ -41,9 +41,10 @@ def _built_modules_dict(modules):
          return modules_dict
 
      for module in modules:
-        # Assumption: package and module names do not contain upper case
-        # characters, whereas class names do
-        m = re.match(r'^([^A-Z]+)(?:\.([A-Z][^.]*)(?:\.([^.]+))?)?$', module)
+        # The format is module.class.test, while .class and .test is optional.
+        m = re.match(r'([^\.]+)(?:\.([^\.]+))?(?:\.([^\.]*))?', module)
+        if not m:
+            raise OEQATestNotFound("Not found %s in loaded test cases" % module)
 
          module_name, class_name, test_name = m.groups()
 
#3 lore raw

PATCH 2/2 image_types.bbclass: use stat to get sparse file's size

In reply to Robert Yang

The "ls -s sparse_file"'s result is 0, use stat to replace of it.

---
 meta/classes/image_types.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image_types.bbclass +1 -1
index e881d0c..4a96f61 100644
@@ -86,7 +86,7 @@ oe_mkext234fs () {
 	bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
 	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
 	bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-	bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
+	bbdebug 1 "Actual Partion size: `stat -c '%s' ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
 	bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
 	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
 	# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
Signature · 1 line
2.7.4