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

get the test runner and zig test working; enable behavior tests for stage2 #8818

Closed
andrewrk opened this issue May 18, 2021 · 1 comment
Closed
Labels
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

test "example" {}
[nix-shell:~/dev/zig/build-release]$ ./zig-out/bin/zig test test.zig
thread 743 panic: reached unreachable code
/home/andy/dev/zig/src/type.zig:1988:21: 0x3d650a in type.Type.elemType (zig)
            else => unreachable,
                    ^
/home/andy/dev/zig/src/Sema.zig:6222:43: 0x695bcc in Sema.namedFieldPtr (zig)
        .Pointer => object_ptr.ty.elemType(),
                                          ^
/home/andy/dev/zig/src/Sema.zig:3213:30: 0x5cd028 in Sema.zirFieldPtr (zig)
    return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src);
                             ^
/home/andy/dev/zig/src/Sema.zig:215:66: 0x4f3f13 in Sema.analyzeBody (zig)
            .field_ptr                    => try sema.zirFieldPtr(block, inst),
                                                                 ^
/home/andy/dev/zig/src/Sema.zig:105:29: 0x4f02ca in Sema.analyzeFnBody (zig)
    _ = try sema.analyzeBody(block, body);
                            ^
/home/andy/dev/zig/src/Module.zig:3615:27: 0x42b9c4 in Module.analyzeFnBody (zig)
    try sema.analyzeFnBody(&inner_block, func.zir_body_inst);
                          ^
/home/andy/dev/zig/src/Compilation.zig:1921:56: 0x420534 in Compilation.performAllTheWork (zig)
                        .queued => module.analyzeFnBody(decl, func) catch |err| switch (err) {
                                                       ^
/home/andy/dev/zig/src/Compilation.zig:1618:31: 0x41caef in Compilation.update (zig)
    try self.performAllTheWork();
                              ^
/home/andy/dev/zig/src/main.zig:2233:20: 0x3b32a2 in updateModule (zig)
    try comp.update();
                   ^
/home/andy/dev/zig/src/main.zig:1965:17: 0x352651 in buildOutputType (zig)
    updateModule(gpa, comp, hook) catch |err| switch (err) {
                ^
/home/andy/dev/zig/src/main.zig:192:31: 0x33d417 in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .zig_test);
                              ^
/home/andy/dev/zig/src/main.zig:141:20: 0x335860 in main (zig)
    return mainArgs(gpa, arena, args);
                   ^
/home/andy/dev/zig/lib/std/start.zig:458:37: 0x32e0fa in std.start.callMain (zig)
            const result = root.main() catch |err| {
                                    ^
/home/andy/dev/zig/lib/std/start.zig:400:12: 0x31225e in std.start.callMainWithArgs (zig)
    return @call(.{ .modifier = .always_inline }, callMain, .{});
           ^
/home/andy/dev/zig/lib/std/start.zig:318:17: 0x311245 in std.start.posixCallMainAndExit (zig)
    std.os.exit(@call(.{ .modifier = .always_inline }, callMainWithArgs, .{ argc, argv, envp }));
                ^
/home/andy/dev/zig/lib/std/start.zig:244:5: 0x310fa2 in std.start._start (zig)
    @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
    ^
Aborted (core dumped)

Instead it should run the tests. We already have simplified test runner logic when builtin.zig_is_stage2 is true, but there is also work that needs to be done in the stage2 frontend in order to make @import("builtin").test_functions work properly.

In order to close this issue, add test coverage for running the behavior tests with stage2 (but not all behavior tests have to be passing).

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels May 18, 2021
@andrewrk andrewrk added this to the 0.8.0 milestone May 18, 2021
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Jun 4, 2021
@andrewrk
Copy link
Member Author

andrewrk commented Aug 5, 2021

Done as of dc88864

@andrewrk andrewrk closed this as completed Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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