mirror of
https://xff.cz/git/u-boot/
synced 2025-09-23 11:32:12 +02:00
dtoc: Set up the uclasses that are used
We only care about uclasses that are actually used. This is determined by the drivers that use them. Check all the used drivers and build a list of 'valid' uclasses. Also add references to the uclasses so we can generate C code that uses them. Attach a uclass to each valid driver. For the tests, now that we have uclasses we must create an explicit test for the case where a node does not have one. This should only happen if the source code does not build, or the source-code scanning fails to find it. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -466,3 +466,20 @@ U_BOOT_DRIVER(%s) = {
|
||||
with test_util.capture_sys_output() as (stdout, _):
|
||||
scan.mark_used([node])
|
||||
self.assertEqual('', stdout.getvalue().strip())
|
||||
|
||||
def test_sequence(self):
|
||||
"""Test assignment of sequence numnbers"""
|
||||
scan = src_scan.Scanner(None, False, None, '')
|
||||
node = FakeNode()
|
||||
uc = src_scan.UclassDriver('UCLASS_I2C')
|
||||
node.uclass = uc
|
||||
node.driver = True
|
||||
node.seq = -1
|
||||
node.path = 'mypath'
|
||||
uc.alias_num_to_node[2] = node
|
||||
|
||||
# This should assign 3 (after the 2 that exists)
|
||||
seq = scan.assign_seq(node)
|
||||
self.assertEqual(3, seq)
|
||||
self.assertEqual({'mypath': 3}, uc.alias_path_to_num)
|
||||
self.assertEqual({2: node, 3: node}, uc.alias_num_to_node)
|
||||
|
Reference in New Issue
Block a user