diff options
| author | onur-ozkan <work@onurozkan.dev> | 2025-02-18 16:07:42 +0000 |
|---|---|---|
| committer | onur-ozkan <work@onurozkan.dev> | 2025-02-18 16:07:42 +0000 |
| commit | 60ade6c1d7c8bbac52d6d1b9ed6703582028f954 (patch) | |
| tree | a6d336e3ab79aa95e626d3fd8726e9ee8ad8df6d | |
| parent | baef666f788108620263b5d851d845735346acaa (diff) | |
add test coverage for `tool::get_tool_rustc_compiler`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index a828a844f81..b6aa9e7c844 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1085,3 +1085,33 @@ fn test_is_builder_target() { assert!(!builder.is_builder_target(target2)); } } + +#[test] +fn test_get_tool_rustc_compiler() { + let mut config = configure("build", &[], &[]); + config.download_rustc_commit = None; + let build = Build::new(config); + let builder = Builder::new(&build); + + let target_triple_1 = TargetSelection::from_user(TEST_TRIPLE_1); + + let compiler = Compiler { stage: 2, host: target_triple_1 }; + let expected = Compiler { stage: 1, host: target_triple_1 }; + let actual = tool::get_tool_rustc_compiler(&builder, compiler); + assert_eq!(expected, actual); + + let compiler = Compiler { stage: 1, host: target_triple_1 }; + let expected = Compiler { stage: 0, host: target_triple_1 }; + let actual = tool::get_tool_rustc_compiler(&builder, compiler); + assert_eq!(expected, actual); + + let mut config = configure("build", &[], &[]); + config.download_rustc_commit = Some("".to_owned()); + let build = Build::new(config); + let builder = Builder::new(&build); + + let compiler = Compiler { stage: 1, host: target_triple_1 }; + let expected = Compiler { stage: 1, host: target_triple_1 }; + let actual = tool::get_tool_rustc_compiler(&builder, compiler); + assert_eq!(expected, actual); +} |
