-
Notifications
You must be signed in to change notification settings - Fork 14k
Add test for --test-builder success path #148608
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
Open
osamakader
wants to merge
4
commits into
rust-lang:master
Choose a base branch
from
osamakader:doc-test-builder
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8075c98
Add test for success path
osamakader 09385f9
use bare_rustc to keep host toolchain
osamakader 1c1923f
tests: skip rustdoc test-builder success path when cross-compiling
osamakader f1bbe59
tests: skip rustdoc test-builder success path for remote client
osamakader File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| use std::ffi::OsString; | ||
| use std::path::PathBuf; | ||
| use std::process::{self, Command}; | ||
| use std::{env, fs}; | ||
|
|
||
| fn main() { | ||
| let args: Vec<OsString> = env::args_os().collect(); | ||
| let log_path = env::var_os("BUILDER_LOG").map(PathBuf::from).expect("BUILDER_LOG must be set"); | ||
| let real_rustc = env::var_os("REAL_RUSTC").expect("REAL_RUSTC must be set"); | ||
|
|
||
| let log_contents = | ||
| args.iter().skip(1).map(|arg| arg.to_string_lossy()).collect::<Vec<_>>().join("\n"); | ||
| fs::write(&log_path, log_contents).expect("failed to write builder log"); | ||
|
|
||
| let status = Command::new(real_rustc) | ||
| .args(args.iter().skip(1)) | ||
| .status() | ||
| .expect("failed to invoke real rustc"); | ||
|
|
||
| if !status.success() { | ||
| process::exit(status.code().unwrap_or(1)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| //! ```rust | ||
| //! assert_eq!(2 + 2, 4); | ||
| //! ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: sorry I didn't look at this, but this should instead use
//@ ignore-wasmor//@ ignore-cross-compile(if this is host-only), otherwise this will show as test pass on WASM but in reality nothing is checked. Since this is in a rollup, it can be done as a follow-up.(Also, there is a
run_make_support::target()helper for what you're doing here.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jieyouxu. I’d actually prefer to keep the test running on wasm: the failing-path check (non-executable builder should error without panicking) still runs there, so the test isn’t a no-op even after we skip the success branch. I’ll switch the guard to use run_make_support::target() for clarity in a followup PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added that to this PR since there was a link error in the rollup tests (fixed too).