Skip to content

Test harness is injected on --cfg test #33670

Closed

Description

@alexcrichton

Cargo has an issue (rust-lang/cargo#2305) with a proposed fix (rust-lang/cargo#2469), but it unfortunately can't land because the compiler currently considers --test and --cfg test synonymous.

I'm... surprised by this behavior, and I'd expect --cfg test to only pass the test cfg.

Activity

  1. alexcrichton commented on May 16, 2016

    @alexcrichton
    MemberAuthor

    Ah, and the steps to reproduce:

    $ touch bar.rs
    $ rustc --cfg test bar.rs
    $ ./bar
    
    running 0 tests
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
    
    
  2. sanxiyn commented on May 17, 2016

    @sanxiyn
    Contributor

    I looked at the history. Originally, test harness was only injected for --test, not for --cfg test. Then b808eab (in 2012!) explicitly changed this, with comments (but without rationale...). Fix seems to be a matter of reverting that commit.

  3. added a commit that references this issue on May 28, 2016
    623af22
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