Browse Source

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.
pull/3534/head
Chris Fallin 3 years ago
parent
commit
6a4716f0f4
  1. 2
      .github/workflows/main.yml
  2. 4
      cranelift/codegen/Cargo.toml
  3. 15
      cranelift/codegen/build.rs

2
.github/workflows/main.yml

@ -400,7 +400,7 @@ jobs:
submodules: true
- name: Install Rust
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
# Perform release builds of `wasmtime` and `libwasmtime.so`. Builds on

4
cranelift/codegen/Cargo.toml

@ -104,6 +104,10 @@ souper-harvest = ["souper-ir", "souper-ir/stringify"]
# Recompile ISLE DSL source files into their generated Rust code.
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]
maintenance = { status = "experimental" }

15
cranelift/codegen/build.rs

@ -78,7 +78,17 @@ fn main() {
.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 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())?;
// 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()?;
if manifest != expected_manifest {
rebuild_compilations.push((compilation, expected_manifest));

Loading…
Cancel
Save