From 170732523bad74cd3a19c3993ba06c789c843ccf Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 27 Apr 2021 08:19:48 +1200 Subject: dtoc: Correct dtoc output when testing At present each invocation of run_steps() updates OUTPUT_FILES_COMMON, since it does not make a copy of the dict. This is fine for a single invocation, but for tests, run_steps() is invoked many times. As a result it may include unwanted items from the previous run, if it happens that a test runs twice on the same CPU. The problem has not been noticied previously, as there are few enough tests and enough CPUs that is is rare for the 'wrong' combination of tests to run together. Fix this by making a copy of the dict, before updating it. Update the tests to suit, taking account of the files that are no-longer generated. With this fix, we no-longer generate files which are not needed for a particular state of OF_PLATDATA_INST, so the check_instantiate() function is not needed anymore. It has become dead code and so fails the code-coverage test (dtoc -T). Remove it. Signed-off-by: Simon Glass --- tools/dtoc/dtb_platdata.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'tools/dtoc/dtb_platdata.py') diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 1374f01c70..2d42480a9a 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -824,8 +824,6 @@ class DtbPlatdata(): self.buf('\t},\n') def generate_uclasses(self): - if not self.check_instantiate(True): - return self.out('\n') self.out('#include \n') self.out('#include \n') @@ -1038,22 +1036,6 @@ class DtbPlatdata(): self.out(''.join(self.get_buf())) - def check_instantiate(self, require): - """Check if self._instantiate is set to the required value - - If not, this outputs a message into the current file - - Args: - require: True to require --instantiate, False to require that it not - be enabled - """ - if require != self._instantiate: - self.out( - '/* This file is not used: --instantiate was %senabled */\n' % - ('not ' if require else '')) - return False - return True - def generate_plat(self): """Generate device defintions for the platform data @@ -1064,8 +1046,6 @@ class DtbPlatdata(): See the documentation in doc/driver-model/of-plat.rst for more information. """ - if not self.check_instantiate(False): - return self.out('/* Allow use of U_BOOT_DRVINFO() in this file */\n') self.out('#define DT_PLAT_C\n') self.out('\n') @@ -1102,8 +1082,6 @@ class DtbPlatdata(): See the documentation in doc/driver-model/of-plat.rst for more information. """ - if not self.check_instantiate(True): - return self.out('#include \n') self.out('#include \n') self.out('#include \n') @@ -1216,7 +1194,7 @@ def run_steps(args, dtb_file, include_disabled, output, output_dirs, phase, plat.assign_seqs() # Figure out what output files we plan to generate - output_files = OUTPUT_FILES_COMMON + output_files = dict(OUTPUT_FILES_COMMON) if instantiate: output_files.update(OUTPUT_FILES_INST) else: -- cgit v1.2.3