diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2020-11-02 19:14:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-02 19:14:50 +0100 |
| commit | 03f01bbe901d60b71cf2c5ec766aef5e532ab79d (patch) | |
| tree | f766b683ac06d5d9cc912e1d59a4875693403e3f | |
| parent | 646b00ff7710fb9f8a1a6de744f38bdcb1c932d7 (diff) | |
| parent | 54b1d101efec3da791aee1f98fb26230e88b9a05 (diff) | |
| download | rust-03f01bbe901d60b71cf2c5ec766aef5e532ab79d.tar.gz rust-03f01bbe901d60b71cf2c5ec766aef5e532ab79d.zip | |
Merge pull request #1105 from bjorn3/test_rustc_bootstrapping
Test bootstrapping of rustc using cg_clif
| -rw-r--r-- | .github/workflows/bootstrap_rustc.yml | 44 | ||||
| -rwxr-xr-x | scripts/test_bootstrap.sh | 65 | ||||
| -rw-r--r-- | src/bin/cg_clif.rs | 12 |
3 files changed, 116 insertions, 5 deletions
diff --git a/.github/workflows/bootstrap_rustc.yml b/.github/workflows/bootstrap_rustc.yml new file mode 100644 index 00000000000..8c94a0aa5e6 --- /dev/null +++ b/.github/workflows/bootstrap_rustc.yml @@ -0,0 +1,44 @@ +name: Bootstrap rustc using cg_clif + +on: + - push + +jobs: + bootstrap_rustc: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache cargo installed crates + uses: actions/cache@v2 + with: + path: ~/.cargo/bin + key: ${{ runner.os }}-cargo-installed-crates + + - name: Cache cargo registry and index + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo target dir + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }} + + - name: Prepare dependencies + run: | + git config --global user.email "user@example.com" + git config --global user.name "User" + ./prepare.sh + + - name: Test + run: | + # Enable backtraces for easier debugging + export RUST_BACKTRACE=1 + + ./scripts/test_bootstrap.sh diff --git a/scripts/test_bootstrap.sh b/scripts/test_bootstrap.sh new file mode 100755 index 00000000000..7f43f81a6cd --- /dev/null +++ b/scripts/test_bootstrap.sh @@ -0,0 +1,65 @@ +#!/bin/bash +set -e + +cd $(dirname "$0")/../ + +./build.sh +source build/config.sh + +echo "[TEST] Bootstrap of rustc" +git clone https://github.com/rust-lang/rust.git || true +pushd rust +git fetch +git checkout -- . +git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') + +git apply - <<EOF +diff --git a/.gitmodules b/.gitmodules +index 984113151de..c1e9d960d56 100644 +--- a/.gitmodules ++++ b/.gitmodules +@@ -34,10 +34,6 @@ + [submodule "src/doc/edition-guide"] + path = src/doc/edition-guide + url = https://github.com/rust-lang/edition-guide.git +-[submodule "src/llvm-project"] +- path = src/llvm-project +- url = https://github.com/rust-lang/llvm-project.git +- branch = rustc/11.0-2020-10-12 + [submodule "src/doc/embedded-book"] + path = src/doc/embedded-book + url = https://github.com/rust-embedded/book.git +diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml +index 23e689fcae7..5f077b765b6 100644 +--- a/compiler/rustc_data_structures/Cargo.toml ++++ b/compiler/rustc_data_structures/Cargo.toml +@@ -32,7 +32,6 @@ tempfile = "3.0.5" + + [dependencies.parking_lot] + version = "0.11" +-features = ["nightly"] + + [target.'cfg(windows)'.dependencies] + winapi = { version = "0.3", features = ["fileapi", "psapi"] } +EOF + +cat > config.toml <<EOF +[llvm] +ninja = false + +[build] +rustc = "$(pwd)/../build/cg_clif" +cargo = "$(rustup which cargo)" +full-bootstrap = true +local-rebuild = true + +[rust] +codegen-backends = ["cranelift"] +EOF + +rm -r compiler/rustc_codegen_cranelift/{Cargo.*,src} +cp ../Cargo.* compiler/rustc_codegen_cranelift/ +cp -r ../src compiler/rustc_codegen_cranelift/src + +./x.py build --stage 1 library/std +popd diff --git a/src/bin/cg_clif.rs b/src/bin/cg_clif.rs index 6253022ade2..71ef4d22673 100644 --- a/src/bin/cg_clif.rs +++ b/src/bin/cg_clif.rs @@ -27,11 +27,13 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks { config.opts.cg.panic = Some(PanicStrategy::Abort); config.opts.debugging_opts.panic_abort_tests = true; config.opts.maybe_sysroot = Some( - std::env::current_exe() - .unwrap() - .parent() - .unwrap() - .join("sysroot"), + config.opts.maybe_sysroot.clone().unwrap_or( + std::env::current_exe() + .unwrap() + .parent() + .unwrap() + .join("sysroot"), + ), ); } } |
