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

stage2 test harness: show source file name in compile errors #8829

Closed
andrewrk opened this issue May 18, 2021 · 0 comments
Closed

stage2 test harness: show source file name in compile errors #8829

andrewrk opened this issue May 18, 2021 · 0 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@andrewrk
Copy link
Member

Currently, compile errors in test cases look like this:

        case.addError("", &[_][]const u8{
            ":84:9: error: struct 'test_case.test_case' has no member named 'main'",
        });

The source file name is not included. Similarly, if you get a compile error, it gets truncated in the message:

[nix-shell:~/dev/zig/build-release]$ ./zig build test-stage2 -Denable-qemu -Denable-wasmtime -Denable-llvm 
tests [1/78] CBE: hello world with updates [1/4] update [3/3] 
Case 'CBE: hello world with updates': unexpected errors at update_index=0:
================================================================================
:20:81: error: redundant comptime keyword in already comptime scope
================================================================================
test 'CBE: hello world with updates' failed: UnexpectedCompileErrors

tests [2/78] CBE: var args [1/1] update [3/3] 
Case 'CBE: var args': unexpected errors at update_index=0:
================================================================================
:20:81: error: redundant comptime keyword in already comptime scope
================================================================================
test 'CBE: var args' failed: UnexpectedCompileErrors

tests [3/78] CBE: @intToError [1/3] update [3/3] 
Case 'CBE: @intToError': unexpected errors at update_index=0:
================================================================================
:20:81: error: redundant comptime keyword in already comptime scope
================================================================================
test 'CBE: @intToError' failed: UnexpectedCompileErrors

tests [4/78] CBE: x86_64-linux inline assembly [1/5] update [3/3] 
Case 'CBE: x86_64-linux inline assembly': unexpected errors at update_index=0:
================================================================================
:20:81: error: redundant comptime keyword in already comptime scope
================================================================================
test 'CBE: x86_64-linux inline assembly' failed: UnexpectedCompileErrors

tests [5/78] CBE: alloc and retptr [1/1] update [3/3] 
Case 'CBE: alloc and retptr': unexpected errors at update_index=0:
================================================================================
:20:81: error: redundant comptime keyword in already comptime scope
================================================================================
test 'CBE: alloc and retptr' failed: UnexpectedCompileErrors


...and so on.

Here the change that I made was:

--- a/lib/std/crypto/md5.zig
+++ b/lib/std/crypto/md5.zig
@@ -17,7 +17,7 @@ const RoundParam = struct {
     t: u32,
 };
 
-fn roundParam(a: usize, b: usize, c: usize, d: usize, k: usize, s: u32, t: u32) RoundParam {
+fn roundParam(a: usize, b: usize, c: usize, d: usize, k: usize, s: u32, t: u32) comptime RoundParam {
     return RoundParam{
         .a = a,
         .b = b,

But the compile error did not show md5.zig which would have saved a lot of time. This is now important, because AstGen compile errors can now fail the CI for std lib contributions!

Related: #8828

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels May 18, 2021
@andrewrk andrewrk added this to the 0.8.0 milestone May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

1 participant