Two CI fixes: Windows line-endings in manifest file, and "meta deterministic check".
- The Windows line-ending canonicalization was incomplete: we need to canonicalize the manifest text itself too! - The "meta deterministic check" runs the cranelift-codegen build script N times outside of the source tree, examining what it produces to ensure the output is always the same (is detministic). This works fine when everything comes from the internal DSL, but when reading ISLE, this breaks because we no longer have the ISLE source paths. The initial ISLE integration did not hit this because without the `rebuild-isle` feature, it simply did nothing in the build script; now, with the manifest check, we hit the issue. The fix for now is just to turn off all ISLE-specific behavior in the build script by setting a special-purpose Cargo feature in the specific CI job. Eventually IMHO we should remove or find a better way to do this check.
This commit is contained in:
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -400,7 +400,7 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: rustup update stable && rustup default stable
|
run: rustup update stable && rustup default stable
|
||||||
- run: cd cranelift/codegen && cargo build --features all-arch
|
- run: cd cranelift/codegen && cargo build --features "all-arch completely-skip-isle-for-ci-deterministic-check"
|
||||||
- run: ci/ensure_deterministic_build.sh
|
- run: ci/ensure_deterministic_build.sh
|
||||||
|
|
||||||
# Perform release builds of `wasmtime` and `libwasmtime.so`. Builds on
|
# Perform release builds of `wasmtime` and `libwasmtime.so`. Builds on
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ souper-harvest = ["souper-ir", "souper-ir/stringify"]
|
|||||||
# Recompile ISLE DSL source files into their generated Rust code.
|
# Recompile ISLE DSL source files into their generated Rust code.
|
||||||
rebuild-isle = ["isle", "cranelift-codegen-meta/rebuild-isle"]
|
rebuild-isle = ["isle", "cranelift-codegen-meta/rebuild-isle"]
|
||||||
|
|
||||||
|
# A hack to skip the ISLE-rebuild logic when testing for determinism
|
||||||
|
# with the "Meta deterministic check" CI job.
|
||||||
|
completely-skip-isle-for-ci-deterministic-check = []
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "experimental" }
|
maintenance = { status = "experimental" }
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,17 @@ fn main() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_rebuild_isle(crate_dir).expect("Unhandled failure in ISLE rebuild");
|
// The "Meta deterministic check" CI job runs this build script N
|
||||||
|
// times to ensure it produces the same output
|
||||||
|
// consistently. However, it runs the script in a fresh directory,
|
||||||
|
// without any of the source tree present; this breaks our
|
||||||
|
// manifest check (we need the ISLE source to be present). To keep
|
||||||
|
// things simple, we just disable all ISLE-related logic for this
|
||||||
|
// specific CI job.
|
||||||
|
#[cfg(not(feature = "completely-skip-isle-for-ci-deterministic-check"))]
|
||||||
|
{
|
||||||
|
maybe_rebuild_isle(crate_dir).expect("Unhandled failure in ISLE rebuild");
|
||||||
|
}
|
||||||
|
|
||||||
let pkg_version = env::var("CARGO_PKG_VERSION").unwrap();
|
let pkg_version = env::var("CARGO_PKG_VERSION").unwrap();
|
||||||
let mut cmd = std::process::Command::new("git");
|
let mut cmd = std::process::Command::new("git");
|
||||||
@@ -259,6 +269,9 @@ fn maybe_rebuild_isle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let manifest = std::fs::read_to_string(compilation.manifest_filename())?;
|
let manifest = std::fs::read_to_string(compilation.manifest_filename())?;
|
||||||
|
// Canonicalize Windows line-endings into Unix line-endings in
|
||||||
|
// the manifest text itself.
|
||||||
|
let manifest = manifest.replace("\r\n", "\n");
|
||||||
let expected_manifest = compilation.compute_manifest()?;
|
let expected_manifest = compilation.compute_manifest()?;
|
||||||
if manifest != expected_manifest {
|
if manifest != expected_manifest {
|
||||||
rebuild_compilations.push((compilation, expected_manifest));
|
rebuild_compilations.push((compilation, expected_manifest));
|
||||||
|
|||||||
Reference in New Issue
Block a user