Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: basic mutation testing with cargo mutants #2232

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cargo/mutants.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cargo-mutants configuration

# profile = "mutants" # Build without debug symbols
test_tool = "nextest"
27 changes: 25 additions & 2 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# cargo-mutants does not seem to support specifying the nextest profile? :(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use the env var NEXTEST_PROFILE

[profile.default]
slow-timeout = "2m"
default-filter = 'not (test(slow_) | package(tests))'
retries = 2
default-filter = """not (test(slow_) | package(tests) \
| test(test_fee_upgrade_time_based) \
| test(test_fee_upgrade_view_based) \
| test(test_marketplace_upgrade_time_based) \
| test(test_marketplace_upgrade_view_based) \
| test(test_process_client_handling_stream_subscribe_voters) \
| test(test_process_client_handling_stream_subscribe_node_identity) \
)"""
retries = 0

# The restart tests run an entire sequencing network, and so are quite resource intensive.
[[profile.default.overrides]]
Expand All @@ -22,3 +30,18 @@ retries = 2
slow-timeout = "2m"
default-filter = 'package(tests)'
retries = 2

# # Profile to be used with mutant testing.
# # The upgrade tests are slow.
# # The process_client_handling_stream_subscribe_... tests may hang.
# [profile.fast-non-flaky]
# slow-timeout = "2m"
# default-filter = """not (test(slow_) | package(tests) \
# | test(test_fee_upgrade_time_based) \
# | test(test_fee_upgrade_view_based) \
# | test(test_marketplace_upgrade_time_based) \
# | test(test_marketplace_upgrade_view_based) \
# | test(test_process_client_handling_stream_subscribe_voters) \
# | test(test_process_client_handling_stream_subscribe_node_identity) \
# )"""
# retries = 0
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ strip = "debuginfo"
[profile.dev.package."*"]
opt-level = 3

[profile.test]
inherits = "dev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test already inherits dev

# Minimal opt-level to run api::test::test_{catchup,restart}
opt-level = 1

# [profile.mutants]
# inherits = "dev"
# debug = "none"


[patch."https://github.com/EspressoSystems/HotShot.git"]
hotshot = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.78-patch5" }
hotshot-builder-api = { git = "https://www.github.com/EspressoSystems/HotShot.git", tag = "0.5.78-patch5" }
Expand Down
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
];
};

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";

inputs.nixpkgs-cross-overlay.url =
Expand Down Expand Up @@ -175,11 +175,6 @@
nightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
extensions = [ "rust-analyzer" ];
});
# nixWithFlakes allows pre v2.4 nix installations to use
# flake commands (like `nix flake update`)
nixWithFlakes = pkgs.writeShellScriptBin "nix" ''
exec ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
'';
solc = pkgs.solc-bin.latest;
in
mkShell (rustEnvVars // {
Expand All @@ -195,14 +190,14 @@
# Rust tools
cargo-audit
cargo-edit
cargo-sort
cargo-mutants
cargo-nextest
cargo-sort
typos
just
nightlyToolchain.passthru.availableComponents.rust-analyzer

# Tools
nixWithFlakes
nixpkgs-fmt
entr
process-compose
Expand Down
Loading