terraphim / terraphim/md-book

How the binary under test is looked up relies on internals of Cargo and will break with existing / upcoming features

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Tests assumes the location of the [[bin]] based on the location of a [[test]]

You can reproduce this by running either:

$ cargo +nightly test -Zbuild-dir-new-layout
$ CARGO_BUILD_BUILD_DIR=build cargo test

In Cargo 1.94, CARGO_BIN_EXE_* was stabilized for use at runtime, , see assert_cmd::cargo::cargo_bin for an example which supports both old and new Cargo versions.

Libraries that provide this look up as an API include:

Common other problems to watch for:

  • Mixing this with old versions of the libraries listed above that also need updating
  • Doing this lookup during unit tests when the binary is only guaranteed to be around for integration tests (and CARGO_BIN_EXE_* is only exposed to them)

This problem was identified by the following crater run: https://github.com/rust-lang/rust/pull/149852

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the test code for logic that derives a [[bin]] location from a [[test]], then reproduce the issue with cargo +nightly test -Zbuild-dir-new-layout and CARGO_BUILD_BUILD_DIR=build cargo test. Compare the lookup with assert_cmd::cargo::cargo_bin and account for integration-test-only availability. Done means the tests locate the binary across the described Cargo layouts without relying on Cargo internals.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.