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

Improve formatting of e2e test build errors #1447

Closed
itowlson opened this issue May 3, 2023 · 2 comments · Fixed by #1462
Closed

Improve formatting of e2e test build errors #1447

itowlson opened this issue May 3, 2023 · 2 comments · Fixed by #1462
Assignees

Comments

@itowlson
Copy link
Contributor

itowlson commented May 3, 2023

I was editing testcases/key-value/lib.rs and missed a ? on a fallible operation and this is how make test-kv explained the problem to me:

image

It would be great if we could preserve line breaks to make errors like this easier to read.

@rajatjindal
Copy link
Contributor

Hi @itowlson

sorry about this. I am looking into this.

would something like following be fine:

running 1 test
stderr: 
[
    "   Compiling key-value v0.1.0 (/Users/rajatjindal/go/src/github.com/fermyon/spin/tests/testcases/key-value)",
    "error[E0277]: can't compare `[_]` with `Result<Vec<u8>, key_value::key_value::Error>`",
    "  --> src/lib.rs:26:28",
    "   |",
    "26 |     ensure!(b\"baz\" as &[_] == &store.get(\"bar\"));",
    "   |                            ^^ no implementation for `[_] == Result<Vec<u8>, key_value::key_value::Error>`",
    "   |",
    "   = help: the trait `PartialEq<Result<Vec<u8>, key_value::key_value::Error>>` is not implemented for `[_]`",
    "   = help: the following other types implement trait `PartialEq<Rhs>`:",
    "             <&[B] as PartialEq<[A; N]>>",
    "             <&[T] as PartialEq<Vec<U, A>>>",
    "             <&[u8] as PartialEq<BytesMut>>",
    "             <&[u8] as PartialEq<bytes::Bytes>>",
    "             <&mut [B] as PartialEq<[A; N]>>",
    "             <&mut [T] as PartialEq<Vec<U, A>>>",
    "             <[A; N] as PartialEq<&[B]>>",
    "             <[A; N] as PartialEq<&mut [B]>>",
    "           and 8 others",
    "   = note: required for `&[_]` to implement `PartialEq<&Result<Vec<u8>, key_value::key_value::Error>>`",
    "   = note: 1 redundant requirement hidden",
    "   = note: required for `&&[_]` to implement `~const PartialEq<&&Result<Vec<u8>, key_value::key_value::Error>>`",
    "",
    "For more information about this error, try `rustc --explain E0277`.",
    "error: could not compile `key-value` (lib) due to previous error",
    "Error: Build command for component hello failed with status Exited(101)",
]
stdout: 
[
    "Executing the build command for component hello: cargo build --release --target wasm32-wasi",
]

I am getting above using

println!(
            "stderr: \n{:#?}",
            std::str::from_utf8(&output.stderr)?
                .lines()
                .collect::<Vec<&str>>()
        );

If there is a better way to do this, could you please let me know. thanks

@rajatjindal rajatjindal self-assigned this May 5, 2023
@itowlson
Copy link
Contributor Author

itowlson commented May 7, 2023

Yep, that would be fine - thanks!

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

Successfully merging a pull request may close this issue.

2 participants