Run e2e test for release build and fix it by switching back to stable (#818)

* Run e2e-tests for release build
* Print `RUSTFLAGS` for justfile target build & check
* Fix CI: Disable miropt level 4
* Fix CI: Disable -Zbuild-std
* Disable `-Zgcc-ld=lld` and `-Zshare-generics` so that we can switch back to stable

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-02-28 22:53:57 +11:00 committed by GitHub
parent 5b70e41966
commit 2bf70b6a01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 17 deletions

View file

@ -55,7 +55,7 @@ jobs:
- name: Ensure release binary is runnable - name: Ensure release binary is runnable
if: "matrix.r" if: "matrix.r"
run: ./target/${{ matrix.t }}/release/cargo-binstall -V run: just e2e-tests
- if: inputs.publish - if: inputs.publish
name: Upload to release name: Upload to release

View file

@ -38,7 +38,7 @@ output-folder := if target != target-host { "target" / target / output-profile-f
output-path := output-folder / output-filename output-path := output-folder / output-filename
# which tool to use for compiling # which tool to use for compiling
cargo-bin := if use-cargo-zigbuild != "" { "cargo-zigbuild" } else if use-cross != "" { "cross" } else { "cargo +nightly" } cargo-bin := if use-cargo-zigbuild != "" { "cargo-zigbuild" } else if use-cross != "" { "cross" } else { "cargo" }
# cargo compile options # cargo compile options
cargo-profile := if for-release != "" { "release" } else { "dev" } cargo-profile := if for-release != "" { "release" } else { "dev" }
@ -48,9 +48,9 @@ ci-or-no := if ci != "" { "ci" } else { "noci" }
# In release builds in CI, build the std library ourselves so it uses our # In release builds in CI, build the std library ourselves so it uses our
# compile profile, and optimise panic messages out with immediate abort. # compile profile, and optimise panic messages out with immediate abort.
cargo-buildstd := if (cargo-profile / ci-or-no) == "release/ci" { cargo-buildstd := "" #if (cargo-profile / ci-or-no) == "release/ci" {
" -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort" #" -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort"
} else { "" } #} else { "" }
# In musl release builds in CI, statically link gcclibs. # In musl release builds in CI, statically link gcclibs.
rustc-gcclibs := if (cargo-profile / ci-or-no / target-libc) == "release/ci/musl" { rustc-gcclibs := if (cargo-profile / ci-or-no / target-libc) == "release/ci/musl" {
@ -82,7 +82,8 @@ cargo-split-debuginfo := if cargo-buildstd != "" { " --config='profile.release.s
win-arm64-ring16 := if target == "aarch64-pc-windows-msvc" { " --config='patch.crates-io.ring.git=\"https://github.com/awakecoding/ring\"' --config='patch.crates-io.ring.branch=\"0.16.20_alpha\"'" } else { "" } win-arm64-ring16 := if target == "aarch64-pc-windows-msvc" { " --config='patch.crates-io.ring.git=\"https://github.com/awakecoding/ring\"' --config='patch.crates-io.ring.branch=\"0.16.20_alpha\"'" } else { "" }
# MIR optimisation level (defaults to 2, bring it up to 4 for release builds) # MIR optimisation level (defaults to 2, bring it up to 4 for release builds)
rustc-miropt := if for-release != "" { " -Z mir-opt-level=4" } else { "" } # **DISABLED because it's buggy**
rustc-miropt := "" # if for-release != "" { " -Z mir-opt-level=4" } else { "" }
# Use rust-lld that is bundled with rustup to speedup linking # Use rust-lld that is bundled with rustup to speedup linking
# and support for icf=safe. # and support for icf=safe.
@ -95,13 +96,13 @@ rustc-miropt := if for-release != "" { " -Z mir-opt-level=4" } else { "" }
# #
# If cargo-zigbuild is used, then it will provide the lld linker. # If cargo-zigbuild is used, then it will provide the lld linker.
# This option is disabled on windows since it not supported. # This option is disabled on windows since it not supported.
rust-lld := if use-cargo-zigbuild != "" { rust-lld := "" #if use-cargo-zigbuild != "" {
"" #""
} else if target-os != "windows" { #} else if target-os != "windows" {
" -Z gcc-ld=lld" #" -Z gcc-ld=lld"
} else { #} else {
"" #""
} #}
# ICF: link-time identical code folding # ICF: link-time identical code folding
# #
@ -130,7 +131,7 @@ target-glibc-ver-postfix := if glibc-version != "" {
} }
cargo-build-args := (if for-release != "" { " --release" } else { "" }) + (" --target ") + (target) + (target-glibc-ver-postfix) + (cargo-buildstd) + (if extra-build-args != "" { " " + extra-build-args } else { "" }) + (cargo-no-default-features) + (cargo-split-debuginfo) + (if cargo-features != "" { " --features " + cargo-features } else { "" }) + (win-arm64-ring16) cargo-build-args := (if for-release != "" { " --release" } else { "" }) + (" --target ") + (target) + (target-glibc-ver-postfix) + (cargo-buildstd) + (if extra-build-args != "" { " " + extra-build-args } else { "" }) + (cargo-no-default-features) + (cargo-split-debuginfo) + (if cargo-features != "" { " --features " + cargo-features } else { "" }) + (win-arm64-ring16)
export RUSTFLAGS := "-Z share-generics " + (linker-plugin-lto) + (rustc-gcclibs) + (rustc-miropt) + (rust-lld) + (rustc-icf) export RUSTFLAGS := (linker-plugin-lto) + (rustc-gcclibs) + (rustc-miropt) + (rust-lld) + (rustc-icf)
# libblocksruntime-dev provides compiler-rt # libblocksruntime-dev provides compiler-rt
@ -147,15 +148,17 @@ ci-install-deps:
ci-install-deps: ci-install-deps:
toolchain components="": toolchain components="":
rustup toolchain install nightly {{ if components != "" { "--component " + components } else { "" } }} --no-self-update --profile minimal rustup toolchain install stable {{ if components != "" { "--component " + components } else { "" } }} --no-self-update --profile minimal
{{ if ci != "" { "rustup default nightly" } else { "rustup override set nightly" } }} {{ if ci != "" { "rustup default stable" } else { "rustup override set stable" } }}
{{ if target != "" { "rustup target add " + target } else { "" } }} {{ if target != "" { "rustup target add " + target } else { "" } }}
build: build:
echo "env RUSTFLAGS=$RUSTFLAGS"
{{cargo-bin}} build {{cargo-build-args}} {{cargo-bin}} build {{cargo-build-args}}
check: check:
echo "env RUSTFLAGS=$RUSTFLAGS"
{{cargo-bin}} check {{cargo-build-args}} {{cargo-bin}} check {{cargo-build-args}}
get-output file outdir=".": get-output file outdir=".":
@ -167,7 +170,7 @@ get-binary outdir=".": (get-output output-filename outdir)
-chmod +x {{ outdir / output-filename }} -chmod +x {{ outdir / output-filename }}
e2e-test file *arguments: (get-binary "e2e-tests") e2e-test file *arguments: (get-binary "e2e-tests")
cd e2e-tests && bash {{file}}.sh {{output-filename}} {{arguments}} cd e2e-tests && env -u RUSTFLAGS bash {{file}}.sh {{output-filename}} {{arguments}}
e2e-test-live: (e2e-test "live") e2e-test-live: (e2e-test "live")
e2e-test-manifest-path: (e2e-test "manifest-path") e2e-test-manifest-path: (e2e-test "manifest-path")