Commit Graph

27 Commits

Author SHA1 Message Date
Ralf Jung
0727b6ad0d panic-in-panic-hook: formatting a message that's just a string is risk-free 2024-03-24 10:29:44 +01:00
Ralf Jung
fc257fae3c add panic location to 'panicked while processing panic' 2024-03-23 09:44:04 +01:00
bors
dc2ffa4054 Auto merge of #122036 - alexcrichton:test-wasm-with-wasi, r=oli-obk
Test wasm32-wasip1 in CI, not wasm32-unknown-unknown

This commit changes CI to no longer test the `wasm32-unknown-unknown` target and instead test the `wasm32-wasip1` target. There was some discussion of this in a [Zulip thread], and the motivations for this PR are:

* Runtime failures on `wasm32-unknown-unknown` print nothing, meaning all you get is "something failed". In contrast `wasm32-wasip1` can print to stdout/stderr.

* The unknown-unknown target is missing lots of pieces of libstd, and while `wasm32-wasip1` is also missing some pieces (e.g. threads) it's missing fewer pieces. This means that many more tests can be run.

Overall my hope is to improve the debuggability of wasm failures on CI and ideally be a bit less of a maintenance burden.

This commit specifically removes the testing of `wasm32-unknown-unknown` and replaces it with testing of `wasm32-wasip1`. Along the way there were a number of other archiectural changes made as well, including:

* A new `target.*.runtool` option can now be specified in `config.toml` which is passed as `--runtool` to `compiletest`. This is used to reimplement execution of WebAssembly in a less-wasm-specific fashion.

* The default value for `runtool` is an ambiently located WebAssembly runtime found on the system, if any. I've implemented logic for Wasmtime.

* Existing testing support for `wasm32-unknown-unknown` and Emscripten has been removed. I'm not aware of Emscripten testing being run any time recently and otherwise `wasm32-wasip1` is in theory the focus now.

* I've added a new `//@ needs-threads` directive for `compiletest` and classified a bunch of wasm-ignored tests as needing threads. In theory these tests can run on `wasm32-wasi-preview1-threads`, for example.

* I've tried to audit all existing tests that are either `ignore-emscripten` or `ignore-wasm*`. Many now run on `wasm32-wasip1` due to being able to emit error messages, for example. Many are updated with comments as to why they can't run as well.

* The `compiletest` output matching for `wasm32-wasip1` automatically uses "match a subset" mode implemented in `compiletest`. This is because WebAssembly runtimes often add extra information on failure, such as the `unreachable` instruction in `panic!`, which isn't able to be matched against the golden output from native platforms.

* I've ported most existing `run-make` tests that use custom Node.js wrapper scripts to the new run-make-based-in-Rust infrastructure. To do this I added `wasmparser` as a dependency of `run-make-support` for the various wasm tests to use that parse wasm files. The one test that executed WebAssembly now uses `wasmtime`-the-CLI to execute the test instead. I have not ported over an exception-handling test as Wasmtime doesn't implement this yet.

* I've updated the `test` crate to print out timing information for WASI targets as it can do that (gets a previously ignored test now passing).

* The `test-various` image now builds a WASI sysroot for the WASI target and additionally downloads a fixed release of Wasmtime, currently the latest one at 18.0.2, and uses that for testing.

[Zulip thread]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Have.20wasm.20tests.20ever.20caused.20problems.20on.20CI.3F/near/424317944
2024-03-12 00:03:54 +00:00
Alex Crichton
cf6d6050f7 Update test directives for wasm32-wasip1
* The WASI targets deal with the `main` symbol a bit differently than
  native so some `codegen` and `assembly` tests have been ignored.
* All `ignore-emscripten` directives have been updated to
  `ignore-wasm32` to be more clear that all wasm targets are ignored and
  it's not just Emscripten.
* Most `ignore-wasm32-bare` directives are now gone.
* Some ignore directives for wasm were switched to `needs-unwind`
  instead.
* Many `ignore-wasm32*` directives are removed as the tests work with
  WASI as opposed to `wasm32-unknown-unknown`.
2024-03-11 09:36:35 -07:00
Michael Goulet
383051092f Ignore tests w/ current/next revisions from compare-mode=next-solver 2024-03-10 21:18:41 -04:00
Guillaume Gomez
4de78d2a8d
Rollup merge of #121089 - oli-obk:create_def_feed, r=petrochenkov
Remove `feed_local_def_id`

best reviewed commit by commit

Basically I returned `TyCtxtFeed` from `create_def` and then preserved that in the local caches

based on https://github.com/rust-lang/rust/pull/121084

