Lines Matching refs:td

66 static void default_result(struct tdescr *td, bool force_exit)  in default_result()  argument
68 if (td->result == KSFT_SKIP) { in default_result()
70 } else if (td->pass) { in default_result()
72 td->result = KSFT_PASS; in default_result()
75 td->result = KSFT_FAIL; in default_result()
79 exit(td->result); in default_result()
90 static bool handle_signal_unsupported(struct tdescr *td, in handle_signal_unsupported() argument
93 if (feats_ok(td)) in handle_signal_unsupported()
99 if (!td->initialized) { in handle_signal_unsupported()
105 td->pass = 1; in handle_signal_unsupported()
112 static bool handle_signal_trigger(struct tdescr *td, in handle_signal_trigger() argument
115 td->triggered = 1; in handle_signal_trigger()
117 td->run(td, si, uc); in handle_signal_trigger()
122 static bool handle_signal_ok(struct tdescr *td, in handle_signal_ok() argument
129 assert(!td->sig_trig || td->triggered); in handle_signal_ok()
133 si->si_addr, si->si_code, td->token, td->token - si->si_addr); in handle_signal_ok()
140 if (!td->sanity_disabled && !td->token) { in handle_signal_ok()
151 if (td->sig_ok == SIGSEGV && si->si_code != SEGV_ACCERR) { in handle_signal_ok()
156 td->pass = 1; in handle_signal_ok()
168 static bool handle_signal_copyctx(struct tdescr *td, in handle_signal_copyctx() argument
186 head = get_header(head, EXTRA_MAGIC, td->live_sz, &offset); in handle_signal_copyctx()
200 copied_extra = (struct extra_context *)&(td->live_uc->uc_mcontext.__reserved[offset]); in handle_signal_copyctx()
206 if (to_copy > td->live_sz) { in handle_signal_copyctx()
209 td->live_sz, to_copy); in handle_signal_copyctx()
213 memcpy(td->live_uc, uc, to_copy); in handle_signal_copyctx()
225 td->live_uc_valid = 1; in handle_signal_copyctx()
259 static int default_setup(struct tdescr *td) in default_setup() argument
265 sa.sa_flags |= td->sa_flags; in default_setup()
279 if (td->sig_trig) in default_setup()
280 unblock_signal(td->sig_trig); in default_setup()
281 if (td->sig_ok) in default_setup()
282 unblock_signal(td->sig_ok); in default_setup()
283 if (td->sig_unsupp) in default_setup()
284 unblock_signal(td->sig_unsupp); in default_setup()
286 if (td->timeout) { in default_setup()
288 alarm(td->timeout); in default_setup()
295 static inline int default_trigger(struct tdescr *td) in default_trigger() argument
297 return !raise(td->sig_trig); in default_trigger()
300 int test_init(struct tdescr *td) in test_init() argument
302 if (td->sig_trig == sig_copyctx) { in test_init()
311 td->minsigstksz = getauxval(AT_MINSIGSTKSZ); in test_init()
312 if (!td->minsigstksz) in test_init()
313 td->minsigstksz = MINSIGSTKSZ; in test_init()
314 fprintf(stderr, "Detected MINSTKSIGSZ:%d\n", td->minsigstksz); in test_init()
316 if (td->feats_required || td->feats_incompatible) { in test_init()
317 td->feats_supported = 0; in test_init()
323 td->feats_supported |= FEAT_SSBS; in test_init()
325 td->feats_supported |= FEAT_SVE; in test_init()
327 td->feats_supported |= FEAT_SME; in test_init()
329 td->feats_supported |= FEAT_SME_FA64; in test_init()
331 td->feats_supported |= FEAT_SME2; in test_init()
332 if (feats_ok(td)) { in test_init()
333 if (td->feats_required & td->feats_supported) in test_init()
336 feats_to_string(td->feats_required & in test_init()
337 td->feats_supported)); in test_init()
338 if (!(td->feats_incompatible & td->feats_supported)) in test_init()
341 feats_to_string(td->feats_incompatible)); in test_init()
343 if ((td->feats_required & td->feats_supported) != in test_init()
344 td->feats_supported) in test_init()
347 feats_to_string(td->feats_required & in test_init()
348 ~td->feats_supported)); in test_init()
349 if (td->feats_incompatible & td->feats_supported) in test_init()
352 feats_to_string(td->feats_incompatible & in test_init()
353 ~td->feats_supported)); in test_init()
356 td->result = KSFT_SKIP; in test_init()
362 if (td->init && !td->init(td)) { in test_init()
366 td->initialized = 1; in test_init()
372 int test_setup(struct tdescr *td) in test_setup() argument
376 assert(td); in test_setup()
377 assert(td->name); in test_setup()
378 assert(td->run); in test_setup()
381 td->result = KSFT_FAIL; in test_setup()
382 if (td->setup) in test_setup()
383 return td->setup(td); in test_setup()
385 return default_setup(td); in test_setup()
388 int test_run(struct tdescr *td) in test_run() argument
390 if (td->trigger) in test_run()
391 return td->trigger(td); in test_run()
392 else if (td->sig_trig) in test_run()
393 return default_trigger(td); in test_run()
395 return td->run(td, NULL, NULL); in test_run()
398 void test_result(struct tdescr *td) in test_result() argument
400 if (td->initialized && td->result != KSFT_SKIP && td->check_result) in test_result()
401 td->check_result(td); in test_result()
402 default_result(td, 0); in test_result()
405 void test_cleanup(struct tdescr *td) in test_cleanup() argument
407 if (td->cleanup) in test_cleanup()
408 td->cleanup(td); in test_cleanup()