about summary refs log tree commit diff
path: root/tests/ui/contracts/contract-attributes-tail.rs
diff options
context:
space:
mode:
authorMartin Nordholts <martin.nordholts@codetale.se>2025-06-25 07:56:40 +0200
committerMartin Nordholts <martin.nordholts@codetale.se>2025-07-19 18:44:07 +0200
commite1d4f2a0c297690ddfc24815de57539f532f2471 (patch)
treec23e3a6626052452890dc7d218df2fd0b1744dc7 /tests/ui/contracts/contract-attributes-tail.rs
parent12865ffd0dfb4ea969e2f16eb0140238bb9dd382 (diff)
downloadrust-e1d4f2a0c297690ddfc24815de57539f532f2471.tar.gz
rust-e1d4f2a0c297690ddfc24815de57539f532f2471.zip
tests: Require `run-fail` ui tests to have an exit code (`SIGABRT` not ok)
And introduce two new directives for ui tests:
* `run-crash`
* `run-fail-or-crash`

Normally a `run-fail` ui test like tests that panic shall not be
terminated by a signal like `SIGABRT`. So begin having that as a hard
requirement.

Some of our current tests do terminate by a signal/crash however.
Introduce and use `run-crash` for those tests. Note that Windows crashes
are not handled by signals but by certain high bits set on the process
exit code. Example exit code for crash on Windows: `0xc000001d`.
Because of this, we define "crash" on all platforms as "not exit with
success and not exit with a regular failure code in the range 1..=127".

Some tests behave differently on different targets:
* Targets without unwind support will abort (crash) instead of exit with
  failure code 101 after panicking. As a special case, allow crashes for
  `run-fail` tests for such targets.
* Different sanitizer implementations handle detected memory problems
  differently. Some abort (crash) the process while others exit with
  failure code 1. Introduce and use `run-fail-or-crash` for such tests.
Diffstat (limited to 'tests/ui/contracts/contract-attributes-tail.rs')
-rw-r--r--tests/ui/contracts/contract-attributes-tail.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/ui/contracts/contract-attributes-tail.rs b/tests/ui/contracts/contract-attributes-tail.rs
index ce4a6be5b82..43edfe5e803 100644
--- a/tests/ui/contracts/contract-attributes-tail.rs
+++ b/tests/ui/contracts/contract-attributes-tail.rs
@@ -5,8 +5,8 @@
 //@ [unchk_fail_post] run-pass
 //@ [chk_pass] run-pass
 //
-//@ [chk_fail_pre] run-fail
-//@ [chk_fail_post] run-fail
+//@ [chk_fail_pre] run-crash
+//@ [chk_fail_post] run-crash
 //
 //@ [unchk_pass] compile-flags: -Zcontract-checks=no
 //@ [unchk_fail_pre] compile-flags: -Zcontract-checks=no