Skip to content

Commit

Permalink
Merge branch 'master' into miri-memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Strophox committed May 16, 2024
2 parents 8f13fb0 + 35cbdf8 commit 76600cc
Show file tree
Hide file tree
Showing 450 changed files with 10,005 additions and 5,288 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
env:
HOST_TARGET: ${{ matrix.host_target }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Show Rust version (stable toolchain)
run: |
Expand All @@ -45,7 +45,7 @@ jobs:
# over time).
- name: Add cache for cargo
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
Expand All @@ -57,12 +57,12 @@ jobs:
~/.cargo/bin
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: cargo-${{ runner.os }}-reset20240331-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-${{ runner.os }}-reset20240331
key: cargo-${{ runner.os }}-reset20240425-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-${{ runner.os }}-reset20240425

- name: Install rustup-toolchain-install-master
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: cargo install -f rustup-toolchain-install-master
- name: Install tools
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install -f rustup-toolchain-install-master hyperfine

- name: Install miri toolchain
run: |
Expand All @@ -78,14 +78,20 @@ jobs:
rustc -Vv
cargo -V
# The `style` job only runs on Linux; this makes sure the Windows-host-specific
# code is also covered by clippy.
- name: Check clippy
if: matrix.os == 'windows-latest'
run: ./miri clippy -- -D warnings

- name: Test Miri
run: ./ci/ci.sh

style:
name: style checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# This is exactly duplicated from above. GHA is pretty terrible when it comes
# to avoiding code duplication.
Expand All @@ -95,7 +101,7 @@ jobs:
# over time).
- name: Add cache for cargo
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
Expand All @@ -111,7 +117,7 @@ jobs:
restore-keys: cargo-${{ runner.os }}-reset20240331

- name: Install rustup-toolchain-install-master
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install -f rustup-toolchain-install-master

- name: Install "master" toolchain
Expand Down Expand Up @@ -165,7 +171,7 @@ jobs:
name: cronjob failure notification
runs-on: ubuntu-latest
needs: [build, style]
if: github.event_name == 'schedule' && (failure() || cancelled())
if: github.event_name == 'schedule' && failure()
steps:
# Send a Zulip notification
- name: Install zulip-send
Expand All @@ -191,7 +197,7 @@ jobs:
The Miri Cronjobs Bot'
# Attempt to auto-sync with rustc
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 256 # get a bit more of the history
- name: install josh-proxy
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ tex/*/out
perf.data
perf.data.old
flamegraph.svg
tests/extern-so/libtestlib.so
tests/native-lib/libtestlib.so
.auto-*
51 changes: 44 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ For example:

You can (cross-)run the entire test suite using:

```
```sh
./miri test
MIRI_TEST_TARGET=i686-unknown-linux-gnu ./miri test
./miri test --target i686-unknown-linux-gnu
```

`./miri test FILTER` only runs those tests that contain `FILTER` in their filename (including the
base directory, e.g. `./miri test fail` will run all compile-fail tests). These filters are passed
to `cargo test`, so for multiple filters you need to use `./miri test -- FILTER1 FILTER2`.
base directory, e.g. `./miri test fail` will run all compile-fail tests). Multiple filters are
supported: `./miri test FILTER1 FILTER2` runs all tests that contain either string.

#### Fine grained logging

Expand Down Expand Up @@ -139,9 +139,8 @@ and then you can use it as if it was installed by `rustup` as a component of the
in the `miri` toolchain's sysroot to prevent conflicts with other toolchains.
The Miri binaries in the `cargo` bin directory (usually `~/.cargo/bin`) are managed by rustup.

There's a test for the cargo wrapper in the `test-cargo-miri` directory; run
`./run-test.py` in there to execute it. Like `./miri test`, this respects the
`MIRI_TEST_TARGET` environment variable to execute the test for another target.
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run `./run-test.py` in
there to execute it. You can pass `--target` to execute the test for another target.

### Using a modified standard library

Expand Down Expand Up @@ -287,3 +286,41 @@ https. Add the following to your `.gitconfig`:
[url "git@github.com:"]
pushInsteadOf = https://github.com/
```

## Internal environment variables

The following environment variables are *internal* and must not be used by
anyone but Miri itself. They are used to communicate between different Miri
binaries, and as such worth documenting:

* `CARGO_EXTRA_FLAGS` is understood by `./miri` and passed to all host cargo invocations.
* `MIRI_BE_RUSTC` can be set to `host` or `target`. It tells the Miri driver to
actually not interpret the code but compile it like rustc would. With `target`, Miri sets
some compiler flags to prepare the code for interpretation; with `host`, this is not done.
This environment variable is useful to be sure that the compiled `rlib`s are compatible
with Miri.
* `MIRI_CALLED_FROM_SETUP` is set during the Miri sysroot build,
which will re-invoke `cargo-miri` as the `rustc` to use for this build.
* `MIRI_CALLED_FROM_RUSTDOC` when set to any value tells `cargo-miri` that it is
running as a child process of `rustdoc`, which invokes it twice for each doc-test
and requires special treatment, most notably a check-only build before interpretation.
This is set by `cargo-miri` itself when running as a `rustdoc`-wrapper.
* `MIRI_CWD` when set to any value tells the Miri driver to change to the given
directory after loading all the source files, but before commencing
interpretation. This is useful if the interpreted program wants a different
working directory at run-time than at build-time.
* `MIRI_LOCAL_CRATES` is set by `cargo-miri` to tell the Miri driver which
crates should be given special treatment in diagnostics, in addition to the
crate currently being compiled.
* `MIRI_ORIG_RUSTDOC` is set and read by different phases of `cargo-miri` to remember the
value of `RUSTDOC` from before it was overwritten.
* `MIRI_REPLACE_LIBRS_IF_NOT_TEST` when set to any value enables a hack that helps bootstrap
run the standard library tests in Miri.
* `MIRI_TEST_TARGET` is set by `./miri test` (and `./x.py test miri`) to tell the test harness about
the chosen target.
* `MIRI_VERBOSE` when set to any value tells the various `cargo-miri` phases to
perform verbose logging.
* `MIRI_HOST_SYSROOT` is set by bootstrap to tell `cargo-miri` which sysroot to use for *host*
operations.
* `RUSTC_BLESS` is set by `./miri test` (and `./x.py test miri`) to indicate bless-mode to the test
harness.

0 comments on commit 76600cc

Please sign in to comment.