r? ````@petrochenkov````
2024-03-07 18:32:47 +01:00
Alex Crichton
75fa9f6dec compiletest: Add a //@ needs-threads directive
This commit is extracted from #122036 and adds a new directive to the
`compiletest` test runner, `//@ needs-threads`. This is intended to
capture the need that a target must implement threading to execute a
specific test, typically one that uses `std::thread`. This is primarily
done for WebAssembly targets which currently do not have threads by
default. This enables transitioning a lot of `//@ ignore-wasm*`-style
ignores into a more self-documenting `//@ needs-threads` directive.
Additionally the `wasm32-wasi-preview1-threads` target, for example,
does actually have threads, but isn't tested in CI at this time. This
change enables running these tests for that target, but not other wasm
targets.
2024-03-06 12:35:07 -08:00
Oli Scherer
ef00fae46d Avoid using feed_unit_query from within queries 2024-03-05 10:02:39 +00:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Nicholas Nethercote
2aac288c18 Use the right level with -Ztreat-err-as-bug.
Errors in `DiagCtxtInner::emit_diagnostic` are never set to
`Level::Bug`, because the condition never succeeds, because
`self.treat_err_as_bug()` is called *before* the error counts are
incremented.

This commit switches to `self.treat_next_err_as_bug()`, fixing the
problem. This changes the error message output to actually say "internal
compiler error".
2024-01-11 16:55:10 +11:00
lcnr
11d16c4082 update use of feature flags 2023-12-14 15:22:37 +01:00
Pietro Albini
3853774df8
mark relevant tests as requiring unwinding 2023-09-29 14:24:40 +02:00
Ralf Jung
1087e90a2e avoid triple-backtrace due to panic-during-cleanup 2023-08-27 20:02:46 +02:00
Ralf Jung
df5a248cb1 keep trying which flags we need for this test until it passes bors 2023-08-25 08:20:19 +02:00
Ralf Jung
af29a26378 add tests for both kinds of unwind-terminate messages 2023-08-24 13:28:26 +02:00
bors
828bdc2c26 Auto merge of #112849 - m-ou-se:panic-message-format, r=thomcc
Change default panic handler message format.

This changes the default panic hook's message format from:

```
thread '{thread}' panicked at '{message}', {location}
```

to

```
thread '{thread}' panicked at {location}:
{message}
```

This puts the message on its own line without surrounding quotes, making it easiser to read. For example:

Before:
```
thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`', src/main.rs:4:6
```
After:
```
thread 'main' panicked at src/main.rs:4:6:
env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`
```

---

See this PR by `@nyurik,` which does that for only multi-line messages (specifically because of `assert_eq`): https://github.com/rust-lang/rust/pull/111071

This is the change that does that for *all* panic messages.
2023-08-01 14:15:09 +00:00
yukang
90db98d074 print omitted frames count for short backtrace mode 2023-07-29 20:36:05 +08:00
Mara Bos
0e729404da Change default panic handler message format. 2023-07-29 11:42:50 +02:00
Michael Goulet
846d54f16c Structurally resolve in pattern matching when peeling refs in new solver 2023-07-11 02:40:59 +00:00
Amanieu d'Antras
ef7f0e697b Rework handling of recursive panics 2023-05-27 16:35:16 +02:00
yukang
c3394b3eaa Fix #107910, Shorten backtraces in ICEs 2023-05-17 17:56:26 +08:00
Nicholas Nethercote
f20738dfb9 Improve filtering in default-backtrace-ice.rs.
This test is supposed to ensure that full backtraces are used for ICEs.
But it doesn't actually do that -- the filtering done cannot distinguish
between a full backtrace versus a short backtrace.

So this commit changes the filtering to preserve the existence of
`__rust_{begin,end}_short_backtrace` markers, which only appear in full
backtraces. This change means the test now tests what it is supposed to
test.

Also, the existing filtering included a rule that excluded any line
starting with two spaces. This was too strong because it filtered out
some parts of the error message. (This was not a showstopper). It was
also not strong enough because it didn't work with three digit stack
frame numbers, which just started seeing after upgrading my Ubuntu
distro to 23.04 machine (this *was* a showstopper).

So the commit replaces that rule with two more precise rules, one for
lines with stack frame numbers, and one for "at ..." lines.
2023-05-05 07:18:06 +10:00
Lukas Markeffsky
cd398a6de9 test that we format the panic message only once 2023-04-25 18:11:28 +02:00
Eric Huss
a4e851cf62 Add some reasons why tests are ignored. 2023-04-15 16:11:42 -07:00
Oli Scherer
c3522d0637 Move the resolver into a query 2023-02-20 15:28:59 +00:00
Esteban Küber
a7597a1526 Tweak ICE message
Modify main message to be more conversational and emit one fewer note.
2023-02-07 19:17:24 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00