c2rust icon indicating copy to clipboard operation
c2rust copied to clipboard

Added an `analysis/test` snapshot test for `--release`

Open kkysen opened this issue 3 years ago • 1 comments

kkysen avatar Aug 23 '22 05:08 kkysen

  1. It appears cargo add has race conditions:

CI

running 2 tests
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on build directory
    Finished release [optimized] target(s) in 0.15s
     Running `target/release/c2rust-instrument --metadata /__w/1/s/analysis/test/instrument.target/debug/metadata.bc --set-runtime --runtime-path /__w/1/s/analysis/runtime -- run --manifest-path /__w/1/s/analysis/test/Cargo.toml --profile dev`
    Finished release [optimized] target(s) in 0.16s
     Running `target/release/c2rust-instrument --metadata /__w/1/s/analysis/test/instrument.target/release/metadata.bc --set-runtime --runtime-path /__w/1/s/analysis/runtime -- run --manifest-path /__w/1/s/analysis/test/Cargo.toml --profile release`
      Adding      Adding c2rust-analysis-rt (local) to optional dependencies.
 c2rust-analysis-rt (local) to optional dependencies.
error: failed to parse manifest at `/__w/1/s/analysis/test/Cargo.toml`

Caused by:
  virtual manifests must be configured with [workspace]
error running: "/home/docker/.rustup/toolchains/nightly-2022-08-08-x86_64-unknown-linux-gnu/bin/cargo" "add" "--optional" "c2rust-analysis-rt" "--offline" "--path" "/__w/1/s/analysis/runtime" "--manifest-path" "/__w/1/s/analysis/test/Cargo.toml"
Error: "cargo" "run" "--bin" "c2rust-instrument" "--profile" "release" "--" "--metadata" "/__w/1/s/analysis/test/instrument.target/release/metadata.bc" "--set-runtime" "--runtime-path" "/__w/1/s/analysis/runtime" "--" "run" "--manifest-path" "/__w/1/s/analysis/test/Cargo.toml" "--profile" "release" failed: exit status: 101

Using strace, cargo add reads the Cargo.toml manifest many, many times, causing race conditions even if the file is never written to.

  1. It appears that with the addition of the --release snapshot, CI almost always fails (except for Darwin). More specifically, all but Darwin CI has failed for 3 runs. 1 failure was the cargo add race condition.

kkysen avatar Aug 23 '22 08:08 kkysen

It has now been rebased to master after merging #683 and #691 to fix #613. It works locally without race conditions after running it 100s of times. Let's see if CI works, too, or if the cargo add race condition needs fixing/working around/disabling.

kkysen avatar Oct 16 '22 17:10 kkysen

CI seems to work fine, so I'll merge this now.

kkysen avatar Oct 16 '22 18:10 kkysen