mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Merge pull request #6311 from roc-lang/fix_benchmarks
Fix benchmarks failing silently
This commit is contained in:
commit
ae0e3593a4
16 changed files with 85 additions and 64 deletions
|
@ -1,19 +1,12 @@
|
|||
|
||||
# Running the benchmarks
|
||||
|
||||
Install cargo criterion:
|
||||
|
||||
If you're not using nix, install cargo criterion:
|
||||
```sh
|
||||
cargo install cargo-criterion
|
||||
```
|
||||
|
||||
To prevent stack overflow on the `CFold` benchmark:
|
||||
|
||||
```sh
|
||||
ulimit -s unlimited
|
||||
```
|
||||
|
||||
In the `cli` folder execute:
|
||||
In the `crates/cli` folder execute:
|
||||
|
||||
```sh
|
||||
cargo criterion
|
||||
|
|
|
@ -976,13 +976,13 @@ mod cli_run {
|
|||
|
||||
// TODO fix QuicksortApp and then remove this!
|
||||
match roc_filename {
|
||||
"QuicksortApp.roc" => {
|
||||
"quicksortApp.roc" => {
|
||||
eprintln!(
|
||||
"WARNING: skipping testing benchmark {roc_filename} because the test is broken right now!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
"TestAStar.roc" => {
|
||||
"testAStar.roc" => {
|
||||
if cfg!(feature = "wasm32-cli-run") {
|
||||
eprintln!(
|
||||
"WARNING: skipping testing benchmark {roc_filename} because it currently does not work on wasm32 due to dictionaries."
|
||||
|
@ -1137,20 +1137,20 @@ mod cli_run {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn nqueens() {
|
||||
test_benchmark("NQueens.roc", &["6"], "4\n", UseValgrind::Yes)
|
||||
test_benchmark("nQueens.roc", &["6"], "4\n", UseValgrind::Yes)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn cfold() {
|
||||
test_benchmark("CFold.roc", &["3"], "11 & 11\n", UseValgrind::Yes)
|
||||
test_benchmark("cFold.roc", &["3"], "11 & 11\n", UseValgrind::Yes)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn deriv() {
|
||||
test_benchmark(
|
||||
"Deriv.roc",
|
||||
"deriv.roc",
|
||||
&["2"],
|
||||
"1 count: 6\n2 count: 22\n",
|
||||
UseValgrind::Yes,
|
||||
|
@ -1160,14 +1160,14 @@ mod cli_run {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn rbtree_ck() {
|
||||
test_benchmark("RBTreeCk.roc", &["100"], "10\n", UseValgrind::Yes)
|
||||
test_benchmark("rBTreeCk.roc", &["100"], "10\n", UseValgrind::Yes)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn rbtree_insert() {
|
||||
test_benchmark(
|
||||
"RBTreeInsert.roc",
|
||||
"rBTreeInsert.roc",
|
||||
&[],
|
||||
"Node Black 0 {} Empty Empty\n",
|
||||
UseValgrind::Yes,
|
||||
|
@ -1179,25 +1179,25 @@ mod cli_run {
|
|||
#[test]
|
||||
fn rbtree_del() {
|
||||
test_benchmark(
|
||||
"RBTreeDel.roc",
|
||||
"rBTreeDel.roc",
|
||||
&["420"],
|
||||
&[],
|
||||
"30\n",
|
||||
true
|
||||
UseValgrind::Yes,
|
||||
)
|
||||
}*/
|
||||
}
|
||||
*/
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn astar() {
|
||||
test_benchmark("TestAStar.roc", &[], "True\n", UseValgrind::No)
|
||||
test_benchmark("testAStar.roc", &[], "True\n", UseValgrind::No)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn base64() {
|
||||
test_benchmark(
|
||||
"TestBase64.roc",
|
||||
"testBase64.roc",
|
||||
&[],
|
||||
"encoded: SGVsbG8gV29ybGQ=\ndecoded: Hello World\n",
|
||||
UseValgrind::Yes,
|
||||
|
@ -1207,19 +1207,19 @@ mod cli_run {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn closure() {
|
||||
test_benchmark("Closure.roc", &[], "", UseValgrind::No)
|
||||
test_benchmark("closure.roc", &[], "", UseValgrind::No)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn issue2279() {
|
||||
test_benchmark("Issue2279.roc", &[], "Hello, world!\n", UseValgrind::Yes)
|
||||
test_benchmark("issue2279.roc", &[], "Hello, world!\n", UseValgrind::Yes)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quicksort_app() {
|
||||
test_benchmark(
|
||||
"QuicksortApp.roc",
|
||||
"quicksortApp.roc",
|
||||
&[],
|
||||
"todo put the correct quicksort answer here",
|
||||
UseValgrind::Yes,
|
||||
|
|
|
@ -248,4 +248,4 @@ del = \t, k ->
|
|||
rebalanceLeft cx lx ky vy ry
|
||||
|
||||
Delmin (Del ry Bool.false) ky vy ->
|
||||
Del (Node cx lx ky vy ry) Bool.false
|
||||
Del (Node cx lx ky vy ry) Bool.false
|
File diff suppressed because one or more lines are too long
|
@ -255,7 +255,12 @@ pub fn run_cmd<'a, I: IntoIterator<Item = &'a str>, E: IntoIterator<Item = (&'a
|
|||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap_or_else(|_| panic!("failed to execute cmd `{cmd_name}` in CLI test"));
|
||||
.unwrap_or_else(|err| {
|
||||
panic!(
|
||||
"Encountered error:\n\t{:?}\nWhile executing cmd:\n\t{:?}",
|
||||
err, cmd_str
|
||||
)
|
||||
});
|
||||
|
||||
{
|
||||
let stdin = child.stdin.as_mut().expect("Failed to open stdin");
|
||||
|
@ -269,7 +274,7 @@ pub fn run_cmd<'a, I: IntoIterator<Item = &'a str>, E: IntoIterator<Item = (&'a
|
|||
|
||||
let output = child
|
||||
.wait_with_output()
|
||||
.unwrap_or_else(|_| panic!("failed to execute cmd `{cmd_name}` in CLI test"));
|
||||
.unwrap_or_else(|_| panic!("Failed to execute cmd:\n\t`{:?}`", cmd_str));
|
||||
|
||||
Out {
|
||||
cmd_str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue