Repository: rust-lang/rust
File: src/bootstrap/src/core/builder/tests.rs (Rust)

Code before:
                ])
                .get_steps()
                .render_with(RenderConfig {
                    normalize_host: true
                }), @r"
        [build] llvm <host>
        [build] rustc 0 <host> -> rustc 1 <host>
        [build] rustc 0 <host> -> RustInstaller 1 <host>
        [dist] docs <host>
        [dist] src <>
        ");
    }

    #[test]
    fn install_extended() {
        let ctx = TestCtx::new();
        insta::assert_snapshot!(
            ctx.config("install")
                .args(&[
                    // Using backslashes fails with `--set`
                    "--set", &format!("install.prefix={}", ctx.normalized_dir()),
                    "--set", &format!("install.bindir={}", ctx.normalized_dir()),
                    "--set", &format!("install.libdir={}", ctx.normalized_dir()),
                    "--set", &format!("install.datadir={}", ctx.normalized_dir()),
                    "--set", &format!("install.mandir={}", ctx.normalized_dir()),
                    "--set", &format!("install.sysconfdir={}", ctx.normalized_dir()),
                    "--set", "build.extended=true",
                    // For Cranelift to be disted
                    "--build", "x86_64-unknown-linux-gnu",
                    "--host", "x86_64-unknown-linux-gnu",
                ])
                .get_steps()
                .render_with(RenderConfig {
                    normalize_host: false
                }), @r"
        [build] llvm <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> rustc 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> WasmComponentLd 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> UnstableBookGen 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> Rustbook 1 <x86_64-unknown-linux-gnu>
        [doc] unstable-book (book) <x86_64-unknown-linux-gnu>
        [build] rustc 1 <x86_64-unknown-linux-gnu> -> std 1 <x86_64-unknown-linux-gnu>
        [doc] book (book) <x86_64-unknown-linux-gnu>
        [doc] book/first-edition (book) <x86_64-unknown-linux-gnu>
        [doc] book/second-edition (book) <x86_64-unknown-linux-gnu>
        [doc] book/2018-edition (book) <x86_64-unknown-linux-gnu>
        [build] rustdoc 1 <x86_64-unknown-linux-gnu>
        [doc] rustc 1 <x86_64-unknown-linux-gnu> -> standalone 2 <x86_64-unknown-linux-gnu>
        [doc] rustc 1 <x86_64-unknown-linux-gnu> -> std 1 <x86_64-unknown-linux-gnu> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
        [build] rustc 1 <x86_64-unknown-linux-gnu> -> rustc 2 <x86_64-unknown-linux-gnu>
        [build] rustc 1 <x86_64-unknown-linux-gnu> -> WasmComponentLd 2 <x86_64-unknown-linux-gnu>

Review comment (refactor):
Remark: drive-by change to cover all of the `install.*dirs` + extract the common dir normalization logic.

Code after:
                ])
                .get_steps()
                .render_with(RenderConfig {
                    normalize_host: false
                }), @r"
        [build] llvm <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> rustc 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> RustInstaller 1 <x86_64-unknown-linux-gnu>
        [dist] docs <x86_64-unknown-linux-gnu>
        [dist] src <>
        ");
    }

    #[test]
    fn install_extended() {
        let ctx = TestCtx::new();
        insta::assert_snapshot!(
            ctx.config("install")
                .args(&[
                    // Using backslashes fails with `--set`
                    "--set", &format!("install.prefix={}", ctx.normalized_dir()),
                    "--set", &format!("install.bindir={}", ctx.normalized_dir()),
                    "--set", &format!("install.libdir={}", ctx.normalized_dir()),
                    "--set", &format!("install.datadir={}", ctx.normalized_dir()),
                    "--set", &format!("install.mandir={}", ctx.normalized_dir()),
                    "--set", &format!("install.sysconfdir={}", ctx.normalized_dir()),
                    "--set", "build.extended=true",
                    // For Cranelift to be disted
                    "--build", "x86_64-unknown-linux-gnu",
                    "--host", "x86_64-unknown-linux-gnu",
                ])
                .get_steps()
                .render_with(RenderConfig {
                    normalize_host: false
                }), @r"
        [build] llvm <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> rustc 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> WasmComponentLd 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> UnstableBookGen 1 <x86_64-unknown-linux-gnu>
        [build] rustc 0 <x86_64-unknown-linux-gnu> -> Rustbook 1 <x86_64-unknown-linux-gnu>
        [doc] unstable-book (book) <x86_64-unknown-linux-gnu>
        [build] rustc 1 <x86_64-unknown-linux-gnu> -> std 1 <x86_64-unknown-linux-gnu>
        [doc] book (book) <x86_64-unknown-linux-gnu>
        [doc] book/first-edition (book) <x86_64-unknown-linux-gnu>
        [doc] book/second-edition (book) <x86_64-unknown-linux-gnu>
        [doc] book/2018-edition (book) <x86_64-unknown-linux-gnu>
        [build] rustdoc 1 <x86_64-unknown-linux-gnu>
        [doc] rustc 1 <x86_64-unknown-linux-gnu> -> standalone 2 <x86_64-unknown-linux-gnu>
        [doc] rustc 1 <x86_64-unknown-linux-gnu> -> std 1 <x86_64-unknown-linux-gnu> crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
        [build] rustc 1 <x86_64-unknown-linux-gnu> -> rustc 2 <x86_64-unknown-linux-gnu>
        [build] rustc 1 <x86_64-unknown-linux-gnu> -> WasmComponentLd 2 <x86_64-unknown-linux-gnu>