jj/cli/tests/runner.rs
jyn d66fcf2ca0 compile integration tests as a single binary
this greatly speeds up the time to run all tests, at the cost of slightly larger recompile times for individual tests.

this unfortunately adds the requirement that all tests are listed in `runner.rs` for the crate.
to avoid forgetting, i've added a new test that ensures the directory is in sync with the file.

 ## benchmarks

before this change, recompiling all tests took 32-50 seconds and running a single test took 3.5 seconds:

```
; hyperfine 'touch lib/src/lib.rs && cargo t --test test_working_copy'
  Time (mean ± σ):      3.543 s ±  0.168 s    [User: 2.597 s, System: 1.262 s]
  Range (min … max):    3.400 s …  3.847 s    10 runs
```

after this change, recompiling all tests take 4 seconds:
```
;  hyperfine 'touch lib/src/lib.rs ; cargo t --test runner --no-run'
  Time (mean ± σ):      4.055 s ±  0.123 s    [User: 3.591 s, System: 1.593 s]
  Range (min … max):    3.804 s …  4.159 s    10 runs
```
and running a single test takes about the same:
```
; hyperfine 'touch lib/src/lib.rs && cargo t --test runner -- test_working_copy'
  Time (mean ± σ):      4.129 s ±  0.120 s    [User: 3.636 s, System: 1.593 s]
  Range (min … max):    3.933 s …  4.346 s    10 runs
```

about 1.4 seconds of that is the time for the runner, of which .4 is the time for the linker. so
there may be room for further improving the times.
2024-02-06 18:19:41 -08:00

69 lines
1.6 KiB
Rust

use std::path::PathBuf;
mod common;
#[test]
fn test_no_forgotten_test_files() {
let test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests");
testutils::assert_no_forgotten_test_files(&test_dir);
}
mod test_abandon_command;
mod test_alias;
mod test_branch_command;
mod test_builtin_aliases;
mod test_cat_command;
mod test_checkout;
mod test_chmod_command;
mod test_commit_command;
mod test_commit_template;
mod test_concurrent_operations;
mod test_config_command;
mod test_debug_command;
mod test_describe_command;
mod test_diff_command;
mod test_diffedit_command;
mod test_duplicate_command;
mod test_edit_command;
mod test_generate_md_cli_help;
mod test_git_clone;
mod test_git_colocated;
mod test_git_fetch;
mod test_git_import_export;
mod test_git_init;
mod test_git_push;
mod test_git_remotes;
mod test_git_submodule;
mod test_gitignores;
mod test_global_opts;
mod test_immutable_commits;
mod test_init_command;
mod test_interdiff_command;
mod test_log_command;
mod test_move_command;
mod test_new_command;
mod test_next_prev_commands;
mod test_obslog_command;
mod test_operations;
mod test_rebase_command;
mod test_repo_change_report;
mod test_resolve_command;
mod test_restore_command;
mod test_revset_output;
mod test_root;
mod test_shell_completion;
mod test_show_command;
mod test_sparse_command;
mod test_split_command;
mod test_squash_command;
mod test_status_command;
mod test_tag_command;
mod test_templater;
mod test_tree_level_conflicts;
mod test_undo;
mod test_unsquash_command;
mod test_untrack_command;
mod test_util_command;
mod test_working_copy;
mod test_workspaces;