feat(tvix/glue): add test for output path calculation
This test serves as a minimal reproducer for output path calculation. Derivations with the same name and output hash, but different build recipe should end up with the same outPath. However derivations with different name should end up with a different outPath. Change-Id: I555be59dd87ea675a0816188ed973f96c311e4e1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10416 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
986e9b73c3
commit
17eaacb139
1 changed files with 36 additions and 0 deletions
|
@ -143,6 +143,42 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
/// Construct two FODs with the same name, and same known output (but
|
||||
/// slightly different recipe), ensure they have the same output hash.
|
||||
#[test]
|
||||
fn test_fod_outpath() {
|
||||
let code = r#"
|
||||
(builtins.derivation { name = "foo"; builder = "/bin/sh"; system = "x86_64-linux"; outputHash = "sha256-Q3QXOoy+iN4VK2CflvRulYvPZXYgF0dO7FoF7CvWFTA="; }).outPath ==
|
||||
(builtins.derivation { name = "foo"; builder = "/bin/aa"; system = "x86_64-linux"; outputHash = "sha256-Q3QXOoy+iN4VK2CflvRulYvPZXYgF0dO7FoF7CvWFTA="; }).outPath
|
||||
"#;
|
||||
|
||||
let value = eval(code).value.expect("must succeed");
|
||||
match value {
|
||||
tvix_eval::Value::Bool(v) => {
|
||||
assert!(v);
|
||||
}
|
||||
_ => panic!("unexpected value type: {:?}", value),
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct two FODs with the same name, and same known output (but
|
||||
/// slightly different recipe), ensure they have the same output hash.
|
||||
#[test]
|
||||
fn test_fod_outpath_different_name() {
|
||||
let code = r#"
|
||||
(builtins.derivation { name = "foo"; builder = "/bin/sh"; system = "x86_64-linux"; outputHash = "sha256-Q3QXOoy+iN4VK2CflvRulYvPZXYgF0dO7FoF7CvWFTA="; }).outPath ==
|
||||
(builtins.derivation { name = "foo"; builder = "/bin/aa"; system = "x86_64-linux"; outputHash = "sha256-Q3QXOoy+iN4VK2CflvRulYvPZXYgF0dO7FoF7CvWFTA="; }).outPath
|
||||
"#;
|
||||
|
||||
let value = eval(code).value.expect("must succeed");
|
||||
match value {
|
||||
tvix_eval::Value::Bool(v) => {
|
||||
assert!(v);
|
||||
}
|
||||
_ => panic!("unexpected value type: {:?}", value),
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct two derivations with the same parameters except
|
||||
/// one of them lost a context string for a dependency, causing
|
||||
/// the loss of an element in the `inputDrvs` derivation.
|
||||
|
|
Loading…
Reference in a new issue