feat(tvix/eval): include filename of failing test when failing
Unfortunately we have to mangle test case filenames into rust-valid symbols, since test-generator doesn't use `r#"..."` (deliberately?). This means that when a test fails, there's nothing on the console you can copy-and-paste in order to view/edit the code of the failing test case. This commit (partially) fixes it by including the unmangled name in the panic!() string. However failures due to panic!()s inside the vm (including deliberate panics due to panic!()-debugging) still won't display an unmangled filename. Maybe we should reconsider the use of test-generator? Change-Id: I2208a859ffab1264f17f48fd303ff5e19675967e Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7092 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
8425c2016c
commit
dc3543e0ca
1 changed files with 5 additions and 5 deletions
|
@ -27,21 +27,21 @@ fn eval_test(code_path: &str, expect_success: bool) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result_str,
|
result_str,
|
||||||
exp.trim(),
|
exp.trim(),
|
||||||
"result value representation (left) must match expectation (right)"
|
"{code_path}: result value representation (left) must match expectation (right)"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
result_str,
|
result_str,
|
||||||
exp.trim(),
|
exp.trim(),
|
||||||
"test passed unexpectedly! consider moving it out of notyetpassing"
|
"{code_path}: test passed unexpectedly! consider moving it out of notyetpassing"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if expect_success {
|
if expect_success {
|
||||||
panic!("should be able to read test expectation");
|
panic!("{code_path}: should be able to read test expectation");
|
||||||
} else {
|
} else {
|
||||||
panic!(
|
panic!(
|
||||||
"test should have failed, but succeeded with output {}",
|
"{code_path}: test should have failed, but succeeded with output {}",
|
||||||
result
|
result
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ fn eval_test(code_path: &str, expect_success: bool) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if expect_success {
|
if expect_success {
|
||||||
panic!(
|
panic!(
|
||||||
"evaluation of eval-okay test should succeed, but failed with {:?}",
|
"{code_path}: evaluation of eval-okay test should succeed, but failed with {:?}",
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue