Skip to content

Workload runner can execute a stale Rust benchmark with a shared Cargo target #4894

Backlog

Description

@quddnr0107-lgtm

Submitting this runner fix for the useful-improvements bounty track. Verified on main at 4a0110a.

The project’s tools/env.sh sets CARGO_TARGET_DIR to a shared directory. Cargo builds the Rust workload there, but benchmarks/workloads/run.sh then executes ./target/release/workloads under the crate. With a clean crate-local target the runner returned exit 127. With an old executable at that path, it ran the old executable and reported success. This can mix timings from different revisions in the same comparison.

The patch uses cargo run --release --quiet so Cargo launches the binary it just built. Both new regressions failed on the base commit. After the fix all 25 workload tests passed locally with python3 -m unittest discover -s tools -p 'test_workload*.py'. They exercise the actual shell runner with temporary toolchain substitutes. Shell syntax and git diff --check passed. The pinned compiler suite and hosted CI have not been run.

Runner change

- (cd rust && cargo build --release --quiet && ./target/release/workloads)
+ (cd rust && cargo run --release --quiet)

Minimal independent reproduction

Run this in a throwaway checkout with Cargo installed. It uses a temporary copy of the benchmark crate.

tmp=$(mktemp -d)
mkdir "$tmp/crate"
cp -R benchmarks/workloads/rust/src benchmarks/workloads/rust/Cargo.toml "$tmp/crate/"
(
  cd "$tmp/crate" || exit 1
  export CARGO_TARGET_DIR="$tmp/shared target"
  cargo build --release --quiet || exit 1
  test -x "$CARGO_TARGET_DIR/release/workloads" || exit 1
  ./target/release/workloads  # old launch path: missing
  mkdir -p target/release
  printf '%s\n' '#!/bin/sh' 'echo obsolete-benchmark' > target/release/workloads
  chmod +x target/release/workloads
  ./target/release/workloads  # old launch path: prints obsolete-benchmark and succeeds
  cargo run --release --quiet  # fixed launch: runs the actual Rust workload
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions