Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move cli_testing_examples under crates/cli/tests #6558

Merged
merged 6 commits into from
Mar 8, 2024

Conversation

jschear
Copy link
Contributor

@jschear jschear commented Mar 5, 2024

Fixes #6557. When these fixtures are under crates/cli, the file paths in expect failures are property relativized to the CWD.

This touches the benchmark stuff a bit, not sure how to run those on CI.

@jschear jschear force-pushed the js/move_cli_testing_examples branch from 3dfc2d2 to 813b001 Compare March 5, 2024 17:21
@Anton-4
Copy link
Collaborator

Anton-4 commented Mar 5, 2024

Thanks for working on this @jschear :)

Would it be possible to get rid of cli_testing_examples and place its subfolders directly in crates/cli/tests?
crates/cli/tests/cli_testing_examples reads kind of redundant 😄

@jschear
Copy link
Contributor Author

jschear commented Mar 5, 2024

Heh, great point. Updated.

Cargo.toml Show resolved Hide resolved
@@ -107,7 +107,10 @@ fn bench_cmd<T: Measurement>(

pub fn bench_nqueens<T: Measurement>(bench_group_opt: Option<&mut BenchmarkGroup<T>>) {
exec_bench_w_input(
&file_path_from_root("crates/cli_testing_examples/benchmarks", "nQueens.roc"),
&file_path_from_root(
"crates/cli/tests/cli_testing_examples/benchmarks",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the paths in this file still need to be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, updated.

Anton-4
Anton-4 previously approved these changes Mar 6, 2024
Copy link
Collaborator

@Anton-4 Anton-4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jschear, looks good :)

@Anton-4 Anton-4 enabled auto-merge March 6, 2024 15:24
@jschear
Copy link
Contributor Author

jschear commented Mar 6, 2024

Looks like something failed with the benchmarks check; I'll have some time to look into it later today.

@jschear
Copy link
Contributor Author

jschear commented Mar 6, 2024

Hmm, hitting a different issue when trying to run the benchmarks locally (maybe I need to run them in a noninteractive shell somehow?):

nix-shell-env ❯ nix develop -c ./ci/benchmarks/bench-runner/target/release/bench-runner --check-executables-changed

Doing a test run to verify benchmarks are working correctly and generate executables.

>>bench "branch": "Gnuplot not found, using plotters backend"
s>>bench "branch": "Benchmarking bench-group_wall-time/Benchmarking \"nQueens\""
>>bench "branch": "Benchmarking bench-group_wall-time/Benchmarking \"nQueens\": Warming up for 1.0000 s"
>>bench "branch": "Benchmarking bench-group_wall-time/Benchmarking \"nQueens\": Collecting 10 samples in estimated 1.3578 s (30 iterations)"
>>bench "branch": "Benchmarking bench-group_wall-time/Benchmarking \"nQueens\": Analyzing"
>>bench "branch": "bench-group_wall-time/Benchmarking \"nQueens\""
>>bench "branch": "                        time:   [44.852 ms 44.946 ms 45.053 ms]"
>>bench "branch": "Found 1 outliers among 10 measurements (10.00%)"
>>bench "branch": "  1 (10.00%) high mild"
thread 'main' panicked at 'expected output to end with "396354 & 396354\n" but instead got Out {
    cmd_str: "/Users/jschear/dev/roc/bench-folder-branch/crates/cli/tests/benchmarks/cFold",
    stdout: "Please enter an integer\n",
    stderr: "",
    status: ExitStatus(
        unix_wait_status(
            11,
        ),
    ),
}', crates/cli_utils/src/bench_utils.rs:60:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
>>bench "branch": ""
thread 'main' panicked at 'Error: time-bench execution failed with exit code exit status: 101.
See output above for error info.
Command was:
        "./bench-folder-branch/target/release/deps/time_bench" "--bench" "--noplot"', src/main.rs:164:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@jschear
Copy link
Contributor Author

jschear commented Mar 6, 2024

Oh I see, the CI job checks out main, invokes the script to prepare a benchmark folder, then checks out this branch and invokes the script to create another folder. Those folders are going to have a different structure (on main there will still be cli_testing_examples in the path, on this branch there won't be), and then the updated bench-runner binary doesn't handle both path formats. @Anton-4 if that makes sense, any tips on how to handle this? Merge through the failure; or update the bench-runner to handle the both the old and new layout temporarily?

@Anton-4
Copy link
Collaborator

Anton-4 commented Mar 8, 2024

I'll test this by checking out the current branch twice for the comparison, if that's good we can change one back to main and force the merge after.

This is required to test the benchmarks because we have breaking changes.

Signed-off-by: Anton-4 <[email protected]>
@Anton-4
Copy link
Collaborator

Anton-4 commented Mar 8, 2024

Benchmarks passed :)

@Anton-4
Copy link
Collaborator

Anton-4 commented Mar 8, 2024

Can you force merge this @rtfeldman? The benchmarks failure is expected.

@rtfeldman rtfeldman disabled auto-merge March 8, 2024 14:43
@rtfeldman rtfeldman merged commit c217456 into roc-lang:main Mar 8, 2024
15 of 17 checks passed
@jschear jschear deleted the js/move_cli_testing_examples branch April 20, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli_run::expects_dev_and_test fails when the roc repo is cloned into a directory not named "roc"
3 participants