From b2e83f81e10089a0e81ce33c4beb51aefc29a62e Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Sat, 4 Feb 2023 16:20:23 -0500 Subject: [PATCH] enable rendering in integration tests (#5819) This will allow testing more of the code base, as well as enable UI- specific testing. Debug mode builds are prohibitively slow for the tests, mostly because of the concurrency write tests. So there is now a profile for integration tests that sets the optimization level to 2 for a few helix crates, and lowers the number of rounds of concurrent writes to 1000. --- .cargo/config.toml | 2 +- Cargo.toml | 6 ++++++ helix-term/src/application.rs | 4 ---- helix-term/tests/test/write.rs | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 5d6155669..b016eca31 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,3 @@ [alias] xtask = "run --package xtask --" -integration-test = "test --features integration --workspace --test integration" +integration-test = "test --features integration --profile integration --workspace --test integration" diff --git a/Cargo.toml b/Cargo.toml index ecf6848e0..c7e254728 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,3 +25,9 @@ lto = "fat" codegen-units = 1 # strip = "debuginfo" # TODO: or strip = true opt-level = 3 + +[profile.integration] +inherits = "test" +package.helix-core.opt-level = 2 +package.helix-tui.opt-level = 2 +package.helix-term.opt-level = 2 diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 05ceb874e..a1685fcfa 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -277,10 +277,6 @@ pub fn new( Ok(app) } - #[cfg(feature = "integration")] - async fn render(&mut self) {} - - #[cfg(not(feature = "integration"))] async fn render(&mut self) { let mut cx = crate::compositor::Context { editor: &mut self.editor, diff --git a/helix-term/tests/test/write.rs b/helix-term/tests/test/write.rs index d0128edca..bbf14fc20 100644 --- a/helix-term/tests/test/write.rs +++ b/helix-term/tests/test/write.rs @@ -70,7 +70,7 @@ async fn test_write_quit() -> anyhow::Result<()> { async fn test_write_concurrent() -> anyhow::Result<()> { let mut file = tempfile::NamedTempFile::new()?; let mut command = String::new(); - const RANGE: RangeInclusive = 1..=5000; + const RANGE: RangeInclusive = 1..=1000; let mut app = helpers::AppBuilder::new() .with_file(file.path(), None) .build()?;