[dunfell,1.46,1/1] cooker/command: Add a dummy event for tinfoil testing

Message ID 0c9b0fd205f206fc3318c36cd2abc16b565aa2a5.1641401726.git.steve@sakoman.com
State Accepted, archived
Commit c5969eedd035648e3258bade386cc67ce3bb0e03
Headers show
Series [dunfell,1.46,1/1] cooker/command: Add a dummy event for tinfoil testing | expand

Commit Message

Steve Sakoman Jan. 5, 2022, 4:56 p.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

We need a command genetating an event to test through the tinfoil API. The
current test has IO load issues so add a dummy version which won't have
the IO constraints.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a144178584394ea0700ffc2f2bfac94e8690effc)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/command.py | 10 ++++++++++
 lib/bb/cooker.py  |  5 +++++
 2 files changed, 15 insertions(+)

Patch

diff --git a/lib/bb/command.py b/lib/bb/command.py
index 07128027..98c945ed 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -624,6 +624,16 @@  class CommandsAsync:
         command.finishAsyncCommand()
     findFilesMatchingInDir.needcache = False
 
+    def testCookerCommandEvent(self, command, params):
+        """
+        Dummy command used by OEQA selftest to test tinfoil without IO
+        """
+        pattern = params[0]
+
+        command.cooker.testCookerCommandEvent(pattern)
+        command.finishAsyncCommand()
+    testCookerCommandEvent.needcache = False
+
     def findConfigFilePath(self, command, params):
         """
         Find the path of the requested configuration file
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 8d9ca680..ac54d437 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1019,6 +1019,11 @@  class BBCooker:
         if matches:
             bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.data)
 
+    def testCookerCommandEvent(self, filepattern):
+        # Dummy command used by OEQA selftest to test tinfoil without IO
+        matches = ["A", "B"]
+        bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.data)
+
     def findProviders(self, mc=''):
         return bb.providers.findProviders(self.databuilder.mcdata[mc], self.recipecaches[mc], self.recipecaches[mc].pkg_pn)