From b8e0e797e701f60bd975b3f8a295e1cb1a1de58c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 1 Sep 2023 17:04:44 +0200 Subject: bootstrap/format: remove unnecessary paths.push --- src/bootstrap/format.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index d658be0b8eb..11f2762f766 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -127,8 +127,6 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) { Err(_) => false, }; - let mut paths = paths.to_vec(); - if git_available { let in_working_tree = match build .config @@ -201,8 +199,6 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) { "WARN: Something went wrong when running git commands:\n{err}\n\ Falling back to formatting all files." ); - // Something went wrong when getting the version. Just format all the files. - paths.push(".".into()); } } } -- cgit 1.4.1-3-g733a5 From e0593f30fbaf8fdc05784ee90833596b2d659d9c Mon Sep 17 00:00:00 2001 From: Goldstein Date: Wed, 6 Sep 2023 10:14:09 +0300 Subject: fix log formatting in bootstrap --- src/bootstrap/lib.rs | 2 +- src/bootstrap/llvm.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 4396bbc51a3..671d25484d0 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1019,7 +1019,7 @@ impl Build { fn info(&self, msg: &str) { match self.config.dry_run { - DryRun::SelfCheck => return, + DryRun::SelfCheck => (), DryRun::Disabled | DryRun::UserSelected => { println!("{msg}"); } diff --git a/src/bootstrap/llvm.rs b/src/bootstrap/llvm.rs index 07502e0e9dd..aefed501513 100644 --- a/src/bootstrap/llvm.rs +++ b/src/bootstrap/llvm.rs @@ -598,9 +598,9 @@ fn configure_cmake( } else if target.contains("linux") { cfg.define("CMAKE_SYSTEM_NAME", "Linux"); } else { - builder.info( + builder.info(&format!( "could not determine CMAKE_SYSTEM_NAME from the target `{target}`, build may fail", - ); + )); } // When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in -- cgit 1.4.1-3-g733a5 From 45abd8caf2d596a520a8b712967aa19d799d002b Mon Sep 17 00:00:00 2001 From: LuuuX Date: Tue, 22 Aug 2023 15:15:00 +0800 Subject: Fix Issue 112009 modify fuction clond() -> cloned() optimize the code Handle the problem that the pathset is empty and modify the judgment of the builder::tests::test_exclude_kind Delete unnecessary judegment conditions skip test for library/std duo to OOM in benches as library/alloc Add FIXME for WASM32 --- src/bootstrap/builder.rs | 6 ++++-- src/bootstrap/builder/tests.rs | 4 ++-- src/ci/docker/host-x86_64/wasm32/Dockerfile | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index b3666192853..d28ac1a05f4 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -302,8 +302,10 @@ impl StepDescription { } } - fn maybe_run(&self, builder: &Builder<'_>, pathsets: Vec) { - if pathsets.iter().any(|set| self.is_excluded(builder, set)) { + fn maybe_run(&self, builder: &Builder<'_>, mut pathsets: Vec) { + pathsets.retain(|set| !self.is_excluded(builder, set)); + + if pathsets.is_empty() { return; } diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index 43b4a34fe5b..80e66622e8b 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -136,9 +136,9 @@ fn test_exclude_kind() { let mut config = configure("test", &["A"], &["A"]); // Ensure our test is valid, and `test::Rustc` would be run without the exclude. assert!(run_build(&[], config.clone()).contains::()); - // Ensure tests for rustc are skipped. + // Ensure tests for rustc are not skipped. config.skip = vec![path.clone()]; - assert!(!run_build(&[], config.clone()).contains::()); + assert!(run_build(&[], config.clone()).contains::()); // Ensure builds for rustc are not skipped. assert!(run_build(&[], config).contains::()); } diff --git a/src/ci/docker/host-x86_64/wasm32/Dockerfile b/src/ci/docker/host-x86_64/wasm32/Dockerfile index 02b4664eb55..0d0f1edd003 100644 --- a/src/ci/docker/host-x86_64/wasm32/Dockerfile +++ b/src/ci/docker/host-x86_64/wasm32/Dockerfile @@ -58,5 +58,6 @@ ENV NO_CHANGE_USER=1 RUN chown 10719 -R /emsdk-portable/ # Exclude library/alloc due to OOM in benches. +# FIXME: Fix std tests ENV SCRIPT python3 ../x.py test --stage 2 --host='' --target $TARGETS \ - --skip library/alloc + --skip library/alloc --skip library/std -- cgit 1.4.1-3-g733a5 From 238d8e3ec79bfc428cb60c64d88ad38bb38a1bd5 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 14 Feb 2023 19:39:39 +0000 Subject: Allow testing cg_clif using ./x.py test --- src/bootstrap/builder.rs | 1 + src/bootstrap/test.rs | 126 +++++++++++++++++++++++++++++++++++++++++++++++ src/ci/run.sh | 3 ++ 3 files changed, 130 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index c62548875bf..91fa5ec6633 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -737,6 +737,7 @@ impl<'a> Builder<'a> { test::Incremental, test::Debuginfo, test::UiFullDeps, + test::CodegenCranelift, test::Rustdoc, test::RunCoverageRustdoc, test::Pretty, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index d78e0deda69..35e2e98e08e 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -2967,3 +2967,129 @@ impl Step for TestHelpers { .compile("rust_test_helpers"); } } + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct CodegenCranelift { + compiler: Compiler, + target: TargetSelection, +} + +impl Step for CodegenCranelift { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.paths(&["compiler/rustc_codegen_cranelift"]) + } + + fn make_run(run: RunConfig<'_>) { + let builder = run.builder; + let host = run.build_triple(); + let compiler = run.builder.compiler_for(run.builder.top_stage, host, host); + + if builder.doc_tests == DocTests::Only { + return; + } + + let triple = run.target.triple; + let target_supported = if triple.contains("linux") { + triple.contains("x86_64") || triple.contains("aarch64") || triple.contains("s390x") + } else if triple.contains("darwin") || triple.contains("windows") { + triple.contains("x86_64") + } else { + false + }; + if !target_supported { + builder.info("target not supported by rustc_codegen_cranelift. skipping"); + return; + } + + if builder.remote_tested(run.target) { + builder.info("remote testing is not supported by rustc_codegen_cranelift. skipping"); + return; + } + + if !builder.config.rust_codegen_backends.contains(&INTERNER.intern_str("cranelift")) { + builder.info("cranelift not in rust.codegen-backends. skipping"); + return; + } + + builder.ensure(CodegenCranelift { compiler, target: run.target }); + } + + fn run(self, builder: &Builder<'_>) { + let compiler = self.compiler; + let target = self.target; + + builder.ensure(compile::Std::new(compiler, target)); + + // If we're not doing a full bootstrap but we're testing a stage2 + // version of libstd, then what we're actually testing is the libstd + // produced in stage1. Reflect that here by updating the compiler that + // we're working with automatically. + let compiler = builder.compiler_for(compiler.stage, compiler.host, target); + + let build_cargo = || { + let mut cargo = builder.cargo( + compiler, + Mode::Codegen, // Must be codegen to ensure dlopen on compiled dylibs works + SourceType::InTree, + target, + "run", + ); + cargo.current_dir(&builder.src.join("compiler/rustc_codegen_cranelift")); + cargo + .arg("--manifest-path") + .arg(builder.src.join("compiler/rustc_codegen_cranelift/build_system/Cargo.toml")); + compile::rustc_cargo_env(builder, &mut cargo, target, compiler.stage); + + // Avoid incremental cache issues when changing rustc + cargo.env("CARGO_BUILD_INCREMENTAL", "false"); + + cargo + }; + + builder.info(&format!( + "{} cranelift stage{} ({} -> {})", + Kind::Test.description(), + compiler.stage, + &compiler.host, + target + )); + let _time = util::timeit(&builder); + + // FIXME handle vendoring for source tarballs before removing the --skip-test below + let download_dir = builder.out.join("cg_clif_download"); + + /* + let mut prepare_cargo = build_cargo(); + prepare_cargo.arg("--").arg("prepare").arg("--download-dir").arg(&download_dir); + #[allow(deprecated)] + builder.config.try_run(&mut prepare_cargo.into()).unwrap(); + */ + + let mut cargo = build_cargo(); + cargo + .arg("--") + .arg("test") + .arg("--download-dir") + .arg(&download_dir) + .arg("--out-dir") + .arg(builder.stage_out(compiler, Mode::ToolRustc).join("cg_clif")) + .arg("--no-unstable-features") + .arg("--use-backend") + .arg("cranelift") + // Avoid having to vendor the standard library dependencies + .arg("--sysroot") + .arg("llvm") + // These tests depend on crates that are not yet vendored + // FIXME remove once vendoring is handled + .arg("--skip-test") + .arg("testsuite.extended_sysroot"); + cargo.args(builder.config.test_args()); + + #[allow(deprecated)] + builder.config.try_run(&mut cargo.into()).unwrap(); + } +} diff --git a/src/ci/run.sh b/src/ci/run.sh index b8cb758bf40..98f2cdac5dc 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -123,6 +123,9 @@ else RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.verify-llvm-ir" + # Test the Cranelift backend in on CI, but don't ship it. + RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.codegen-backends=llvm,cranelift" + # We enable this for non-dist builders, since those aren't trying to produce # fresh binaries. We currently don't entirely support distributing a fresh # copy of the compiler (including llvm tools, etc.) if we haven't actually -- cgit 1.4.1-3-g733a5