diff options
Diffstat (limited to 'tools/dtoc/test_dtoc.py')
-rwxr-xr-x | tools/dtoc/test_dtoc.py | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index ee17b8daf9..ea88954923 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -112,12 +112,12 @@ class TestDtoc(unittest.TestCase): """Tests for dtoc""" @classmethod def setUpClass(cls): - tools.PrepareOutputDir(None) + tools.prepare_output_dir(None) cls.maxDiff = None @classmethod def tearDownClass(cls): - tools.FinaliseOutputDir() + tools.finalise_output_dir() @staticmethod def _write_python_string(fname, data): @@ -218,7 +218,7 @@ class TestDtoc(unittest.TestCase): def test_empty_file(self): """Test output from a device tree file with no nodes""" dtb_file = get_dtb_file('dtoc_test_empty.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') # Run this one without saved_scan to complete test coverage dtb_platdata.run_steps(['struct'], dtb_file, False, output, [], None, @@ -801,7 +801,7 @@ DM_DEVICE_INST(test0) = { def test_simple(self): """Test output from some simple nodes with various types of data""" dtb_file = get_dtb_file('dtoc_test_simple.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -822,14 +822,14 @@ DM_DEVICE_INST(test0) = { # Try the 'all' command self.run_test(['all'], dtb_file, output) - data = tools.ReadFile(output, binary=False) + data = tools.read_file(output, binary=False) self._check_strings( self.decl_text + self.platdata_text + self.struct_text, data) def test_driver_alias(self): """Test output from a device tree file with a driver alias""" dtb_file = get_dtb_file('dtoc_test_driver_alias.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -875,7 +875,7 @@ U_BOOT_DRVINFO(gpios_at_0) = { def test_invalid_driver(self): """Test output from a device tree file with an invalid driver""" dtb_file = get_dtb_file('dtoc_test_invalid_driver.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with test_util.capture_sys_output() as _: dtb_platdata.run_steps( ['struct'], dtb_file, False, output, [], None, False, @@ -918,7 +918,7 @@ U_BOOT_DRVINFO(spl_test) = { def test_phandle(self): """Test output from a node containing a phandle reference""" dtb_file = get_dtb_file('dtoc_test_phandle.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1013,7 +1013,7 @@ U_BOOT_DRVINFO(phandle_target) = { def test_phandle_single(self): """Test output from a node containing a phandle reference""" dtb_file = get_dtb_file('dtoc_test_phandle_single.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1029,7 +1029,7 @@ struct dtd_target { def test_phandle_reorder(self): """Test that phandle targets are generated before their references""" dtb_file = get_dtb_file('dtoc_test_phandle_reorder.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['platdata'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1071,7 +1071,7 @@ U_BOOT_DRVINFO(phandle_target) = { def test_phandle_cd_gpio(self): """Test that phandle targets are generated when unsing cd-gpios""" dtb_file = get_dtb_file('dtoc_test_phandle_cd_gpios.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') dtb_platdata.run_steps( ['platdata'], dtb_file, False, output, [], None, False, warning_disabled=True, scan=copy_scan()) @@ -1157,7 +1157,7 @@ U_BOOT_DRVINFO(phandle_target) = { """Test a node containing an invalid phandle fails""" dtb_file = get_dtb_file('dtoc_test_phandle_bad.dts', capture_stderr=True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['struct'], dtb_file, output) self.assertIn("Cannot parse 'clocks' in node 'phandle-source'", @@ -1167,7 +1167,7 @@ U_BOOT_DRVINFO(phandle_target) = { """Test a phandle target missing its #*-cells property""" dtb_file = get_dtb_file('dtoc_test_phandle_bad2.dts', capture_stderr=True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['struct'], dtb_file, output) self.assertIn("Node 'phandle-target' has no cells property", @@ -1176,7 +1176,7 @@ U_BOOT_DRVINFO(phandle_target) = { def test_addresses64(self): """Test output from a node with a 'reg' property with na=2, ns=2""" dtb_file = get_dtb_file('dtoc_test_addr64.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1245,7 +1245,7 @@ U_BOOT_DRVINFO(test3) = { def test_addresses32(self): """Test output from a node with a 'reg' property with na=1, ns=1""" dtb_file = get_dtb_file('dtoc_test_addr32.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1299,7 +1299,7 @@ U_BOOT_DRVINFO(test2) = { def test_addresses64_32(self): """Test output from a node with a 'reg' property with na=2, ns=1""" dtb_file = get_dtb_file('dtoc_test_addr64_32.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1368,7 +1368,7 @@ U_BOOT_DRVINFO(test3) = { def test_addresses32_64(self): """Test output from a node with a 'reg' property with na=1, ns=2""" dtb_file = get_dtb_file('dtoc_test_addr32_64.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1438,7 +1438,7 @@ U_BOOT_DRVINFO(test3) = { """Test that a reg property with an invalid type generates an error""" # Capture stderr since dtc will emit warnings for this file dtb_file = get_dtb_file('dtoc_test_bad_reg.dts', capture_stderr=True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['struct'], dtb_file, output) self.assertIn("Node 'spl-test' reg property is not an int", @@ -1448,7 +1448,7 @@ U_BOOT_DRVINFO(test3) = { """Test that a reg property with an invalid cell count is detected""" # Capture stderr since dtc will emit warnings for this file dtb_file = get_dtb_file('dtoc_test_bad_reg2.dts', capture_stderr=True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['struct'], dtb_file, output) self.assertIn( @@ -1458,7 +1458,7 @@ U_BOOT_DRVINFO(test3) = { def test_add_prop(self): """Test that a subequent node can add a new property to a struct""" dtb_file = get_dtb_file('dtoc_test_add_prop.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) with open(output) as infile: data = infile.read() @@ -1523,9 +1523,9 @@ U_BOOT_DRVINFO(spl_test2) = { def test_multi_to_file(self): """Test output of multiple pieces to a single file""" dtb_file = get_dtb_file('dtoc_test_simple.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['all'], dtb_file, output) - data = tools.ReadFile(output, binary=False) + data = tools.read_file(output, binary=False) self._check_strings( self.decl_text + self.platdata_text + self.struct_text, data) @@ -1539,7 +1539,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_bad_command(self): """Test running dtoc with an invalid command""" dtb_file = get_dtb_file('dtoc_test_simple.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['invalid-cmd'], dtb_file, output) self.assertIn( @@ -1557,12 +1557,12 @@ U_BOOT_DRVINFO(spl_test2) = { def check_output_dirs(self, instantiate): # Remove the directory so that files from other tests are not there - tools._RemoveOutputDir() - tools.PrepareOutputDir(None) + tools._remove_output_dir() + tools.prepare_output_dir(None) # This should create the .dts and .dtb in the output directory dtb_file = get_dtb_file('dtoc_test_simple.dts') - outdir = tools.GetOutputDir() + outdir = tools.get_output_dir() fnames = glob.glob(outdir + '/*') self.assertEqual(2, len(fnames)) @@ -1606,7 +1606,7 @@ U_BOOT_DRVINFO(spl_test2) = { Scanner: scanner to use """ dtb_file = get_dtb_file('dtoc_test_simple.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') # Take a copy before messing with it scan = copy_scan() @@ -1694,7 +1694,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_alias_read(self): """Test obtaining aliases""" dtb_file = get_dtb_file('dtoc_test_inst.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') plat = self.run_test(['struct'], dtb_file, output) scan = plat._scan @@ -1716,7 +1716,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_alias_read_bad(self): """Test invalid alias property name""" dtb_file = get_dtb_file('dtoc_test_alias_bad.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: plat = self.run_test(['struct'], dtb_file, output) self.assertIn("Cannot decode alias 'i2c4-'", str(exc.exception)) @@ -1728,7 +1728,7 @@ U_BOOT_DRVINFO(spl_test2) = { # node (/does/not/exist) dtb_file = get_dtb_file('dtoc_test_alias_bad_path.dts', True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: plat = self.run_test(['struct'], dtb_file, output) self.assertIn("Alias 'i2c4' path '/does/not/exist' not found", @@ -1737,7 +1737,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_alias_read_bad_uclass(self): """Test alias for a uclass that doesn't exist""" dtb_file = get_dtb_file('dtoc_test_alias_bad_uc.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with test_util.capture_sys_output() as (stdout, _): plat = self.run_test(['struct'], dtb_file, output) self.assertEqual("Could not find uclass for alias 'other1'", @@ -1746,7 +1746,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_sequence(self): """Test assignment of sequence numnbers""" dtb_file = get_dtb_file('dtoc_test_inst.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') plat = self.run_test(['struct'], dtb_file, output) scan = plat._scan @@ -1762,7 +1762,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_process_root(self): """Test assignment of sequence numnbers""" dtb_file = get_dtb_file('dtoc_test_simple.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') # Take a copy before messing with it scan = copy_scan() @@ -1781,7 +1781,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_simple_inst(self): """Test output from some simple nodes with instantiate enabled""" dtb_file = get_dtb_file('dtoc_test_inst.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['decl'], dtb_file, output, True) with open(output) as infile: @@ -1804,7 +1804,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_inst_no_hdr(self): """Test dealing with a struct tsssshat has no header""" dtb_file = get_dtb_file('dtoc_test_inst.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') # Run it once to set everything up plat = self.run_test(['decl'], dtb_file, output, True) @@ -1824,7 +1824,7 @@ U_BOOT_DRVINFO(spl_test2) = { def test_missing_props(self): """Test detection of a parent node with no properties""" dtb_file = get_dtb_file('dtoc_test_noprops.dts', capture_stderr=True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['struct'], dtb_file, output) self.assertIn("Parent node '/i2c@0' has no properties - do you need", @@ -1833,13 +1833,13 @@ U_BOOT_DRVINFO(spl_test2) = { def test_single_reg(self): """Test detection of a parent node with no properties""" dtb_file = get_dtb_file('dtoc_test_single_reg.dts') - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') self.run_test(['struct'], dtb_file, output) def test_missing_parent(self): """Test detection of a parent node with no properties""" dtb_file = get_dtb_file('dtoc_test_noparent.dts', capture_stderr=True) - output = tools.GetOutputFilename('output') + output = tools.get_output_filename('output') with self.assertRaises(ValueError) as exc: self.run_test(['device'], dtb_file, output, instantiate=True) self.assertIn("Node '/i2c@0/spl-test/pmic@9' requires parent node " |