Lines Matching full:self
34 def __init__(self, testsuite, platform, outdir): argument
36 self.testsuite = testsuite
37 self.platform = platform
39 self.status = None
40 self.reason = "Unknown"
41 self.metrics = dict()
42 self.handler = None
43 self.outdir = outdir
44 self.execution_time = 0
45 self.retries = 0
47 self.name = os.path.join(platform.name, testsuite.name)
48 self.run_id = self._get_run_id()
49 self.build_dir = os.path.join(outdir, platform.name, testsuite.name)
51 self.domains = None
53 self.run = False
54 self.testcases = []
55 self.init_cases()
56 self.filters = []
57 self.filter_type = None
59 def add_filter(self, reason, filter_type): argument
60 self.filters.append({'type': filter_type, 'reason': reason })
61 self.status = "filtered"
62 self.reason = reason
63 self.filter_type = filter_type
66 def init_cases(self): argument
67 for c in self.testsuite.testcases:
68 self.add_testcase(c.name, freeform=c.freeform)
70 def _get_run_id(self): argument
74 hash_object = hashlib.md5(self.name.encode())
79 def add_missing_case_status(self, status, reason=None): argument
80 for case in self.testcases:
88 case.reason = self.reason
90 def __getstate__(self): argument
91 d = self.__dict__.copy()
94 def __setstate__(self, d): argument
95 self.__dict__.update(d)
97 def __lt__(self, other): argument
98 return self.name < other.name
100 def set_case_status_by_name(self, name, status, reason=None): argument
101 tc = self.get_case_or_create(name)
107 def add_testcase(self, name, freeform=False): argument
110 self.testcases.append(tc)
113 def get_case_by_name(self, name): argument
114 for c in self.testcases:
119 def get_case_or_create(self, name): argument
120 for c in self.testcases:
126 self.testcases.append(tc)
143 def setup_handler(self, env): argument
144 if self.handler:
148 handler = Handler(self, "")
150 handler = DeviceHandler(self, "device")
153 elif self.platform.simulation != "na":
154 if self.platform.simulation == "qemu":
155 handler = QEMUHandler(self, "qemu")
159 handler = SimulationHandler(self, self.platform.simulation)
161 if self.platform.simulation_exec and shutil.which(self.platform.simulation_exec):
163 elif self.testsuite.type == "unit":
164 handler = BinaryHandler(self, "unit")
165 handler.binary = os.path.join(self.build_dir, "testbinary")
176 self.handler = handler
179 def check_runnable(self, enable_slow=False, filter='buildable', fixtures=[]): argument
182 if os.name == 'nt' and self.platform.simulation != 'na':
186 if self.testsuite.build_only:
190 skip_slow = self.testsuite.slow and not enable_slow
194 target_ready = bool(self.testsuite.type == "unit" or \
195 self.platform.type == "native" or \
196 self.platform.simulation in SUPPORTED_SIMS or \
200 if self.testsuite.harness == 'pytest':
201 … target_ready = bool(filter == 'runnable' or self.platform.simulation in SUPPORTED_SIMS_IN_PYTEST)
205 self.platform.simulation in SUPPORTED_SIMS_WITH_EXEC and \
206 self.platform.simulation_exec:
207 if not shutil.which(self.platform.simulation_exec):
210 testsuite_runnable = self.testsuite_runnable(self.testsuite, fixtures)
214 …def create_overlay(self, platform, enable_asan=False, enable_ubsan=False, enable_coverage=False, c… argument
219 subdir = os.path.join(self.build_dir, "twister")
223 if self.testsuite.extra_configs:
228 for config in self.testsuite.extra_configs:
231 if self.platform.arch == cond_config[1]:
234 if self.platform.name == cond_config[1]:
262 …def calculate_sizes(self, from_buildlog: bool = False, generate_warning: bool = True) -> SizeCalcu… argument
270 elf_filepath = self.get_elf_file()
271 buildlog_filepath = self.get_buildlog_file() if from_buildlog else ''
273 extra_sections=self.testsuite.extra_sections,
277 def get_elf_file(self) -> str: argument
279 if self.testsuite.sysbuild:
280 build_dir = self.domains.get_default_domain().build_dir
282 build_dir = self.build_dir
292 if len(fns) != 1 and self.platform.type != 'native':
296 def get_buildlog_file(self) -> str: argument
302 buildlog_paths = glob.glob(os.path.join(self.build_dir, "build.log"))
307 def __repr__(self): argument
308 return "<TestSuite %s on %s>" % (self.testsuite.name, self.platform.name)