summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2024-03-13compiletest: Allow `only-unix` in test headersMartin Nordholts-0/+3
The header `ignore-unix` is already allowed. Also extend tests.
2024-03-12Rollup merge of #122355 - fmease:rustdoc-fix-up-old-test, r=notriddleJubilee-1/+0
rustdoc: fix up old test `tests/rustdoc/line-breaks.rs` had several issues: 1. It used `//`@count`` instead of `// `@count`` (notice the space!) which gets treated as a `ui_test` directive instead of a `htmldocck` one. `compiletest` didn't flag it as an error because it's allowlisted ([#121561](https://github.com/rust-lang/rust/pull/121561)) presumably precisely because of this test. And before the compiletest→ui_test migration, these directives must've been ignored, too, because … 2. … the checks themselves no longer work either: The count of `<br>`s is actually 0 in all 3 cases because – well – we no longer generate any `<br>`s inside `<pre>`s. Since I don't know how to ``@count`` `\n`s instead of `<br>`s, I've turned them into ``@matches`.` Btw, I don't know if this test is still desirable or if we have other tests that cover this (I haven't checked). r? rustdoc
2024-03-12rustdoc: fix up old testLeón Orell Valerian Liehr-1/+0
2024-03-11compiletest: Automatically compare output by subset with runnersAlex Crichton-49/+20
This commit updates compiletest to automatically compare test output with subsets if a `--runner` argument is configured. Runners might inject extra information on failures, for example a WebAssembly runtime printing a wasm stack trace, which won't be in the output of a native runtime. The output with a `--runner` argument, however, should still have all the native output present.
2024-03-11Remove old support for emscripten/wasm32-u-uAlex Crichton-29/+1
This commit removes the `wasm32-shim.js` file, for example, and deletes old support for Emscripten which hasn't been exercised in some time.
2024-03-11Rollup merge of #122108 - alexcrichton:target-config-runtool, r=WaffleLapkinJacob Pratt-7/+9
Add `target.*.runner` configuration for targets This commit adds a `runner` field configuration to `config.toml` for specifying a wrapper executable when executing binaries for a target. This is pulled out of #122036 where a WebAssembly runtime is used, for example, to execute tests for `wasm32-wasip1`. The name "runner" here is chosen to match Cargo's `CARGO_*_RUNNER` configuration, and to make things a bit more consistent this additionally renames compiletest's `--runtool` argument to `--runner`.
2024-03-10Error on invalid compiletest directives in Rust test files许杰友 Jieyou Xu (Joe)-31/+172
2024-03-08Add `target.*.runner` configuration for targetsAlex Crichton-7/+9
This commit adds a `runner` field configuration to `config.toml` for specifying a wrapper executable when executing binaries for a target. This is pulled out of #122036 where a WebAssembly runtime is used, for example, to execute tests for `wasm32-wasip1`. The name "runner" here is chosen to match Cargo's `CARGO_*_RUNNER` configuration, and to make things a bit more consistent this additionally renames compiletest's `--runtool` argument to `--runner`.
2024-03-06compiletest: Add a `//@ needs-threads` directiveAlex Crichton-0/+35
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-04Auto merge of #120468 - alexcrichton:start-wasm32-wasi-rename, r=wesleywiserbors-0/+10
Add a new `wasm32-wasip1` target to rustc This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * https://github.com/rust-lang/compiler-team/issues/607 * https://github.com/rust-lang/compiler-team/issues/695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](https://github.com/rust-lang/rust/pull/119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
2024-03-03Auto merge of #121877 - estebank:fancy-svg, r=compiler-errorsbors-3/+25
On tests that specify `--color=always` emit SVG file with stderr output Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly. <img src="https://raw.githubusercontent.com/rust-lang/rust/b4bdb56f86e136ca63bf71dca3034200c6c25900/tests/ui/error-emitter/highlighting.svg">
2024-03-02On tests that specify --color=always emit SVG file with stderr outputEsteban Kuber-3/+25
Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.
2024-03-02Add a new `wasm32-wasip1` target to rustcAlex Crichton-0/+10
This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * https://github.com/rust-lang/compiler-team/issues/607 * https://github.com/rust-lang/compiler-team/issues/695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](https://github.com/rust-lang/rust/pull/119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
2024-03-01Add initial support for DataFlowSanitizerRamon de C Valle-0/+8
Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-02-29Add supporting infrastructure for `run-make` V2 tests许杰友 Jieyou Xu (Joe)-9/+269
2024-02-26Rollup merge of #120656 - Zalathar:filecheck-flags, r=wesleywiserGuillaume Gomez-16/+31
Allow tests to specify a `//@ filecheck-flags:` header This allows individual codegen/assembly/mir-opt tests to pass extra flags to the LLVM `filecheck` tool as needed. --- The original motivation was noticing that `tests/run-make/instrument-coverage` was very close to being an ordinary codegen test, except that it needs some extra logic to set up platform-specific variables to be passed into filecheck. I then saw the comment in `verify_with_filecheck` indicating that a `filecheck-flags` header might be useful for other purposes as well.
2024-02-23Ignore less tests in debug buildsBen Kimock-2/+5
2024-02-23Allow tests to specify a `//@ filecheck-flags:` headerZalathar-5/+14
Any flags specified here will be passed to LLVM's `filecheck` tool, in tests that use that tool.
2024-02-23Simplify existing code for setting `filecheck` flagsZalathar-11/+17
This removes a version check for LLVM >=13, and specifies prefixes as a series of independent `--check-prefix` flags instead of a single `--check-prefixes`.
2024-02-22Update compiletest to only accept `//@` directives许杰友 Jieyou Xu (Joe)-30/+13
2024-02-22Update list of known directive names for diagnostics许杰友 Jieyou Xu (Joe)-0/+52
2024-02-21Rollup merge of #121373 - Zalathar:test-revision, r=oli-obkMatthias Krüger-65/+81
Consistently refer to a test's `revision` instead of `cfg` Compiletest allows a test file to specify multiple “revisions” (`//@ revisions: foo bar`), with each revision running as a separate test, and having the ability to define revision-specific headers (`//`@[foo]` ignore-blah`) and revision-specific code (`#[cfg(foo)]`). The code that implements this feature sometimes uses the term “cfg” instead of “revision”. This results in two confusingly-different names for the same concept, one of which is ambiguous with other kinds of configuration (such as compiletest's own config). This PR replaces those occurrences of `cfg` with `revision`, so that one name is used consistently.
2024-02-21Rollup merge of #121347 - davidtwco:compiletest-aux-aux, r=oli-obkLeón Orell Valerian Liehr-23/+23
compiletest: support auxiliaries with auxiliaries To test behaviour that depends on the extern options of intermediate crates, compiletest auxiliaries must have their own auxiliaries. Auxiliary compilation previously did not trigger compilation of any auxiliaries in the auxiliary's headers. In addition, those auxiliaries would need to be in an `auxiliary/auxiliary` directory, which is unnecessary and makes some crate graphs harder to write tests for, such as when A depends on B and C, and B depends on C. For a test `tests/ui/$path/root.rs`, with the following crate graph: ``` root |-- grandparent `-- parent `-- grandparent ``` then the intermediate outputs from compiletest will be: ``` build/$target/test/ui/$path/ |-- auxiliary | |-- libgrandparent.dylib | |-- libparent.dylib | |-- grandparent | | |-- grandparent.err | | `-- grandparent.out | `-- parent | |-- parent.err | `-- parent.out |-- libroot.rmeta |-- root.err `-- root.out ```
2024-02-21compiletest: support auxiliaries with auxiliariesDavid Wood-23/+23
To test behaviour that depends on the extern options of intermediate crates, compiletest auxiliaries must have their own auxiliaries. Auxiliary compilation previously did not trigger compilation of any auxiliaries in the auxiliary's headers. In addition, those auxiliaries would need to be in an `auxiliary/auxiliary` directory, which is unnecessary and makes some crate graphs harder to write tests for, such as when A depends on B and C, and B depends on C. For a test `tests/ui/$path/root.rs`, with the following crate graph: ``` root |-- grandparent `-- parent `-- grandparent ``` then the intermediate outputs from compiletest will be: ``` build/$target/test/ui/$path/ |-- auxiliary | |-- libgrandparent.dylib | |-- libparent.dylib | |-- grandparent | | |-- grandparent.err | | `-- grandparent.out | `-- parent | |-- parent.err | `-- parent.out |-- libroot.rmeta |-- root.err `-- root.out ``` Signed-off-by: David Wood <david@davidtw.co>
2024-02-21Flatten the parse logic in `line_directive`Zalathar-18/+13
2024-02-21Consistently refer to a test's `revision` instead of `cfg`Zalathar-41/+44
Compiletest code sometimes refers to a test's revision as its `cfg`. This results in two different names for the same thing, one of which is ambiguous with other kinds of configuration (such as compiletest's own config). This patch replaces those occurrences of `cfg` with `revision`.
2024-02-21Improve internal docs for the `HeaderLine` callback structZalathar-8/+26
2024-02-20Update panic message for missing `//@ run-rustfix` ui test suite when a ↵许杰友 Jieyou Xu (Joe)-4/+9
.fixed file exists
2024-02-20Rollup merge of #121233 - Zalathar:extra-directives, r=oli-obkNilstrieb-49/+43
Move the extra directives for `Mode::CoverageRun` into `iter_header` When these extra directives were ported over as part of #112300, it made sense to introduce `iter_header_extra` and pass them in as an extra argument. But now that #120881 has added a `mode` parameter to `iter_header` for its own purposes, it's slightly simpler to move the coverage special-case code directly into `iter_header` as well. This lets us get rid of `iter_header_extra`.
2024-02-18Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrumbors-1/+1
bump some deps First commit dedupes darling* crates and remove one more syn 1.* dep Second one bumps windows crate to 0.52
2024-02-18windows bump to 0.52klensy-1/+1
2024-02-18Move the extra directives for `Mode::CoverageRun` into `iter_header`Zalathar-39/+21
When these extra directives were ported over as part of #112300, it made sense to introduce `iter_header_extra` and pass them in as an extra argument. But now that #120881 has added a `mode` parameter to `iter_header` for its own purposes, it's slightly simpler to move the coverage special-case code directly into `iter_header` as well. This lets us get rid of `iter_header_extra`.
2024-02-18Wrap `iter_header` callback arguments in a documentable structZalathar-12/+24
2024-02-17compiletest: fix regex rebuildsklensy-2/+4
2024-02-16Implement infra support for migrating from `//` to `//@` ui test directives许杰友 Jieyou Xu (Joe)-300/+557
2024-02-12Rollup merge of #120273 - klensy:ct-run, r=onur-ozkanMatthias Krüger-11/+16
compiletest: few naive improvements Tested on `python x.py --stage=1 t tests/ui/borrowck/ --force-rerun`, see individual commits. Wall time didn't improved :-) .
2024-02-06Tweak a few mir-opt tests instead of using -Clink-dead-codeBen Kimock-1/+0
2024-02-06Use a better set of targets for blessing mir-opt testsBen Kimock-0/+2
2024-01-24add fixme about walking tests treeklensy-0/+2
2024-01-23don't collect found paths into BTreeSet:klensy-5/+6
keeping order of inserted Paths having high cost on hot path, collect into HashSet instead and sort afterward. from 1,858,963,938 to 1,448,975,825 I refs.
2024-01-23Remove support for no-system-llvmNikita Popov-12/+12
Also add tests for min-system-llvm-version.
2024-01-23reduce bufreader size from default(8kb) to 1kbklensy-1/+1
Headers WAY less than 1kb anyway, so this can be improved more? before ==18725== Total: 429,769,246 bytes in 957,259 blocks ==18725== At t-gmax: 8,058,316 bytes in 3,502 blocks ==18725== At t-end: 3,045,261 bytes in 1,097 blocks ==18725== Reads: 431,872,599 bytes ==18725== Writes: 214,738,653 bytes after ==49344== Total: 201,418,575 bytes in 957,174 blocks ==49344== At t-gmax: 7,937,250 bytes in 3,310 blocks ==49344== At t-end: 3,035,637 bytes in 1,076 blocks ==49344== Reads: 431,607,448 bytes ==49344== Writes: 210,731,540 bytes
2024-01-23compiletest: reduce useless regex rebuildsklensy-5/+7
before: ==8812== Total: 2,374,977,159 bytes in 6,840,026 blocks ==8812== At t-gmax: 8,090,486 bytes in 3,389 blocks ==8812== At t-end: 3,185,454 bytes in 757 blocks ==8812== Reads: 1,873,472,286 bytes ==8812== Writes: 1,249,411,589 bytes ==11212== I refs: 6,370,244,180 after: ==18725== Total: 429,769,246 bytes in 957,259 blocks ==18725== At t-gmax: 8,058,316 bytes in 3,502 blocks ==18725== At t-end: 3,045,261 bytes in 1,097 blocks ==18725== Reads: 431,872,599 bytes ==18725== Writes: 214,738,653 bytes ==20839== I refs: 1,873,010,089
2024-01-18Warn when no profiler runtime means coverage tests won't be run/blessedZalathar-0/+9
2024-01-09Rollup merge of #119619 - onur-ozkan:panic-abort-mir-opt, r=oli-obkMatthias Krüger-12/+33
mir-opt and custom target fixes From https://github.com/rust-lang/rust/issues/115642#issuecomment-1879589022 > > Could you please test the last two commits from https://github.com/onur-ozkan/rust/commits/panic-abort-mir-opt when you have the time? The first commit should resolve the error of using the nightly flag with a stable compiler, and the second one should resolve the custom target issue. > I tested with the two commits and the errors of using nightly flag and custom target specs were not seen. Testing was completed for the test suites like ui, run-pass-valgrind, coverage, mir-opt, codegen, assembly, incremental. Fixes #115642
2024-01-08detect user-specified custom targets in compiletestonur-ozkan-12/+33
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-01-07coverage: Anonymize line numbers in branch viewsZalathar-3/+93
The code for anonymizing line numbers in coverage reports now supports the slightly different line number syntax used by branch regions.
2024-01-05Allow coverage tests to enable `llvm-cov --use-color`Zalathar-0/+11
2024-01-05Extract a `split_flags` helper in header directive parsingZalathar-9/+16
2024-01-05Allow tests to ignore individual test modesZalathar-3/+36
Normally, each test in `tests/coverage` is automatically run in both `coverage-map` mode and `coverage-run` mode. This new family of directives allows an individual test to specify that it should not be run in a particular mode.