-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Error when testing with x.py #112273
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
Comments
@MoskalykA can you add some more context? there should be output printed before this panic, what does it say? what commit are you testing? |
I'd like to contribute to Rust so I'm first trying to understand and try the tests from x.py, I haven't made any changes, I just cloned the repo then did an x.py setup then this command
|
ok, great! now we need to find which of the tests are causing the "Microsoft Windows [version 10.0.22621.1778]" output - can you run |
|
hmm, that doesn't show the test that panicked. try adding |
still the same thing, earlier today I had a theory, I thought it had nothing to do with tests but more a story of utf-8 and console |
right, I understand it's still panicking, but I'm trying to find what's causing it to panic. alternatively, you could try making this change to bootstrap to have it print the thing it couldn't parse: diff --git a/src/bootstrap/render_tests.rs b/src/bootstrap/render_tests.rs
index 872b75f6c15..932fa7d93d7 100644
--- a/src/bootstrap/render_tests.rs
+++ b/src/bootstrap/render_tests.rs
@@ -88,10 +88,10 @@ fn new(stdout: ChildStdout, builder: &'a Builder<'a>) -> Self {
}
fn render_all(mut self) {
- let mut line = String::new();
+ let mut line = Vec::new();
loop {
line.clear();
- match self.stdout.read_line(&mut line) {
+ match self.stdout.read_until(b'\n', &mut line) {
Ok(_) => {}
Err(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break,
Err(err) => panic!("failed to read output of test runner: {err}"),
@@ -100,11 +100,11 @@ fn render_all(mut self) {
break;
}
- match serde_json::from_str(&line) {
+ match serde_json::from_slice(&line) {
Ok(parsed) => self.render_message(parsed),
Err(_err) => {
// Handle non-JSON output, for example when --nocapture is passed.
- print!("{line}");
+ print!("{}", String::from_utf8_lossy(&line));
let _ = std::io::stdout().flush();
}
} you can paste that into |
I'm not sure what to copy, is that enough?
|
is that with |
It's with this line, but I don't know where to start copying the 20 lines, I don't have any more crashes? |
I started from the last line where I was
|
hmm, this runs |
can you post the output of |
|
hmm ok, but you don't see the "Microsoft Windows [version 10.0.22621.1778]" from cc @ChrisDenton, do you have ideas what could be going wrong here? @MoskalykA is using a french locale and that's making one of the tests emit non-utf8 on Windows for some reason. |
When I launch a terminal, I get "Microsoft Windows...", but with the command I don't get "Microsoft Windows..." |
I set my computer to English, I deleted the changes from earlier and I no longer have the problem. |
Setting the I did recently add some code to rustc to attempt to re-encode as UTF-8 if the output is not UTF-8 but this only triggers for linker output. Perhaps other tools may also want the same treatment but I've not investigated. |
Oh sorry, just read that again. This is caused by cmd when used with |
(Sorry if this isn't the right template, I wasn't sure what to choose)
Hi, when I run tests with x.py from the command
python3 x.py test library/std
I get this errorthread 'main' panicked at 'failed to read output of test runner : stream did not contain valid UTF-8', render_tests.rs:97:29
.The text was updated successfully, but these errors were encountered: