Skip to contentSkip to conversation

test_metadata_src_uri: new unittest detecting added patch files without modifying SRC_URI

PATCH In review [email protected] 3 participants 6 messages Mar 5, 2019 – Jun 4, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test_metadata_src_uri: new unittest detecting added patch files without modifying SRC_URI

From: Changqing Li <[email protected]>

Adds new unittest detecting when a patch file is added but no corresponding change to the SRC_URI is done.

This patch is from <[email protected]>, get from commit 49201c19cfe4cadd127b112d2858d5b28db49c20, this commit is reverted by commit 6108d97f83b211f9eb245f339a412debd0ec5db4.

The added test case is ok, reason of series 9949 patchtest failed is:
recipe weston have REQUIRED_DISTRO_FEATURES, so parse recipe skipped, cause self.modified is none, actually .bb is mofified, so make the testcase failed.

during patchtest, we don't really need DISTRO_FEATURES, so fix the problem by set REQUIRED_DISTRO_FEATURES to "" in repo patchtest, meantime, add this testcase back.

[Yocto #13005]

---
 tests/test_metadata_src_uri.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
tests/test_metadata_src_uri.py +25 -0
index a4c5caa..f684ced 100644
@@ -85,3 +85,28 @@ class SrcUri(base.Metadata):
                               'Amend the patch containing the software patch file removal',
                               data=[('Patch', f) for f in not_removed])
 
+    def test_src_uri_path_not_updated(self):
+        new_patches = set()
+        for patch in self.patchset:
+            if patch.is_added_file and patch.path.endswith('.patch'):
+                new_patches.add(os.path.basename(patch.path))
+
+        if not new_patches:
+            self.skip('No new patches added, skipping test')
+
+        if not self.modified:
+            self.fail('New patch path missing in SRC_URI',
+                       "Add the patch path to the recipe's SRC_URI",
+                       data=[('New patch(es)', '\n'.join(new_patches))])
+
+        for pn in self.modified:
+            rd = self.tinfoil.parse_recipe(pn)
+
+            patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata)
+            test_src_uri    = patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)].split()
+            test_files    = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')])
+
+            if not test_files.issuperset(new_patches):
+                self.fail('New patch path missing in SRC_URI',
+                          "Add the patch path in the recipe's SRC_URI",
+                          data=[('New patch(es)', p) for p in new_patches.difference(test_files)])
Signature · 1 line
2.7.4
#1 lore raw

ping

Quoted 57 lines · On 3/5/19 5:59 PM, [email protected] wrote:

From: Changqing Li <[email protected]>

Adds new unittest detecting when a patch file is added but no corresponding change to the SRC_URI is done.

This patch is from <[email protected]>, get from commit 49201c19cfe4cadd127b112d2858d5b28db49c20, this commit is reverted by commit 6108d97f83b211f9eb245f339a412debd0ec5db4.

The added test case is ok, reason of series 9949 patchtest failed is:
recipe weston have REQUIRED_DISTRO_FEATURES, so parse recipe skipped, cause self.modified is none, actually .bb is mofified, so make the testcase failed.

during patchtest, we don't really need DISTRO_FEATURES, so fix the problem by set REQUIRED_DISTRO_FEATURES to "" in repo patchtest, meantime, add this testcase back.

[Yocto #13005]

---
  tests/test_metadata_src_uri.py | 25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)
tests/test_metadata_src_uri.py +25 -0
index a4c5caa..f684ced 100644
@@ -85,3 +85,28 @@ class SrcUri(base.Metadata):
                                'Amend the patch containing the software patch file removal',
                                data=[('Patch', f) for f in not_removed])
 
+    def test_src_uri_path_not_updated(self):
+        new_patches = set()
+        for patch in self.patchset:
+            if patch.is_added_file and patch.path.endswith('.patch'):
+                new_patches.add(os.path.basename(patch.path))
+
+        if not new_patches:
+            self.skip('No new patches added, skipping test')
+
+        if not self.modified:
+            self.fail('New patch path missing in SRC_URI',
+                       "Add the patch path to the recipe's SRC_URI",
+                       data=[('New patch(es)', '\n'.join(new_patches))])
+
+        for pn in self.modified:
+            rd = self.tinfoil.parse_recipe(pn)
+
+            patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata)
+            test_src_uri    = patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)].split()
+            test_files    = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')])
+
+            if not test_files.issuperset(new_patches):
+                self.fail('New patch path missing in SRC_URI',
+                          "Add the patch path in the recipe's SRC_URI",
+                          data=[('New patch(es)', p) for p in new_patches.difference(test_files)])
Signature · 3 lines
BRs

Sandy(Li Changqing)
#2 lore raw

ping

Quoted 65 lines · Changqing Li

ping

Quoted 61 lines · On 3/5/19 5:59 PM, [email protected] wrote:

From: Changqing Li <[email protected]>

Adds new unittest detecting when a patch file is added but no corresponding change to the SRC_URI is done.

This patch is from <[email protected]>, get from commit 49201c19cfe4cadd127b112d2858d5b28db49c20, this commit is reverted by commit 6108d97f83b211f9eb245f339a412debd0ec5db4.

The added test case is ok, reason of series 9949 patchtest failed is:
recipe weston have REQUIRED_DISTRO_FEATURES, so parse recipe skipped, cause self.modified is none, actually .bb is mofified, so make the testcase failed.

during patchtest, we don't really need DISTRO_FEATURES, so fix the problem by set REQUIRED_DISTRO_FEATURES to "" in repo patchtest, meantime, add this testcase back.

[Yocto #13005]

---
  tests/test_metadata_src_uri.py | 25 +++++++++++++++++++++++++

  1 file changed, 25 insertions(+)
tests/test_metadata_src_uri.py +0 -0
index a4c5caa..f684ced 100644
@@ -85,3 +85,28 @@ class SrcUri(base.Metadata):
                                 'Amend the patch containing the software patch file removal',
                                 data=[('Patch', f) for f in not_removed])

  +    def test_src_uri_path_not_updated(self):
+        new_patches = set()
+        for patch in self.patchset:
+            if patch.is_added_file and patch.path.endswith('.patch'):
+                new_patches.add(os.path.basename(patch.path))

tests/test_metadata_src_uri.py +8 -0
+
+        if not new_patches:
+            self.skip('No new patches added, skipping test')
+
+        if not self.modified:
+            self.fail('New patch path missing in SRC_URI',
+                       "Add the patch path to the recipe's SRC_URI",
+                       data=[('New patch(es)', 

'\n'.join(new_patches))])

tests/test_metadata_src_uri.py +5 -0
+
+        for pn in self.modified:
+            rd = self.tinfoil.parse_recipe(pn)
+
+            patchtestdata.PatchTestDataStore['%s-%s-%s' % 

(self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata)
+            test_src_uri    =
patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)].split() +            test_files    = set([os.path.basename(patch) for patch
in test_src_uri if patch.startswith('file://')])
+
+            if not test_files.issuperset(new_patches):
+                self.fail('New patch path missing in SRC_URI',
+                          "Add the patch path in the recipe's SRC_URI",
+                          data=[('New patch(es)', p) for p in new_patches.difference(test_files)])

Signature · 3 lines
BRs

Sandy(Li Changqing)
#3 lore raw
Quoted 5 lines · Changqing Li

ping

Quoted 2 lines · Changqing Li

ping

Does this mean you have a working knowledge of patchtest?

The one used by the project appears to be off line.  Can you help?

kind regards,
Armin

Quoted 74 lines
Quoted 74 lines · On 3/5/19 5:59 PM, [email protected] wrote:
Quoted 72 lines

From: Changqing Li <[email protected]>

Adds new unittest detecting when a patch file is added but no corresponding
change to the SRC_URI is done.

This patch is from <[email protected]>, get from commit
49201c19cfe4cadd127b112d2858d5b28db49c20, this commit is reverted by commit
6108d97f83b211f9eb245f339a412debd0ec5db4.

The added test case is ok, reason of series 9949 patchtest failed is:
recipe weston have REQUIRED_DISTRO_FEATURES, so parse recipe skipped, cause self.modified is none, actually .bb is mofified, so make the testcase failed.

during patchtest, we don't really need DISTRO_FEATURES, so fix the problem
by set REQUIRED_DISTRO_FEATURES to "" in repo patchtest, meantime, add this
testcase back.

[Yocto #13005]

---
  tests/test_metadata_src_uri.py | 25 +++++++++++++++++++++++++

  1 file changed, 25 insertions(+)
tests/test_metadata_src_uri.py +0 -0
index a4c5caa..f684ced 100644
@@ -85,3 +85,28 @@ class SrcUri(base.Metadata):

                                'Amend the patch containing the software patch file removal',
                                data=[('Patch', f) for f in not_removed])
  +    def test_src_uri_path_not_updated(self):
+        new_patches = set()
+        for patch in self.patchset:
+            if patch.is_added_file and patch.path.endswith('.patch'):
+                new_patches.add(os.path.basename(patch.path))

tests/test_metadata_src_uri.py +8 -0
+
+        if not new_patches:
+            self.skip('No new patches added, skipping test')
+
+        if not self.modified:
+            self.fail('New patch path missing in SRC_URI',
+                       "Add the patch path to the recipe's SRC_URI",
+                       data=[('New patch(es)',

'\n'.join(new_patches))])

tests/test_metadata_src_uri.py +5 -0
+
+        for pn in self.modified:
+            rd = self.tinfoil.parse_recipe(pn)
+
+            patchtestdata.PatchTestDataStore['%s-%s-%s' %

(self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata) +            test_src_uri    = patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)].split()
+            test_files    = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')])
+
+            if not test_files.issuperset(new_patches):
+                self.fail('New patch path missing in SRC_URI', +                          "Add the patch path in the recipe's SRC_URI",
+                          data=[('New patch(es)', p) for p in new_patches.difference(test_files)])

#4 lore raw
Quoted 5 lines · akuster
Quoted 3 lines · Changqing Li

ping

On 4/29/19 2:10 PM, Changqing Li wrote:

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

ping

Does this mean you have a working knowledge of patchtest?

The one used by the project appears to be off line.  Can you help?

kind regards,
Armin

I have do some work on this,  and can try to help,  but I don't have

access right of the server,  and I also don't have the admin account of

the patchwork.  if  someone can  provide these info,  I am glad to help.

Quoted 74 lines
Quoted 73 lines
Quoted 73 lines · On 3/5/19 5:59 PM, [email protected] wrote:
Quoted 72 lines

From: Changqing Li <[email protected]>

Adds new unittest detecting when a patch file is added but no corresponding
change to the SRC_URI is done.

This patch is from <[email protected]>, get from commit
49201c19cfe4cadd127b112d2858d5b28db49c20, this commit is reverted by commit
6108d97f83b211f9eb245f339a412debd0ec5db4.

The added test case is ok, reason of series 9949 patchtest failed is:
recipe weston have REQUIRED_DISTRO_FEATURES, so parse recipe skipped, cause self.modified is none, actually .bb is mofified, so make the testcase failed.

during patchtest, we don't really need DISTRO_FEATURES, so fix the problem
by set REQUIRED_DISTRO_FEATURES to "" in repo patchtest, meantime, add this
testcase back.

[Yocto #13005]

---
   tests/test_metadata_src_uri.py | 25 +++++++++++++++++++++++++
   1 file changed, 25 insertions(+)
tests/test_metadata_src_uri.py +0 -0
index a4c5caa..f684ced 100644
@@ -85,3 +85,28 @@ class SrcUri(base.Metadata):
                                 'Amend the patch containing the
 software patch file removal',
                                 data=[('Patch', f) for f in

not_removed])
  +    def test_src_uri_path_not_updated(self):
+        new_patches = set()
+        for patch in self.patchset:
+            if patch.is_added_file and patch.path.endswith('.patch'):
+                new_patches.add(os.path.basename(patch.path))

tests/test_metadata_src_uri.py +8 -0
+
+        if not new_patches:
+            self.skip('No new patches added, skipping test')
+
+        if not self.modified:
+            self.fail('New patch path missing in SRC_URI',
+                       "Add the patch path to the recipe's SRC_URI",
+                       data=[('New patch(es)',

'\n'.join(new_patches))])

tests/test_metadata_src_uri.py +5 -0
+
+        for pn in self.modified:
+            rd = self.tinfoil.parse_recipe(pn)
+
+            patchtestdata.PatchTestDataStore['%s-%s-%s' %

(self.shortid(), self.metadata, pn)] = rd.getVar(self.metadata) +            test_src_uri    = patchtestdata.PatchTestDataStore['%s-%s-%s' % (self.shortid(), self.metadata, pn)].split()
+            test_files    = set([os.path.basename(patch) for patch in test_src_uri if patch.startswith('file://')])
+
+            if not test_files.issuperset(new_patches):
+                self.fail('New patch path missing in SRC_URI', +                          "Add the patch path in the recipe's SRC_URI",
+                          data=[('New patch(es)', p) for p in new_patches.difference(test_files)])

Signature · 3 lines
BRs

Sandy(Li Changqing)
#5 lore raw
Quoted 11 lines · Changqing Li
Quoted 10 lines · akuster
Quoted 5 lines · Changqing Li

ping

Quoted 2 lines · Changqing Li

ping

Does this mean you have a working knowledge of patchtest?

The one used by the project appears to be off line. Can you help?

Quoted 8 lines
Quoted 2 lines

kind regards,
Armin

I have do some work on this, and can try to help, but I don't have

access right of the server, and I also don't have the admin account of the patchwork. if someone can provide these info, I am glad to help.

Help would be much appreciated, lets take this offlist and work with Michael and Paul and see if we can figure out how to move forward.

Cheers,

Richard