tools: binman: fix deprecated Python unittest methods
The methods `unittest.assertEquals()` and `unittest.assertRegexpMatches()` are marked deprecated[1]. In Python 3.12 these aliases have been removed, so do a sed to replace them with their new names. [1] https://docs.python.org/3.11/library/unittest.html#deprecated-aliases Signed-off-by: Brandon Maier <brandon.maier@collins.com> CC: Simon Glass <sjg@chromium.org> CC: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:

committed by
Simon Glass

parent
a8729a260b
commit
357bfca5e6
@@ -103,7 +103,7 @@ class TestEntry(unittest.TestCase):
|
|||||||
ent = entry.Entry.Create(None, self.GetNode(), 'missing',
|
ent = entry.Entry.Create(None, self.GetNode(), 'missing',
|
||||||
missing_etype=True)
|
missing_etype=True)
|
||||||
self.assertTrue(isinstance(ent, Entry_blob))
|
self.assertTrue(isinstance(ent, Entry_blob))
|
||||||
self.assertEquals('missing', ent.etype)
|
self.assertEqual('missing', ent.etype)
|
||||||
|
|
||||||
def testDecompressData(self):
|
def testDecompressData(self):
|
||||||
"""Test the DecompressData() method of the base class"""
|
"""Test the DecompressData() method of the base class"""
|
||||||
@@ -111,8 +111,8 @@ class TestEntry(unittest.TestCase):
|
|||||||
base.compress = 'lz4'
|
base.compress = 'lz4'
|
||||||
bintools = {}
|
bintools = {}
|
||||||
base.comp_bintool = base.AddBintool(bintools, '_testing')
|
base.comp_bintool = base.AddBintool(bintools, '_testing')
|
||||||
self.assertEquals(tools.get_bytes(0, 1024), base.CompressData(b'abc'))
|
self.assertEqual(tools.get_bytes(0, 1024), base.CompressData(b'abc'))
|
||||||
self.assertEquals(tools.get_bytes(0, 1024), base.DecompressData(b'abc'))
|
self.assertEqual(tools.get_bytes(0, 1024), base.DecompressData(b'abc'))
|
||||||
|
|
||||||
def testLookupOffset(self):
|
def testLookupOffset(self):
|
||||||
"""Test the lookup_offset() method of the base class"""
|
"""Test the lookup_offset() method of the base class"""
|
||||||
|
@@ -44,43 +44,43 @@ class TestFdt(unittest.TestCase):
|
|||||||
fname = self.GetCompiled('045_prop_test.dts')
|
fname = self.GetCompiled('045_prop_test.dts')
|
||||||
dt = FdtScan(fname)
|
dt = FdtScan(fname)
|
||||||
node = dt.GetNode('/binman/intel-me')
|
node = dt.GetNode('/binman/intel-me')
|
||||||
self.assertEquals('intel-me', node.name)
|
self.assertEqual('intel-me', node.name)
|
||||||
val = fdt_util.GetString(node, 'filename')
|
val = fdt_util.GetString(node, 'filename')
|
||||||
self.assertEquals(str, type(val))
|
self.assertEqual(str, type(val))
|
||||||
self.assertEquals('me.bin', val)
|
self.assertEqual('me.bin', val)
|
||||||
|
|
||||||
prop = node.props['intval']
|
prop = node.props['intval']
|
||||||
self.assertEquals(fdt.Type.INT, prop.type)
|
self.assertEqual(fdt.Type.INT, prop.type)
|
||||||
self.assertEquals(3, fdt_util.GetInt(node, 'intval'))
|
self.assertEqual(3, fdt_util.GetInt(node, 'intval'))
|
||||||
|
|
||||||
prop = node.props['intarray']
|
prop = node.props['intarray']
|
||||||
self.assertEquals(fdt.Type.INT, prop.type)
|
self.assertEqual(fdt.Type.INT, prop.type)
|
||||||
self.assertEquals(list, type(prop.value))
|
self.assertEqual(list, type(prop.value))
|
||||||
self.assertEquals(2, len(prop.value))
|
self.assertEqual(2, len(prop.value))
|
||||||
self.assertEquals([5, 6],
|
self.assertEqual([5, 6],
|
||||||
[fdt_util.fdt32_to_cpu(val) for val in prop.value])
|
[fdt_util.fdt32_to_cpu(val) for val in prop.value])
|
||||||
|
|
||||||
prop = node.props['byteval']
|
prop = node.props['byteval']
|
||||||
self.assertEquals(fdt.Type.BYTE, prop.type)
|
self.assertEqual(fdt.Type.BYTE, prop.type)
|
||||||
self.assertEquals(chr(8), prop.value)
|
self.assertEqual(chr(8), prop.value)
|
||||||
|
|
||||||
prop = node.props['bytearray']
|
prop = node.props['bytearray']
|
||||||
self.assertEquals(fdt.Type.BYTE, prop.type)
|
self.assertEqual(fdt.Type.BYTE, prop.type)
|
||||||
self.assertEquals(list, type(prop.value))
|
self.assertEqual(list, type(prop.value))
|
||||||
self.assertEquals(str, type(prop.value[0]))
|
self.assertEqual(str, type(prop.value[0]))
|
||||||
self.assertEquals(3, len(prop.value))
|
self.assertEqual(3, len(prop.value))
|
||||||
self.assertEquals([chr(1), '#', '4'], prop.value)
|
self.assertEqual([chr(1), '#', '4'], prop.value)
|
||||||
|
|
||||||
prop = node.props['longbytearray']
|
prop = node.props['longbytearray']
|
||||||
self.assertEquals(fdt.Type.INT, prop.type)
|
self.assertEqual(fdt.Type.INT, prop.type)
|
||||||
self.assertEquals(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
|
self.assertEqual(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
|
||||||
|
|
||||||
prop = node.props['stringval']
|
prop = node.props['stringval']
|
||||||
self.assertEquals(fdt.Type.STRING, prop.type)
|
self.assertEqual(fdt.Type.STRING, prop.type)
|
||||||
self.assertEquals('message2', fdt_util.GetString(node, 'stringval'))
|
self.assertEqual('message2', fdt_util.GetString(node, 'stringval'))
|
||||||
|
|
||||||
prop = node.props['stringarray']
|
prop = node.props['stringarray']
|
||||||
self.assertEquals(fdt.Type.STRING, prop.type)
|
self.assertEqual(fdt.Type.STRING, prop.type)
|
||||||
self.assertEquals(list, type(prop.value))
|
self.assertEqual(list, type(prop.value))
|
||||||
self.assertEquals(3, len(prop.value))
|
self.assertEqual(3, len(prop.value))
|
||||||
self.assertEquals(['another', 'multi-word', 'message'], prop.value)
|
self.assertEqual(['another', 'multi-word', 'message'], prop.value)
|
||||||
|
@@ -2095,7 +2095,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
dtb.Scan()
|
dtb.Scan()
|
||||||
props = self._GetPropTree(dtb, ['size', 'uncomp-size'])
|
props = self._GetPropTree(dtb, ['size', 'uncomp-size'])
|
||||||
orig = self._decompress(data)
|
orig = self._decompress(data)
|
||||||
self.assertEquals(COMPRESS_DATA, orig)
|
self.assertEqual(COMPRESS_DATA, orig)
|
||||||
|
|
||||||
# Do a sanity check on various fields
|
# Do a sanity check on various fields
|
||||||
image = control.images['image']
|
image = control.images['image']
|
||||||
@@ -2809,9 +2809,9 @@ class TestFunctional(unittest.TestCase):
|
|||||||
|
|
||||||
orig_entry = orig_image.GetEntries()['fdtmap']
|
orig_entry = orig_image.GetEntries()['fdtmap']
|
||||||
entry = image.GetEntries()['fdtmap']
|
entry = image.GetEntries()['fdtmap']
|
||||||
self.assertEquals(orig_entry.offset, entry.offset)
|
self.assertEqual(orig_entry.offset, entry.offset)
|
||||||
self.assertEquals(orig_entry.size, entry.size)
|
self.assertEqual(orig_entry.size, entry.size)
|
||||||
self.assertEquals(orig_entry.image_pos, entry.image_pos)
|
self.assertEqual(orig_entry.image_pos, entry.image_pos)
|
||||||
|
|
||||||
def testReadImageNoHeader(self):
|
def testReadImageNoHeader(self):
|
||||||
"""Test accessing an image's FDT map without an image header"""
|
"""Test accessing an image's FDT map without an image header"""
|
||||||
@@ -3895,7 +3895,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
mat = re_line.match(line)
|
mat = re_line.match(line)
|
||||||
vals[mat.group(1)].append(mat.group(2))
|
vals[mat.group(1)].append(mat.group(2))
|
||||||
|
|
||||||
self.assertEquals('FIT description: test-desc', lines[0])
|
self.assertEqual('FIT description: test-desc', lines[0])
|
||||||
self.assertIn('Created:', lines[1])
|
self.assertIn('Created:', lines[1])
|
||||||
self.assertIn('Image 0 (kernel)', vals)
|
self.assertIn('Image 0 (kernel)', vals)
|
||||||
self.assertIn('Hash value', vals)
|
self.assertIn('Hash value', vals)
|
||||||
@@ -4012,7 +4012,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
fit_pos,
|
fit_pos,
|
||||||
fdt_util.fdt32_to_cpu(fnode.props['data-position'].value))
|
fdt_util.fdt32_to_cpu(fnode.props['data-position'].value))
|
||||||
|
|
||||||
self.assertEquals(expected_size, len(data))
|
self.assertEqual(expected_size, len(data))
|
||||||
actual_pos = len(U_BOOT_DATA) + fit_pos
|
actual_pos = len(U_BOOT_DATA) + fit_pos
|
||||||
self.assertEqual(U_BOOT_DATA + b'aa',
|
self.assertEqual(U_BOOT_DATA + b'aa',
|
||||||
data[actual_pos:actual_pos + external_data_size])
|
data[actual_pos:actual_pos + external_data_size])
|
||||||
@@ -4431,7 +4431,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
|
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
|
||||||
'uncomp-size'])
|
'uncomp-size'])
|
||||||
orig = self._decompress(data)
|
orig = self._decompress(data)
|
||||||
self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
|
self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
|
||||||
|
|
||||||
# Do a sanity check on various fields
|
# Do a sanity check on various fields
|
||||||
image = control.images['image']
|
image = control.images['image']
|
||||||
@@ -4475,7 +4475,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
'uncomp-size'])
|
'uncomp-size'])
|
||||||
orig = self._decompress(data)
|
orig = self._decompress(data)
|
||||||
|
|
||||||
self.assertEquals(COMPRESS_DATA + COMPRESS_DATA + U_BOOT_DATA, orig)
|
self.assertEqual(COMPRESS_DATA + COMPRESS_DATA + U_BOOT_DATA, orig)
|
||||||
|
|
||||||
# Do a sanity check on various fields
|
# Do a sanity check on various fields
|
||||||
image = control.images['image']
|
image = control.images['image']
|
||||||
@@ -4519,7 +4519,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
|
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
|
||||||
'uncomp-size'])
|
'uncomp-size'])
|
||||||
orig = self._decompress(data)
|
orig = self._decompress(data)
|
||||||
self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
|
self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
|
||||||
expected = {
|
expected = {
|
||||||
'section/blob:offset': 0,
|
'section/blob:offset': 0,
|
||||||
'section/blob:size': len(COMPRESS_DATA),
|
'section/blob:size': len(COMPRESS_DATA),
|
||||||
@@ -4545,7 +4545,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
|
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
|
||||||
'uncomp-size'])
|
'uncomp-size'])
|
||||||
orig = self._decompress(data)
|
orig = self._decompress(data)
|
||||||
self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
|
self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
|
||||||
expected = {
|
expected = {
|
||||||
'section/blob:offset': 0,
|
'section/blob:offset': 0,
|
||||||
'section/blob:size': len(COMPRESS_DATA),
|
'section/blob:size': len(COMPRESS_DATA),
|
||||||
@@ -4580,7 +4580,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
'uncomp-size'])
|
'uncomp-size'])
|
||||||
|
|
||||||
base = data[len(U_BOOT_DATA):]
|
base = data[len(U_BOOT_DATA):]
|
||||||
self.assertEquals(U_BOOT_DATA, base[:len(U_BOOT_DATA)])
|
self.assertEqual(U_BOOT_DATA, base[:len(U_BOOT_DATA)])
|
||||||
rest = base[len(U_BOOT_DATA):]
|
rest = base[len(U_BOOT_DATA):]
|
||||||
|
|
||||||
# Check compressed data
|
# Check compressed data
|
||||||
@@ -4588,22 +4588,22 @@ class TestFunctional(unittest.TestCase):
|
|||||||
expect1 = bintool.compress(COMPRESS_DATA + U_BOOT_DATA)
|
expect1 = bintool.compress(COMPRESS_DATA + U_BOOT_DATA)
|
||||||
data1 = rest[:len(expect1)]
|
data1 = rest[:len(expect1)]
|
||||||
section1 = self._decompress(data1)
|
section1 = self._decompress(data1)
|
||||||
self.assertEquals(expect1, data1)
|
self.assertEqual(expect1, data1)
|
||||||
self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, section1)
|
self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, section1)
|
||||||
rest1 = rest[len(expect1):]
|
rest1 = rest[len(expect1):]
|
||||||
|
|
||||||
expect2 = bintool.compress(COMPRESS_DATA + COMPRESS_DATA)
|
expect2 = bintool.compress(COMPRESS_DATA + COMPRESS_DATA)
|
||||||
data2 = rest1[:len(expect2)]
|
data2 = rest1[:len(expect2)]
|
||||||
section2 = self._decompress(data2)
|
section2 = self._decompress(data2)
|
||||||
self.assertEquals(expect2, data2)
|
self.assertEqual(expect2, data2)
|
||||||
self.assertEquals(COMPRESS_DATA + COMPRESS_DATA, section2)
|
self.assertEqual(COMPRESS_DATA + COMPRESS_DATA, section2)
|
||||||
rest2 = rest1[len(expect2):]
|
rest2 = rest1[len(expect2):]
|
||||||
|
|
||||||
expect_size = (len(U_BOOT_DATA) + len(U_BOOT_DATA) + len(expect1) +
|
expect_size = (len(U_BOOT_DATA) + len(U_BOOT_DATA) + len(expect1) +
|
||||||
len(expect2) + len(U_BOOT_DATA))
|
len(expect2) + len(U_BOOT_DATA))
|
||||||
#self.assertEquals(expect_size, len(data))
|
#self.assertEqual(expect_size, len(data))
|
||||||
|
|
||||||
#self.assertEquals(U_BOOT_DATA, rest2)
|
#self.assertEqual(U_BOOT_DATA, rest2)
|
||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
expected = {
|
expected = {
|
||||||
@@ -4695,7 +4695,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
|
|
||||||
u_boot = image.GetEntries()['section'].GetEntries()['u-boot']
|
u_boot = image.GetEntries()['section'].GetEntries()['u-boot']
|
||||||
|
|
||||||
self.assertEquals(U_BOOT_DATA, u_boot.ReadData())
|
self.assertEqual(U_BOOT_DATA, u_boot.ReadData())
|
||||||
|
|
||||||
def testTplNoDtb(self):
|
def testTplNoDtb(self):
|
||||||
"""Test that an image with tpl/u-boot-tpl-nodtb.bin can be created"""
|
"""Test that an image with tpl/u-boot-tpl-nodtb.bin can be created"""
|
||||||
@@ -5526,7 +5526,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
|
|||||||
segments, entry = elf.read_loadable_segments(elf_data)
|
segments, entry = elf.read_loadable_segments(elf_data)
|
||||||
|
|
||||||
# We assume there are two segments
|
# We assume there are two segments
|
||||||
self.assertEquals(2, len(segments))
|
self.assertEqual(2, len(segments))
|
||||||
|
|
||||||
atf1 = dtb.GetNode('/images/atf-1')
|
atf1 = dtb.GetNode('/images/atf-1')
|
||||||
_, start, data = segments[0]
|
_, start, data = segments[0]
|
||||||
@@ -6107,7 +6107,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
|
|||||||
data = bintool.compress(COMPRESS_DATA)
|
data = bintool.compress(COMPRESS_DATA)
|
||||||
self.assertNotEqual(COMPRESS_DATA, data)
|
self.assertNotEqual(COMPRESS_DATA, data)
|
||||||
orig = bintool.decompress(data)
|
orig = bintool.decompress(data)
|
||||||
self.assertEquals(COMPRESS_DATA, orig)
|
self.assertEqual(COMPRESS_DATA, orig)
|
||||||
|
|
||||||
def testCompUtilVersions(self):
|
def testCompUtilVersions(self):
|
||||||
"""Test tool version of compression algorithms"""
|
"""Test tool version of compression algorithms"""
|
||||||
@@ -6125,7 +6125,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
|
|||||||
self.assertNotEqual(COMPRESS_DATA, data)
|
self.assertNotEqual(COMPRESS_DATA, data)
|
||||||
data += tools.get_bytes(0, 64)
|
data += tools.get_bytes(0, 64)
|
||||||
orig = bintool.decompress(data)
|
orig = bintool.decompress(data)
|
||||||
self.assertEquals(COMPRESS_DATA, orig)
|
self.assertEqual(COMPRESS_DATA, orig)
|
||||||
|
|
||||||
def testCompressDtbZstd(self):
|
def testCompressDtbZstd(self):
|
||||||
"""Test that zstd compress of device-tree files failed"""
|
"""Test that zstd compress of device-tree files failed"""
|
||||||
|
@@ -807,27 +807,27 @@ CONFIG_LOCALVERSION=y
|
|||||||
params, warnings = self._boards.scan_defconfigs(src, src)
|
params, warnings = self._boards.scan_defconfigs(src, src)
|
||||||
|
|
||||||
# We should get two boards
|
# We should get two boards
|
||||||
self.assertEquals(2, len(params))
|
self.assertEqual(2, len(params))
|
||||||
self.assertFalse(warnings)
|
self.assertFalse(warnings)
|
||||||
first = 0 if params[0]['target'] == 'board0' else 1
|
first = 0 if params[0]['target'] == 'board0' else 1
|
||||||
board0 = params[first]
|
board0 = params[first]
|
||||||
board2 = params[1 - first]
|
board2 = params[1 - first]
|
||||||
|
|
||||||
self.assertEquals('arm', board0['arch'])
|
self.assertEqual('arm', board0['arch'])
|
||||||
self.assertEquals('armv7', board0['cpu'])
|
self.assertEqual('armv7', board0['cpu'])
|
||||||
self.assertEquals('-', board0['soc'])
|
self.assertEqual('-', board0['soc'])
|
||||||
self.assertEquals('Tester', board0['vendor'])
|
self.assertEqual('Tester', board0['vendor'])
|
||||||
self.assertEquals('ARM Board 0', board0['board'])
|
self.assertEqual('ARM Board 0', board0['board'])
|
||||||
self.assertEquals('config0', board0['config'])
|
self.assertEqual('config0', board0['config'])
|
||||||
self.assertEquals('board0', board0['target'])
|
self.assertEqual('board0', board0['target'])
|
||||||
|
|
||||||
self.assertEquals('powerpc', board2['arch'])
|
self.assertEqual('powerpc', board2['arch'])
|
||||||
self.assertEquals('ppc', board2['cpu'])
|
self.assertEqual('ppc', board2['cpu'])
|
||||||
self.assertEquals('mpc85xx', board2['soc'])
|
self.assertEqual('mpc85xx', board2['soc'])
|
||||||
self.assertEquals('Tester', board2['vendor'])
|
self.assertEqual('Tester', board2['vendor'])
|
||||||
self.assertEquals('PowerPC board 1', board2['board'])
|
self.assertEqual('PowerPC board 1', board2['board'])
|
||||||
self.assertEquals('config2', board2['config'])
|
self.assertEqual('config2', board2['config'])
|
||||||
self.assertEquals('board2', board2['target'])
|
self.assertEqual('board2', board2['target'])
|
||||||
|
|
||||||
def test_output_is_new(self):
|
def test_output_is_new(self):
|
||||||
"""Test detecting new changes to Kconfig"""
|
"""Test detecting new changes to Kconfig"""
|
||||||
@@ -898,7 +898,7 @@ Active aarch64 armv8 - armltd total_compute board2
|
|||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
|
|
||||||
# There should be two boards no warnings
|
# There should be two boards no warnings
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertFalse(warnings)
|
self.assertFalse(warnings)
|
||||||
|
|
||||||
# Set an invalid status line in the file
|
# Set an invalid status line in the file
|
||||||
@@ -907,12 +907,12 @@ Active aarch64 armv8 - armltd total_compute board2
|
|||||||
for line in orig_data.splitlines(keepends=True)]
|
for line in orig_data.splitlines(keepends=True)]
|
||||||
tools.write_file(main, ''.join(lines), binary=False)
|
tools.write_file(main, ''.join(lines), binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
params = params_list[0]
|
params = params_list[0]
|
||||||
if params['target'] == 'board2':
|
if params['target'] == 'board2':
|
||||||
params = params_list[1]
|
params = params_list[1]
|
||||||
self.assertEquals('-', params['status'])
|
self.assertEqual('-', params['status'])
|
||||||
self.assertEquals(["WARNING: Other: unknown status for 'board0'"],
|
self.assertEqual(["WARNING: Other: unknown status for 'board0'"],
|
||||||
warnings)
|
warnings)
|
||||||
|
|
||||||
# Remove the status line (S:) from a file
|
# Remove the status line (S:) from a file
|
||||||
@@ -920,39 +920,39 @@ Active aarch64 armv8 - armltd total_compute board2
|
|||||||
if not line.startswith('S:')]
|
if not line.startswith('S:')]
|
||||||
tools.write_file(main, ''.join(lines), binary=False)
|
tools.write_file(main, ''.join(lines), binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(["WARNING: -: unknown status for 'board0'"], warnings)
|
self.assertEqual(["WARNING: -: unknown status for 'board0'"], warnings)
|
||||||
|
|
||||||
# Remove the configs/ line (F:) from a file - this is the last line
|
# Remove the configs/ line (F:) from a file - this is the last line
|
||||||
data = ''.join(orig_data.splitlines(keepends=True)[:-1])
|
data = ''.join(orig_data.splitlines(keepends=True)[:-1])
|
||||||
tools.write_file(main, data, binary=False)
|
tools.write_file(main, data, binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings)
|
self.assertEqual(["WARNING: no maintainers for 'board0'"], warnings)
|
||||||
|
|
||||||
# Mark a board as orphaned - this should give a warning
|
# Mark a board as orphaned - this should give a warning
|
||||||
lines = ['S: Orphaned' if line.startswith('S') else line
|
lines = ['S: Orphaned' if line.startswith('S') else line
|
||||||
for line in orig_data.splitlines(keepends=True)]
|
for line in orig_data.splitlines(keepends=True)]
|
||||||
tools.write_file(main, ''.join(lines), binary=False)
|
tools.write_file(main, ''.join(lines), binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings)
|
self.assertEqual(["WARNING: no maintainers for 'board0'"], warnings)
|
||||||
|
|
||||||
# Change the maintainer to '-' - this should give a warning
|
# Change the maintainer to '-' - this should give a warning
|
||||||
lines = ['M: -' if line.startswith('M') else line
|
lines = ['M: -' if line.startswith('M') else line
|
||||||
for line in orig_data.splitlines(keepends=True)]
|
for line in orig_data.splitlines(keepends=True)]
|
||||||
tools.write_file(main, ''.join(lines), binary=False)
|
tools.write_file(main, ''.join(lines), binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(["WARNING: -: unknown status for 'board0'"], warnings)
|
self.assertEqual(["WARNING: -: unknown status for 'board0'"], warnings)
|
||||||
|
|
||||||
# Remove the maintainer line (M:) from a file
|
# Remove the maintainer line (M:) from a file
|
||||||
lines = [line for line in orig_data.splitlines(keepends=True)
|
lines = [line for line in orig_data.splitlines(keepends=True)
|
||||||
if not line.startswith('M:')]
|
if not line.startswith('M:')]
|
||||||
tools.write_file(main, ''.join(lines), binary=False)
|
tools.write_file(main, ''.join(lines), binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings)
|
self.assertEqual(["WARNING: no maintainers for 'board0'"], warnings)
|
||||||
|
|
||||||
# Move the contents of the second file into this one, removing the
|
# Move the contents of the second file into this one, removing the
|
||||||
# second file, to check multiple records in a single file.
|
# second file, to check multiple records in a single file.
|
||||||
@@ -960,14 +960,14 @@ Active aarch64 armv8 - armltd total_compute board2
|
|||||||
tools.write_file(main, both_data, binary=False)
|
tools.write_file(main, both_data, binary=False)
|
||||||
os.remove(other)
|
os.remove(other)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertFalse(warnings)
|
self.assertFalse(warnings)
|
||||||
|
|
||||||
# Add another record, this should be ignored with a warning
|
# Add another record, this should be ignored with a warning
|
||||||
extra = '\n\nAnother\nM: Fred\nF: configs/board9_defconfig\nS: other\n'
|
extra = '\n\nAnother\nM: Fred\nF: configs/board9_defconfig\nS: other\n'
|
||||||
tools.write_file(main, both_data + extra, binary=False)
|
tools.write_file(main, both_data + extra, binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertFalse(warnings)
|
self.assertFalse(warnings)
|
||||||
|
|
||||||
# Add another TARGET to the Kconfig
|
# Add another TARGET to the Kconfig
|
||||||
@@ -983,8 +983,8 @@ endif
|
|||||||
tools.write_file(kc_file, orig_kc_data + extra)
|
tools.write_file(kc_file, orig_kc_data + extra)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src,
|
params_list, warnings = self._boards.build_board_list(config_dir, src,
|
||||||
warn_targets=True)
|
warn_targets=True)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
['WARNING: board2_defconfig: Duplicate TARGET_xxx: board2 and other'],
|
['WARNING: board2_defconfig: Duplicate TARGET_xxx: board2 and other'],
|
||||||
warnings)
|
warnings)
|
||||||
|
|
||||||
@@ -994,8 +994,8 @@ endif
|
|||||||
tools.write_file(kc_file, b''.join(lines))
|
tools.write_file(kc_file, b''.join(lines))
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src,
|
params_list, warnings = self._boards.build_board_list(config_dir, src,
|
||||||
warn_targets=True)
|
warn_targets=True)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
['WARNING: board2_defconfig: No TARGET_BOARD2 enabled'],
|
['WARNING: board2_defconfig: No TARGET_BOARD2 enabled'],
|
||||||
warnings)
|
warnings)
|
||||||
tools.write_file(kc_file, orig_kc_data)
|
tools.write_file(kc_file, orig_kc_data)
|
||||||
@@ -1004,7 +1004,7 @@ endif
|
|||||||
data = ''.join(both_data.splitlines(keepends=True)[:-1])
|
data = ''.join(both_data.splitlines(keepends=True)[:-1])
|
||||||
tools.write_file(main, data + 'N: oa.*2\n', binary=False)
|
tools.write_file(main, data + 'N: oa.*2\n', binary=False)
|
||||||
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
params_list, warnings = self._boards.build_board_list(config_dir, src)
|
||||||
self.assertEquals(2, len(params_list))
|
self.assertEqual(2, len(params_list))
|
||||||
self.assertFalse(warnings)
|
self.assertFalse(warnings)
|
||||||
|
|
||||||
def testRegenBoards(self):
|
def testRegenBoards(self):
|
||||||
|
@@ -584,7 +584,7 @@ class TestBuild(unittest.TestCase):
|
|||||||
if use_network:
|
if use_network:
|
||||||
with test_util.capture_sys_output() as (stdout, stderr):
|
with test_util.capture_sys_output() as (stdout, stderr):
|
||||||
url = self.toolchains.LocateArchUrl('arm')
|
url = self.toolchains.LocateArchUrl('arm')
|
||||||
self.assertRegexpMatches(url, 'https://www.kernel.org/pub/tools/'
|
self.assertRegex(url, 'https://www.kernel.org/pub/tools/'
|
||||||
'crosstool/files/bin/x86_64/.*/'
|
'crosstool/files/bin/x86_64/.*/'
|
||||||
'x86_64-gcc-.*-nolibc[-_]arm-.*linux-gnueabi.tar.xz')
|
'x86_64-gcc-.*-nolibc[-_]arm-.*linux-gnueabi.tar.xz')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user