Run Rust tests using Valgrind and cargo-careful (#2706)
* Run asan with `-Zbuild-std` * Run Rust tests using Valgrind and cargo-careful. * Pin Valgrind task to 1.61.0 to avoid the DWARF5 issues until fixed upstream. * Override output checking of compilation UI tests as using different Rust versions might break that. Co-authored-by: messense <messense@icloud.com>
This commit is contained in:
parent
8d35ec75a1
commit
d7b05cbcf5
|
@ -318,6 +318,58 @@ jobs:
|
|||
# 1.49.
|
||||
CARGO_PRIMARY_PACKAGE: 1
|
||||
|
||||
valgrind:
|
||||
needs: [fmt]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
key: cargo-valgrind
|
||||
continue-on-error: true
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
# FIXME(adamreichold): Switch to stable when Valgrind understands DWARF5 as generated by LLVM 14,
|
||||
# c.f. https://bugs.kde.org/show_bug.cgi?id=452758#c35
|
||||
toolchain: 1.61.0
|
||||
override: true
|
||||
profile: minimal
|
||||
- uses: taiki-e/install-action@valgrind
|
||||
- run: python -m pip install -U pip nox
|
||||
- run: nox -s test-rust -- release skip-full
|
||||
env:
|
||||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: valgrind --leak-check=no --error-exitcode=1
|
||||
RUST_BACKTRACE: 1
|
||||
TRYBUILD: overwrite
|
||||
|
||||
careful:
|
||||
needs: [fmt]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
key: cargo-careful
|
||||
continue-on-error: true
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
override: true
|
||||
profile: minimal
|
||||
components: rust-src
|
||||
- run: cargo install cargo-careful
|
||||
- run: python -m pip install -U pip nox
|
||||
- run: nox -s test-rust -- careful skip-full
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
TRYBUILD: overwrite
|
||||
|
||||
coverage:
|
||||
needs: [fmt]
|
||||
name: coverage-${{ matrix.os }}
|
||||
|
|
13
noxfile.py
13
noxfile.py
|
@ -27,8 +27,9 @@ def test_rust(session: nox.Session):
|
|||
|
||||
_run_cargo_test(session)
|
||||
_run_cargo_test(session, features="abi3")
|
||||
_run_cargo_test(session, features="full")
|
||||
_run_cargo_test(session, features="abi3 full")
|
||||
if not "skip-full" in session.posargs:
|
||||
_run_cargo_test(session, features="full")
|
||||
_run_cargo_test(session, features="abi3 full")
|
||||
|
||||
|
||||
@nox.session(name="test-py", venv_backend="none")
|
||||
|
@ -235,6 +236,7 @@ def address_sanitizer(session: nox.Session):
|
|||
"cargo",
|
||||
"+nightly",
|
||||
"test",
|
||||
"-Zbuild-std",
|
||||
f"--target={_get_rust_target()}",
|
||||
"--",
|
||||
"--test-threads=1",
|
||||
|
@ -289,7 +291,12 @@ def _run_cargo_test(
|
|||
package: Optional[str] = None,
|
||||
features: Optional[str] = None,
|
||||
) -> None:
|
||||
command = ["cargo", "test"]
|
||||
command = ["cargo"]
|
||||
if "careful" in session.posargs:
|
||||
command.append("careful")
|
||||
command.append("test")
|
||||
if "release" in session.posargs:
|
||||
command.append("--release")
|
||||
if package:
|
||||
command.append(f"--package={package}")
|
||||
if features:
|
||||
|
|
Loading…
Reference in New Issue