Skip to content
Merged
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
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
rust-toolchain
pkgs.cargo-release
pkgs.cargo-expand
pkgs.foundry-bin
pkgs.gmp
pkgs.openssl
pkgs.libusb1
Expand Down Expand Up @@ -343,6 +344,7 @@
body = ''
bats test/bats/devshell/rust-shell/closure.test.bats
bats test/bats/devshell/rust-shell/cargo-expand.test.bats
bats test/bats/devshell/rust-shell/anvil.test.bats
'';
additionalBuildInputs = [ pkgs.bats ] ++ rust-build-inputs;
};
Expand Down
4 changes: 4 additions & 0 deletions test/bats/devshell/rust-shell/anvil.test.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@test "anvil should be available on PATH" {
run anvil --version
[ "$status" -eq 0 ]
}
14 changes: 7 additions & 7 deletions test/bats/devshell/rust-shell/closure.test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# time CI evaluates the shell.
#
# This file inspects rust-shell's full closure (`nix-store -q
# --requisites`) and fails if any sol toolchain, node/npm, or chromium
# component shows up. rust-shell is for repos that ship a pure rust
# binary (rain.cli, rain.metadoc, etc.) and should not pull in foundry,
# slither, solc, nodejs, or chromium.
# --requisites`) and fails if slither, solc, node/npm, or chromium
# show up. rust-shell ships foundry-bin so that alloy's Anvil::new()
# spawn works in cargo tests, but does not pull in the rest of the
# Solidity static-analysis toolchain.
#
# Skips when `nix` is not on PATH (e.g. running the bats files under a
# stripped sandbox); CI invokes via nix and so always exercises this.
Expand All @@ -28,11 +28,11 @@ setup() {
CLOSURE="$(nix-store -q --requisites "$RUST_SHELL_OUT")"
}

@test "rust-shell closure has no foundry toolchain" {
@test "rust-shell closure has no slither or solc" {
local hits
hits="$(echo "$CLOSURE" | grep -E '/nix/store/[^/]*-(foundry-|solc-static-|slither-analyzer-)' || true)"
hits="$(echo "$CLOSURE" | grep -E '/nix/store/[^/]*-(solc-static-|slither-analyzer-)' || true)"
if [ -n "$hits" ]; then
echo "FAIL: rust-shell closure references sol toolchain components:" >&2
echo "FAIL: rust-shell closure references sol static-analysis components:" >&2
echo "$hits" >&2
return 1
fi
Expand Down
Loading