Skip to content

Commit

Permalink
test: Add integration tests for build_profile()
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenexp committed Nov 27, 2024
1 parent 68768dd commit 7882980
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion example-build-script/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use conan2::{ConanInstall, ConanVerbosity};

fn main() {
ConanInstall::new()
.detect_profile() // Auto-detect "default" profile if not exists
.host_profile("cargo-host")
.build_profile("default")
// Auto-detect "cargo-host" and "default" profiles if none exist
.detect_profile()
.build("missing")
.verbosity(ConanVerbosity::Error) // Silence Conan warnings
.run()
Expand Down
15 changes: 15 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,18 @@ fn detect_custom_profile() {
std::io::stderr().write_all(output.stderr()).unwrap();
assert!(output.is_success());
}

#[test]
fn host_and_build_profiles() {
let output = ConanInstall::with_recipe(Path::new("tests/conanfile.txt"))
.output_folder(Path::new(env!("CARGO_TARGET_TMPDIR")))
.host_profile(&format!("{}-dynamic-host-profile", env!("CARGO_PKG_NAME")))
.build_profile(&format!("{}-dynamic-build-profile", env!("CARGO_PKG_NAME")))
.detect_profile()
.build("missing")
.verbosity(ConanVerbosity::Debug)
.run();

std::io::stderr().write_all(output.stderr()).unwrap();
assert!(output.is_success());
}

0 comments on commit 7882980

Please sign in to comment.