diff --git a/pkgs/development/tools/rust/cargo-show-asm/default.nix b/pkgs/development/tools/rust/cargo-show-asm/default.nix index 423a2a60988e..094753f955ca 100644 --- a/pkgs/development/tools/rust/cargo-show-asm/default.nix +++ b/pkgs/development/tools/rust/cargo-show-asm/default.nix @@ -6,6 +6,7 @@ , installShellFiles , openssl , nix-update-script +, callPackage }: rustPlatform.buildRustPackage rec { pname = "cargo-asm"; @@ -30,8 +31,13 @@ rustPlatform.buildRustPackage rec { --zsh <($out/bin/cargo-asm --bpaf-complete-style-zsh ) ''; - passthru.updateScript = nix-update-script { - attrPath = pname; + passthru = { + updateScript = nix-update-script { + attrPath = pname; + }; + tests = lib.optionalAttrs stdenv.hostPlatform.isx86_64 { + test-basic-x86_64 = callPackage ./test-basic-x86_64.nix { }; + }; }; meta = with lib; { diff --git a/pkgs/development/tools/rust/cargo-show-asm/test-basic-x86_64.nix b/pkgs/development/tools/rust/cargo-show-asm/test-basic-x86_64.nix new file mode 100644 index 000000000000..c0dd8b421b0a --- /dev/null +++ b/pkgs/development/tools/rust/cargo-show-asm/test-basic-x86_64.nix @@ -0,0 +1,18 @@ +{ runCommand, cargo, rustc, cargo-show-asm }: +runCommand "test-basic" { + nativeBuildInputs = [ cargo rustc cargo-show-asm ]; +} '' + mkdir -p src + cat >Cargo.toml <src/lib.rs < u32 { a + b } +EOF + + [[ "$(cargo asm add::add | tee /dev/stderr)" == *"lea eax, "* ]] + [[ "$(cargo asm --mir add | tee /dev/stderr)" == *"= Add("* ]] + touch $out +''