summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/tinfoil.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/tinfoil.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/tinfoil.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/meta/lib/oeqa/selftest/cases/tinfoil.py b/meta/lib/oeqa/selftest/cases/tinfoil.py
index a51c6048d3..6668d7cdc8 100644
--- a/meta/lib/oeqa/selftest/cases/tinfoil.py
+++ b/meta/lib/oeqa/selftest/cases/tinfoil.py
@@ -65,6 +65,20 @@ class TinfoilTests(OESelftestTestCase):
65 localdata.setVar('PN', 'hello') 65 localdata.setVar('PN', 'hello')
66 self.assertEqual('hello', localdata.getVar('BPN')) 66 self.assertEqual('hello', localdata.getVar('BPN'))
67 67
68 # The config_data API tp parse_recipe_file is used by:
69 # layerindex-web layerindex/update_layer.py
70 def test_parse_recipe_custom_data(self):
71 with bb.tinfoil.Tinfoil() as tinfoil:
72 tinfoil.prepare(config_only=False, quiet=2)
73 localdata = bb.data.createCopy(tinfoil.config_data)
74 localdata.setVar("TESTVAR", "testval")
75 testrecipe = 'mdadm'
76 best = tinfoil.find_best_provider(testrecipe)
77 if not best:
78 self.fail('Unable to find recipe providing %s' % testrecipe)
79 rd = tinfoil.parse_recipe_file(best[3], config_data=localdata)
80 self.assertEqual("testval", rd.getVar('TESTVAR'))
81
68 def test_list_recipes(self): 82 def test_list_recipes(self):
69 with bb.tinfoil.Tinfoil() as tinfoil: 83 with bb.tinfoil.Tinfoil() as tinfoil:
70 tinfoil.prepare(config_only=False, quiet=2) 84 tinfoil.prepare(config_only=False, quiet=2)
@@ -87,23 +101,22 @@ class TinfoilTests(OESelftestTestCase):
87 with bb.tinfoil.Tinfoil() as tinfoil: 101 with bb.tinfoil.Tinfoil() as tinfoil:
88 tinfoil.prepare(config_only=True) 102 tinfoil.prepare(config_only=True)
89 103
90 tinfoil.set_event_mask(['bb.event.FilesMatchingFound', 'bb.command.CommandCompleted']) 104 tinfoil.set_event_mask(['bb.event.FilesMatchingFound', 'bb.command.CommandCompleted', 'bb.command.CommandFailed', 'bb.command.CommandExit'])
91 105
92 # Need to drain events otherwise events that were masked may still be in the queue 106 # Need to drain events otherwise events that were masked may still be in the queue
93 while tinfoil.wait_event(): 107 while tinfoil.wait_event():
94 pass 108 pass
95 109
96 pattern = 'conf' 110 pattern = 'conf'
97 res = tinfoil.run_command('findFilesMatchingInDir', pattern, 'conf/machine') 111 res = tinfoil.run_command('testCookerCommandEvent', pattern, handle_events=False)
98 self.assertTrue(res) 112 self.assertTrue(res)
99 113
100 eventreceived = False 114 eventreceived = False
101 commandcomplete = False 115 commandcomplete = False
102 start = time.time() 116 start = time.time()
103 # Wait for maximum 60s in total so we'd detect spurious heartbeat events for example 117 # Wait for maximum 120s in total so we'd detect spurious heartbeat events for example
104 # The test is IO load sensitive too
105 while (not (eventreceived == True and commandcomplete == True) 118 while (not (eventreceived == True and commandcomplete == True)
106 and (time.time() - start < 60)): 119 and (time.time() - start < 120)):
107 # if we received both events (on let's say a good day), we are done 120 # if we received both events (on let's say a good day), we are done
108 event = tinfoil.wait_event(1) 121 event = tinfoil.wait_event(1)
109 if event: 122 if event:
@@ -111,14 +124,15 @@ class TinfoilTests(OESelftestTestCase):
111 commandcomplete = True 124 commandcomplete = True
112 elif isinstance(event, bb.event.FilesMatchingFound): 125 elif isinstance(event, bb.event.FilesMatchingFound):
113 self.assertEqual(pattern, event._pattern) 126 self.assertEqual(pattern, event._pattern)
114 self.assertIn('qemuarm.conf', event._matches) 127 self.assertIn('A', event._matches)
128 self.assertIn('B', event._matches)
115 eventreceived = True 129 eventreceived = True
116 elif isinstance(event, logging.LogRecord): 130 elif isinstance(event, logging.LogRecord):
117 continue 131 continue
118 else: 132 else:
119 self.fail('Unexpected event: %s' % event) 133 self.fail('Unexpected event: %s' % event)
120 134
121 self.assertTrue(commandcomplete, 'Timed out waiting for CommandCompleted event from bitbake server') 135 self.assertTrue(commandcomplete, 'Timed out waiting for CommandCompleted event from bitbake server (Matching event received: %s)' % str(eventreceived))
122 self.assertTrue(eventreceived, 'Did not receive FilesMatchingFound event from bitbake server') 136 self.assertTrue(eventreceived, 'Did not receive FilesMatchingFound event from bitbake server')
123 137
124 def test_setvariable_clean(self): 138 def test_setvariable_clean(self):