Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo2junit will stop working with Rust 1.70 #79

Open
jstarks opened this issue Apr 22, 2023 · 11 comments
Open

cargo2junit will stop working with Rust 1.70 #79

jstarks opened this issue Apr 22, 2023 · 11 comments

Comments

@jstarks
Copy link

jstarks commented Apr 22, 2023

The Rust libs team quietly decided to start blocking -Zunstable-options in Rust 1.70 outside of nightly builds. Rust 1.70 is now in beta.

rust-lang/rust#109044

$ cargo +beta test -- -Zunstable-options --format json
    Finished test [unoptimized + debuginfo] target(s) in 0.22s
     Running unittests src/lib.rs ([removed])
error: the option `Z` is only accepted on the nightly compiler
error: test failed, to rerun pass `--lib`

Arguably cargo2unit users were playing with fire by taking a dependency on this... but nonetheless this will strand users on 1.69 who depend on JSON output in their CI builds.

Luckily, it seems that setting RUSTC_BOOTSTRAP=1 in the environment before launching the test will work around this. This seems strictly worse than the status quo since it allows other Rust unstable features to be used as well. Oh well.

Perhaps the README should be updated to reflect this.

@mati865
Copy link

mati865 commented Apr 26, 2023

The Rust libs team quietly decided to start blocking -Zunstable-options in Rust 1.70 outside of nightly builds. Rust 1.70 is now in beta.

It's not like they did it for fun, they have fixed long standing issue that cargo2junit has been relying on:rust-lang/rust#75526
Sure it could been better announced but I think the author had not expected the fallout.

Note: I'm not a team member, just wasn't happy with tone of that message.

@jstarks
Copy link
Author

jstarks commented Jun 2, 2023

The tone was intentional. They could have chosen any number of alternatives. They made the choice to break users.

@marmeladema
Copy link

For what it's worth, I have replaced cargo2junit with nextest with great success: https://nexte.st/book/junit.html

@aseure
Copy link

aseure commented Jun 6, 2023

Thanks @marmeladema, I'll take a look.

@BratSinot
Copy link

The tone was intentional. They could have chosen any number of alternatives. They made the choice to break users.

You still can use RUSTC_BOOTSTRAP=1 cargo test with same result.

infogulch added a commit to infogulch/scryer-prolog that referenced this issue Jun 23, 2023
@infogulch
Copy link

This is the tracking issue for the unstable option --format json: rust-lang/rust#49359

@johnterickson
Copy link
Owner

Sorry for the radio silence - I'm a little confused here - does stable rust now have no structured logging for cargo test? I always knew it would break, but I had assumed it wouldn't break until it was replaced with something. I am open to suggestions.

@infogulch
Copy link

infogulch commented Aug 15, 2023

@detly
Copy link

detly commented Aug 15, 2023

does stable rust now have no structured logging for cargo test?

Correct.

I had assumed it wouldn't break until it was replaced with something

Incorrect 😉

To be fair to the devs, it wasn't so much "let's break this specific thing here even though there's no replacement", it was about closing an inconsistency with the command line arguments that incidentally affected this.

OTOH, a couple of them have been a bit derisive about the fact that people relied on this, even though it met a need that's fairly widespread but unmet by anything else official, and there's not a solid "laundry list" of things needed to get it stabilised (although there's this). Meanwhile, the real goal, jUnit XML output, seems fundamentally incompatible with libtest's current architecture (not in the sense it could never happen, but in that it could be a surprising amount of work to achieve).

I am open to suggestions.

(Suggestions from someone who has time to summarise this stuff because I already did it for colleagues anyway, but not time to actually help with the suggestions?)

  • Straight up jUnit support seems much, much harder than stabilising the JSON format itself, so have a crack at the JSON stabilisation?
  • Nextest might be a suitable replacement for a lot of people, you could suggest that as an easy path for current users and see what issues remain for anyone who doesn't migrate?

Either way, thanks for your work on this so far, it made adoption of Rust in an existing project that much more smooth.

@detly
Copy link

detly commented Aug 15, 2023

This project is using cargo2junit with the unstable option, which seems to work fine on 1.71:

This is using RUSTC_BOOTSTRAP=1 to enable unstable features, which is not practically different from just running cargo +nightly test ... -- -Z unstable-options --format json on the nightly toolchain matching your preferred stable version (except that you don't have to go hunting for which nightly toolchain matches your preferred stable version).

@infogulch
Copy link

infogulch commented Aug 15, 2023

Yes, thank you for clarifying.

Though I'd like to note that this project only does this on the specific call to cargo test, not any of the other cargo or rustc invocations in that pipeline. By that I mean it's possible to use this hacky workaround (tbf that's what it is) on just this cargo test invocation, without using it on any other invocations, including building. Whether that is a tolerable difference between build and test in your pipeline is up to you of course.

bbarker pushed a commit to bbarker/rust-gitlab that referenced this issue Oct 18, 2023
Rust 1.70 finally stopped allowing `cargo test -- -Z unstable-options`
which is required by `cargo2junit` to work. Instead, use `cargo nextest`
to drive the tests in CI.

See: johnterickson/cargo2junit#79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants