mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-24 21:14:52 +00:00
Merge pull request #233257 from figsoda/benchcmp
cargo-benchcmp: init at 0.4.4
This commit is contained in:
commit
f4864ee2ac
41
pkgs/development/tools/rust/cargo-benchcmp/default.nix
Normal file
41
pkgs/development/tools/rust/cargo-benchcmp/default.nix
Normal file
@ -0,0 +1,41 @@
|
||||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, substituteAll
|
||||
, rust
|
||||
, stdenv
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "cargo-benchcmp";
|
||||
version = "0.4.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "BurntSushi";
|
||||
repo = "cargo-benchcmp";
|
||||
rev = version;
|
||||
hash = "sha256-pg3/VUC1DQ7GbSQDfVZ0WNisXvzXy0O0pr2ik2ar2h0=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-vxy9Ym3Twx034I1E5fWNnbP1ttfLolMbO1IgRiPfhRw=";
|
||||
|
||||
patches = [
|
||||
# patch the binary path so tests can find the binary when `--target` is present
|
||||
(substituteAll {
|
||||
src = ./fix-test-binary-path.patch;
|
||||
shortTarget = rust.toRustTarget stdenv.hostPlatform;
|
||||
})
|
||||
];
|
||||
|
||||
checkFlags = [
|
||||
# thread 'different_input_colored' panicked at 'assertion failed: `(left == right)`
|
||||
"--skip=different_input_colored"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A small utility to compare Rust micro-benchmarks";
|
||||
homepage = "https://github.com/BurntSushi/cargo-benchcmp";
|
||||
license = with licenses; [ mit unlicense ];
|
||||
maintainers = with maintainers; [ figsoda ];
|
||||
};
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
--- a/tests/integration.rs
|
||||
+++ b/tests/integration.rs
|
||||
@@ -16,20 +16,13 @@ impl CommandUnderTest {
|
||||
fn new() -> CommandUnderTest {
|
||||
// To find the directory where the built binary is, we walk up the directory tree of the test binary until the
|
||||
// parent is "target/".
|
||||
- let mut binary_path = env::current_exe().expect("need current binary path to find binary to test");
|
||||
- loop {
|
||||
- {
|
||||
- let parent = binary_path.parent();
|
||||
- if parent.is_none() {
|
||||
- panic!("Failed to locate binary path from original path: {:?}", env::current_exe());
|
||||
- }
|
||||
- let parent = parent.unwrap();
|
||||
- if parent.is_dir() && parent.file_name().unwrap() == "target" {
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- binary_path.pop();
|
||||
- }
|
||||
+ let mut binary_path = PathBuf::from(
|
||||
+ env::current_dir()
|
||||
+ .unwrap()
|
||||
+ .join("target")
|
||||
+ .join("@shortTarget@")
|
||||
+ .join(env!("cargoBuildType")),
|
||||
+ );
|
||||
|
||||
binary_path.push(
|
||||
if cfg!(target_os = "windows") {
|
@ -16321,6 +16321,7 @@ with pkgs;
|
||||
cargo-audit = callPackage ../development/tools/rust/cargo-audit {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
cargo-benchcmp = callPackage ../development/tools/rust/cargo-benchcmp { };
|
||||
cargo-binstall = callPackage ../development/tools/rust/cargo-binstall { };
|
||||
cargo-bisect-rustc = callPackage ../development/tools/rust/cargo-bisect-rustc {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
|
Loading…
Reference in New Issue
Block a user