Lines Matching full:self

44     def __init__(self, testsuite, platform, outdir):  argument
46 self.testsuite: TestSuite = testsuite
47 self.platform: Platform = platform
49 self.status = None
50 self.reason = "Unknown"
51 self.metrics = dict()
52 self.handler = None
53 self.recording = None
54 self.outdir = outdir
55 self.execution_time = 0
56 self.build_time = 0
57 self.retries = 0
59 self.name = os.path.join(platform.name, testsuite.name)
60 self.dut = None
63 self.build_dir = os.path.join(outdir, platform.normalized_name, testsuite.name)
67self.build_dir = os.path.join(outdir, platform.normalized_name, source_dir_rel, testsuite.name)
68 self.run_id = self._get_run_id()
69 self.domains = None
71 self.sysbuild = testsuite.sysbuild or platform.sysbuild
73 self.run = False
74 self.testcases: list[TestCase] = []
75 self.init_cases()
76 self.filters = []
77 self.filter_type = None
79 def record(self, recording, fname_csv="recording.csv"): argument
81 if self.recording is None:
82 self.recording = recording.copy()
84 self.recording.extend(recording)
86 filename = os.path.join(self.build_dir, fname_csv)
89 fieldnames = self.recording[0].keys(),
93 cw.writerows(self.recording)
95 def add_filter(self, reason, filter_type): argument
96 self.filters.append({'type': filter_type, 'reason': reason })
97 self.status = "filtered"
98 self.reason = reason
99 self.filter_type = filter_type
102 def init_cases(self): argument
103 for c in self.testsuite.testcases:
104 self.add_testcase(c.name, freeform=c.freeform)
106 def _get_run_id(self): argument
111 run_id_file = os.path.join(self.build_dir, "run_id.txt")
116 hash_object = hashlib.md5(self.name.encode())
120 os.makedirs(self.build_dir, exist_ok=True)
125 def add_missing_case_status(self, status, reason=None): argument
126 for case in self.testcases:
134 case.reason = self.reason
136 def __getstate__(self): argument
137 d = self.__dict__.copy()
140 def __setstate__(self, d): argument
141 self.__dict__.update(d)
143 def __lt__(self, other): argument
144 return self.name < other.name
146 def set_case_status_by_name(self, name, status, reason=None): argument
147 tc = self.get_case_or_create(name)
153 def add_testcase(self, name, freeform=False): argument
156 self.testcases.append(tc)
159 def get_case_by_name(self, name): argument
160 for c in self.testcases:
165 def get_case_or_create(self, name): argument
166 for c in self.testcases:
172 self.testcases.append(tc)
189 def setup_handler(self, env): argument
190 if self.handler:
194 handler = Handler(self, "")
196 handler = DeviceHandler(self, "device")
199 elif self.platform.simulation != "na":
200 if self.platform.simulation == "qemu":
202 handler = QEMUHandler(self, "qemu")
204 handler = QEMUWinHandler(self, "qemu")
208 handler = SimulationHandler(self, self.platform.simulation)
210 if self.platform.simulation_exec and shutil.which(self.platform.simulation_exec):
212 elif self.testsuite.type == "unit":
213 handler = BinaryHandler(self, "unit")
214 handler.binary = os.path.join(self.build_dir, "testbinary")
224 self.handler = handler
227 def check_runnable(self, enable_slow=False, filter='buildable', fixtures=[], hardware_map=None): argument
231 if self.platform.simulation not in ('na', 'qemu'):
235 if self.platform.simulation == 'qemu' and 'QEMU_BIN_PATH' not in os.environ:
239 if self.testsuite.build_only:
243 skip_slow = self.testsuite.slow and not enable_slow
247 target_ready = bool(self.testsuite.type == "unit" or \
248 self.platform.type == "native" or \
249 (self.platform.simulation in SUPPORTED_SIMS and \
250 self.platform.simulation not in self.testsuite.simulation_exclude) or \
254 if self.testsuite.harness == 'pytest':
255 … target_ready = bool(filter == 'runnable' or self.platform.simulation in SUPPORTED_SIMS_IN_PYTEST)
259 self.platform.simulation in SUPPORTED_SIMS_WITH_EXEC and \
260 self.platform.simulation_exec:
261 if not shutil.which(self.platform.simulation_exec):
264 testsuite_runnable = self.testsuite_runnable(self.testsuite, fixtures)
268 if (h.platform == self.platform.name and
269 self.testsuite_runnable(self.testsuite, h.fixtures)):
275 …def create_overlay(self, platform, enable_asan=False, enable_ubsan=False, enable_coverage=False, c… argument
280 subdir = os.path.join(self.build_dir, "twister")
284 if self.testsuite.extra_configs:
289 for config in self.testsuite.extra_configs:
292 if self.platform.arch == cond_config[1]:
295 if self.platform.name == cond_config[1]:
323 …def calculate_sizes(self, from_buildlog: bool = False, generate_warning: bool = True) -> SizeCalcu… argument
331 elf_filepath = self.get_elf_file()
332 buildlog_filepath = self.get_buildlog_file() if from_buildlog else ''
334 extra_sections=self.testsuite.extra_sections,
338 def get_elf_file(self) -> str: argument
340 if self.sysbuild:
341 build_dir = self.domains.get_default_domain().build_dir
343 build_dir = self.build_dir
359 def get_buildlog_file(self) -> str: argument
365 buildlog_paths = glob.glob(os.path.join(self.build_dir, "build.log"))
370 def __repr__(self): argument
371 return "<TestSuite %s on %s>" % (self.testsuite.name, self.platform.name)