mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 23:17:15 +03:00
Add tests for a simple workspace
This commit is contained in:
parent
1c8034c0d9
commit
a8c6f256bc
@ -72,24 +72,17 @@ onlyDrvs (lib.makeScope myLib.newScope (self:
|
||||
src = ./simple;
|
||||
};
|
||||
|
||||
smokeSimple = pkgs.runCommand "smoke-simple" { } ''
|
||||
# does it run?
|
||||
${self.simple}/bin/simple
|
||||
touch $out
|
||||
'';
|
||||
smoke = callPackage ./smoke.nix { };
|
||||
smokeSimple = self.smoke [ "simple" ] self.simple;
|
||||
|
||||
smokeOverlappingTargets =
|
||||
let
|
||||
overlappingTargets = myLib.buildPackage {
|
||||
src = ./overlapping-targets;
|
||||
};
|
||||
in
|
||||
pkgs.runCommand "smoke-overlapping-targets" { } ''
|
||||
# does it run?
|
||||
${overlappingTargets}/bin/foo
|
||||
${overlappingTargets}/bin/bar
|
||||
${overlappingTargets}/bin/baz
|
||||
touch $out
|
||||
'';
|
||||
smokeOverlappingTargets = self.smoke [ "foo" "bar" "baz" ] (myLib.buildPackage {
|
||||
src = ./overlapping-targets;
|
||||
});
|
||||
|
||||
smokeWorkspace = self.smoke [ "print" ] self.workspace;
|
||||
|
||||
workspace = myLib.buildPackage {
|
||||
src = ./workspace;
|
||||
};
|
||||
})
|
||||
)
|
||||
|
13
checks/smoke.nix
Normal file
13
checks/smoke.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ runCommand
|
||||
}:
|
||||
|
||||
bins: drv:
|
||||
let
|
||||
testList = map (b: "${drv}/bin/${b}") bins;
|
||||
tests = builtins.concatStringsSep "\n" testList;
|
||||
in
|
||||
runCommand "smoke-${drv.name}" { } ''
|
||||
# does it run?
|
||||
${tests}
|
||||
touch $out
|
||||
''
|
19
checks/workspace/Cargo.lock
generated
Normal file
19
checks/workspace/Cargo.lock
generated
Normal file
@ -0,0 +1,19 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "hello"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "print"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hello",
|
||||
"world",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "world"
|
||||
version = "0.1.0"
|
4
checks/workspace/Cargo.toml
Normal file
4
checks/workspace/Cargo.toml
Normal file
@ -0,0 +1,4 @@
|
||||
[workspace]
|
||||
# NB: hello and world are intentionally left out cargo will
|
||||
# promote them to members since they are listed as path deps
|
||||
members = ["print"]
|
4
checks/workspace/hello/Cargo.toml
Normal file
4
checks/workspace/hello/Cargo.toml
Normal file
@ -0,0 +1,4 @@
|
||||
[package]
|
||||
name = "hello"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
3
checks/workspace/hello/src/lib.rs
Normal file
3
checks/workspace/hello/src/lib.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub fn hello() -> &'static str {
|
||||
"hello"
|
||||
}
|
8
checks/workspace/print/Cargo.toml
Normal file
8
checks/workspace/print/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "print"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
hello = { version = "*", path = "../hello" }
|
||||
world = { version = "*", path = "../world" }
|
3
checks/workspace/print/src/main.rs
Normal file
3
checks/workspace/print/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("{}, {}", hello::hello(), world::world());
|
||||
}
|
4
checks/workspace/world/Cargo.toml
Normal file
4
checks/workspace/world/Cargo.toml
Normal file
@ -0,0 +1,4 @@
|
||||
[package]
|
||||
name = "world"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
3
checks/workspace/world/src/lib.rs
Normal file
3
checks/workspace/world/src/lib.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub fn world() -> &'static str {
|
||||
"world!"
|
||||
}
|
Loading…
Reference in New Issue
Block a user