ent = entry.Entry.Create(None, self.GetNode(), 'missing',
missing_etype=True)
self.assertTrue(isinstance(ent, Entry_blob))
- self.assertEquals('missing', ent.etype)
+ self.assertEqual('missing', ent.etype)
def testDecompressData(self):
"""Test the DecompressData() method of the base class"""
base.compress = 'lz4'
bintools = {}
base.comp_bintool = base.AddBintool(bintools, '_testing')
- self.assertEquals(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.CompressData(b'abc'))
+ self.assertEqual(tools.get_bytes(0, 1024), base.DecompressData(b'abc'))
def testLookupOffset(self):
"""Test the lookup_offset() method of the base class"""
fname = self.GetCompiled('045_prop_test.dts')
dt = FdtScan(fname)
node = dt.GetNode('/binman/intel-me')
- self.assertEquals('intel-me', node.name)
+ self.assertEqual('intel-me', node.name)
val = fdt_util.GetString(node, 'filename')
- self.assertEquals(str, type(val))
- self.assertEquals('me.bin', val)
+ self.assertEqual(str, type(val))
+ self.assertEqual('me.bin', val)
prop = node.props['intval']
- self.assertEquals(fdt.Type.INT, prop.type)
- self.assertEquals(3, fdt_util.GetInt(node, 'intval'))
+ self.assertEqual(fdt.Type.INT, prop.type)
+ self.assertEqual(3, fdt_util.GetInt(node, 'intval'))
prop = node.props['intarray']
- self.assertEquals(fdt.Type.INT, prop.type)
- self.assertEquals(list, type(prop.value))
- self.assertEquals(2, len(prop.value))
- self.assertEquals([5, 6],
+ self.assertEqual(fdt.Type.INT, prop.type)
+ self.assertEqual(list, type(prop.value))
+ self.assertEqual(2, len(prop.value))
+ self.assertEqual([5, 6],
[fdt_util.fdt32_to_cpu(val) for val in prop.value])
prop = node.props['byteval']
- self.assertEquals(fdt.Type.BYTE, prop.type)
- self.assertEquals(chr(8), prop.value)
+ self.assertEqual(fdt.Type.BYTE, prop.type)
+ self.assertEqual(chr(8), prop.value)
prop = node.props['bytearray']
- self.assertEquals(fdt.Type.BYTE, prop.type)
- self.assertEquals(list, type(prop.value))
- self.assertEquals(str, type(prop.value[0]))
- self.assertEquals(3, len(prop.value))
- self.assertEquals([chr(1), '#', '4'], prop.value)
+ self.assertEqual(fdt.Type.BYTE, prop.type)
+ self.assertEqual(list, type(prop.value))
+ self.assertEqual(str, type(prop.value[0]))
+ self.assertEqual(3, len(prop.value))
+ self.assertEqual([chr(1), '#', '4'], prop.value)
prop = node.props['longbytearray']
- self.assertEquals(fdt.Type.INT, prop.type)
- self.assertEquals(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
+ self.assertEqual(fdt.Type.INT, prop.type)
+ self.assertEqual(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
prop = node.props['stringval']
- self.assertEquals(fdt.Type.STRING, prop.type)
- self.assertEquals('message2', fdt_util.GetString(node, 'stringval'))
+ self.assertEqual(fdt.Type.STRING, prop.type)
+ self.assertEqual('message2', fdt_util.GetString(node, 'stringval'))
prop = node.props['stringarray']
- self.assertEquals(fdt.Type.STRING, prop.type)
- self.assertEquals(list, type(prop.value))
- self.assertEquals(3, len(prop.value))
- self.assertEquals(['another', 'multi-word', 'message'], prop.value)
+ self.assertEqual(fdt.Type.STRING, prop.type)
+ self.assertEqual(list, type(prop.value))
+ self.assertEqual(3, len(prop.value))
+ self.assertEqual(['another', 'multi-word', 'message'], prop.value)
dtb.Scan()
props = self._GetPropTree(dtb, ['size', 'uncomp-size'])
orig = self._decompress(data)
- self.assertEquals(COMPRESS_DATA, orig)
+ self.assertEqual(COMPRESS_DATA, orig)
# Do a sanity check on various fields
image = control.images['image']
orig_entry = orig_image.GetEntries()['fdtmap']
entry = image.GetEntries()['fdtmap']
- self.assertEquals(orig_entry.offset, entry.offset)
- self.assertEquals(orig_entry.size, entry.size)
- self.assertEquals(orig_entry.image_pos, entry.image_pos)
+ self.assertEqual(orig_entry.offset, entry.offset)
+ self.assertEqual(orig_entry.size, entry.size)
+ self.assertEqual(orig_entry.image_pos, entry.image_pos)
def testReadImageNoHeader(self):
"""Test accessing an image's FDT map without an image header"""
mat = re_line.match(line)
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('Image 0 (kernel)', vals)
self.assertIn('Hash value', vals)
fit_pos,
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
self.assertEqual(U_BOOT_DATA + b'aa',
data[actual_pos:actual_pos + external_data_size])
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
'uncomp-size'])
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
image = control.images['image']
'uncomp-size'])
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
image = control.images['image']
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
'uncomp-size'])
orig = self._decompress(data)
- self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
+ self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
expected = {
'section/blob:offset': 0,
'section/blob:size': len(COMPRESS_DATA),
props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
'uncomp-size'])
orig = self._decompress(data)
- self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
+ self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
expected = {
'section/blob:offset': 0,
'section/blob:size': len(COMPRESS_DATA),
'uncomp-size'])
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):]
# Check compressed data
expect1 = bintool.compress(COMPRESS_DATA + U_BOOT_DATA)
data1 = rest[:len(expect1)]
section1 = self._decompress(data1)
- self.assertEquals(expect1, data1)
- self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, section1)
+ self.assertEqual(expect1, data1)
+ self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, section1)
rest1 = rest[len(expect1):]
expect2 = bintool.compress(COMPRESS_DATA + COMPRESS_DATA)
data2 = rest1[:len(expect2)]
section2 = self._decompress(data2)
- self.assertEquals(expect2, data2)
- self.assertEquals(COMPRESS_DATA + COMPRESS_DATA, section2)
+ self.assertEqual(expect2, data2)
+ self.assertEqual(COMPRESS_DATA + COMPRESS_DATA, section2)
rest2 = rest1[len(expect2):]
expect_size = (len(U_BOOT_DATA) + len(U_BOOT_DATA) + len(expect1) +
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
expected = {
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):
"""Test that an image with tpl/u-boot-tpl-nodtb.bin can be created"""
segments, entry = elf.read_loadable_segments(elf_data)
# We assume there are two segments
- self.assertEquals(2, len(segments))
+ self.assertEqual(2, len(segments))
atf1 = dtb.GetNode('/images/atf-1')
_, start, data = segments[0]
data = bintool.compress(COMPRESS_DATA)
self.assertNotEqual(COMPRESS_DATA, data)
orig = bintool.decompress(data)
- self.assertEquals(COMPRESS_DATA, orig)
+ self.assertEqual(COMPRESS_DATA, orig)
def testCompUtilVersions(self):
"""Test tool version of compression algorithms"""
self.assertNotEqual(COMPRESS_DATA, data)
data += tools.get_bytes(0, 64)
orig = bintool.decompress(data)
- self.assertEquals(COMPRESS_DATA, orig)
+ self.assertEqual(COMPRESS_DATA, orig)
def testCompressDtbZstd(self):
"""Test that zstd compress of device-tree files failed"""
params, warnings = self._boards.scan_defconfigs(src, src)
# We should get two boards
- self.assertEquals(2, len(params))
+ self.assertEqual(2, len(params))
self.assertFalse(warnings)
first = 0 if params[0]['target'] == 'board0' else 1
board0 = params[first]
board2 = params[1 - first]
- self.assertEquals('arm', board0['arch'])
- self.assertEquals('armv7', board0['cpu'])
- self.assertEquals('-', board0['soc'])
- self.assertEquals('Tester', board0['vendor'])
- self.assertEquals('ARM Board 0', board0['board'])
- self.assertEquals('config0', board0['config'])
- self.assertEquals('board0', board0['target'])
-
- self.assertEquals('powerpc', board2['arch'])
- self.assertEquals('ppc', board2['cpu'])
- self.assertEquals('mpc85xx', board2['soc'])
- self.assertEquals('Tester', board2['vendor'])
- self.assertEquals('PowerPC board 1', board2['board'])
- self.assertEquals('config2', board2['config'])
- self.assertEquals('board2', board2['target'])
+ self.assertEqual('arm', board0['arch'])
+ self.assertEqual('armv7', board0['cpu'])
+ self.assertEqual('-', board0['soc'])
+ self.assertEqual('Tester', board0['vendor'])
+ self.assertEqual('ARM Board 0', board0['board'])
+ self.assertEqual('config0', board0['config'])
+ self.assertEqual('board0', board0['target'])
+
+ self.assertEqual('powerpc', board2['arch'])
+ self.assertEqual('ppc', board2['cpu'])
+ self.assertEqual('mpc85xx', board2['soc'])
+ self.assertEqual('Tester', board2['vendor'])
+ self.assertEqual('PowerPC board 1', board2['board'])
+ self.assertEqual('config2', board2['config'])
+ self.assertEqual('board2', board2['target'])
def test_output_is_new(self):
"""Test detecting new changes to Kconfig"""
params_list, warnings = self._boards.build_board_list(config_dir, src)
# There should be two boards no warnings
- self.assertEquals(2, len(params_list))
+ self.assertEqual(2, len(params_list))
self.assertFalse(warnings)
# Set an invalid status line in the file
for line in orig_data.splitlines(keepends=True)]
tools.write_file(main, ''.join(lines), binary=False)
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]
if params['target'] == 'board2':
params = params_list[1]
- self.assertEquals('-', params['status'])
- self.assertEquals(["WARNING: Other: unknown status for 'board0'"],
+ self.assertEqual('-', params['status'])
+ self.assertEqual(["WARNING: Other: unknown status for 'board0'"],
warnings)
# Remove the status line (S:) from a file
if not line.startswith('S:')]
tools.write_file(main, ''.join(lines), binary=False)
params_list, warnings = self._boards.build_board_list(config_dir, src)
- self.assertEquals(2, len(params_list))
- self.assertEquals(["WARNING: -: unknown status for 'board0'"], warnings)
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(["WARNING: -: unknown status for 'board0'"], warnings)
# Remove the configs/ line (F:) from a file - this is the last line
data = ''.join(orig_data.splitlines(keepends=True)[:-1])
tools.write_file(main, data, binary=False)
params_list, warnings = self._boards.build_board_list(config_dir, src)
- self.assertEquals(2, len(params_list))
- self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings)
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(["WARNING: no maintainers for 'board0'"], warnings)
# Mark a board as orphaned - this should give a warning
lines = ['S: Orphaned' if line.startswith('S') else line
for line in orig_data.splitlines(keepends=True)]
tools.write_file(main, ''.join(lines), binary=False)
params_list, warnings = self._boards.build_board_list(config_dir, src)
- self.assertEquals(2, len(params_list))
- self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings)
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(["WARNING: no maintainers for 'board0'"], warnings)
# Change the maintainer to '-' - this should give a warning
lines = ['M: -' if line.startswith('M') else line
for line in orig_data.splitlines(keepends=True)]
tools.write_file(main, ''.join(lines), binary=False)
params_list, warnings = self._boards.build_board_list(config_dir, src)
- self.assertEquals(2, len(params_list))
- self.assertEquals(["WARNING: -: unknown status for 'board0'"], warnings)
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(["WARNING: -: unknown status for 'board0'"], warnings)
# Remove the maintainer line (M:) from a file
lines = [line for line in orig_data.splitlines(keepends=True)
if not line.startswith('M:')]
tools.write_file(main, ''.join(lines), binary=False)
params_list, warnings = self._boards.build_board_list(config_dir, src)
- self.assertEquals(2, len(params_list))
- self.assertEquals(["WARNING: no maintainers for 'board0'"], warnings)
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(["WARNING: no maintainers for 'board0'"], warnings)
# Move the contents of the second file into this one, removing the
# second file, to check multiple records in a single file.
tools.write_file(main, both_data, binary=False)
os.remove(other)
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)
# Add another record, this should be ignored with a warning
extra = '\n\nAnother\nM: Fred\nF: configs/board9_defconfig\nS: other\n'
tools.write_file(main, both_data + extra, binary=False)
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)
# Add another TARGET to the Kconfig
tools.write_file(kc_file, orig_kc_data + extra)
params_list, warnings = self._boards.build_board_list(config_dir, src,
warn_targets=True)
- self.assertEquals(2, len(params_list))
- self.assertEquals(
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(
['WARNING: board2_defconfig: Duplicate TARGET_xxx: board2 and other'],
warnings)
tools.write_file(kc_file, b''.join(lines))
params_list, warnings = self._boards.build_board_list(config_dir, src,
warn_targets=True)
- self.assertEquals(2, len(params_list))
- self.assertEquals(
+ self.assertEqual(2, len(params_list))
+ self.assertEqual(
['WARNING: board2_defconfig: No TARGET_BOARD2 enabled'],
warnings)
tools.write_file(kc_file, orig_kc_data)
data = ''.join(both_data.splitlines(keepends=True)[:-1])
tools.write_file(main, data + 'N: oa.*2\n', binary=False)
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)
def testRegenBoards(self):
if use_network:
with test_util.capture_sys_output() as (stdout, stderr):
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/.*/'
'x86_64-gcc-.*-nolibc[-_]arm-.*linux-gnueabi.tar.xz')