1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-11-02 11:26:41 +01:00

dtoc: Split source-code scanning to a separate file

Before expanding the scanning features any more, move this into a separate
file. This will make it easier to maintain in the future. In particular,
it reduces the size of dtb_platdata.py and allows us to add tests
specifically for scanning, without going through that file.

The pieces moved are the Driver class, the scanning code and the various
naming functions, since they mostly depend on the scanning results.

So far there is are no separate tests for src_scan. These will be added
as new functionality appears.

This introduces no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-12-28 20:35:06 -07:00
parent d960f0db28
commit a542a70c22
3 changed files with 204 additions and 169 deletions

View File

@@ -18,13 +18,14 @@ import tempfile
import unittest
from unittest import mock
from dtb_platdata import conv_name_to_c
from dtb_platdata import get_compat_name
from dtb_platdata import get_value
from dtb_platdata import tab_to
from dtoc import dtb_platdata
from dtoc import fdt
from dtoc import fdt_util
from dtoc import src_scan
from dtoc.src_scan import conv_name_to_c
from dtoc.src_scan import get_compat_name
from patman import test_util
from patman import tools
@@ -933,9 +934,9 @@ U_BOOT_DRVINFO(spl_test2) = {
def test_driver(self):
"""Test the Driver class"""
drv1 = dtb_platdata.Driver('fred')
drv2 = dtb_platdata.Driver('mary')
drv3 = dtb_platdata.Driver('fred')
drv1 = src_scan.Driver('fred')
drv2 = src_scan.Driver('mary')
drv3 = src_scan.Driver('fred')
self.assertEqual("Driver(name='fred')", str(drv1))
self.assertEqual(drv1, drv3)
self.assertNotEqual(drv1, drv2)
@@ -989,8 +990,7 @@ U_BOOT_DRVINFO(spl_test2) = {
# Mock out scan_driver and check that it is called with the
# expected files
with mock.patch.object(dtb_platdata.DtbPlatdata, "scan_driver") \
as mocked:
with mock.patch.object(src_scan.Scanner, "scan_driver") as mocked:
dtb_platdata.run_steps(['all'], dtb_file, False, None, [outdir],
True, basedir=indir)
self.assertEqual(2, len(mocked.mock_calls))