| ... | ... | @@ -7,26 +7,9 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | b.default_step = test_step; |
| 8 | 8 | |
| 9 | 9 | add(b, test_step, .Debug); |
| 10 | | add(b, test_step, .ReleaseFast); |
| 11 | | add(b, test_step, .ReleaseSmall); |
| 12 | | add(b, test_step, .ReleaseSafe); |
| 13 | 10 | } |
| 14 | 11 | |
| 15 | 12 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | | const import_table = b.addExecutable(.{ |
| 17 | | .name = "import_table", |
| 18 | | .root_module = b.createModule(.{ |
| 19 | | .root_source_file = b.path("lib.zig"), |
| 20 | | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 21 | | .optimize = optimize, |
| 22 | | }), |
| 23 | | }); |
| 24 | | import_table.entry = .disabled; |
| 25 | | import_table.use_llvm = false; |
| 26 | | import_table.use_lld = false; |
| 27 | | import_table.import_table = true; |
| 28 | | import_table.link_gc_sections = false; |
| 29 | | |
| 30 | 13 | const export_table = b.addExecutable(.{ |
| 31 | 14 | .name = "export_table", |
| 32 | 15 | .root_module = b.createModule(.{ |
| ... | ... | @@ -54,21 +37,9 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 54 | 37 | regular_table.use_lld = false; |
| 55 | 38 | regular_table.link_gc_sections = false; // Ensure function table is not empty |
| 56 | 39 | |
| 57 | | const check_import = import_table.checkObject(); |
| 58 | 40 | const check_export = export_table.checkObject(); |
| 59 | 41 | const check_regular = regular_table.checkObject(); |
| 60 | 42 | |
| 61 | | check_import.checkInHeaders(); |
| 62 | | check_import.checkExact("Section import"); |
| 63 | | check_import.checkExact("entries 1"); |
| 64 | | check_import.checkExact("module env"); |
| 65 | | check_import.checkExact("name __indirect_function_table"); |
| 66 | | check_import.checkExact("kind table"); |
| 67 | | check_import.checkExact("type funcref"); |
| 68 | | check_import.checkExact("min 1"); // 1 function pointer |
| 69 | | check_import.checkNotPresent("max"); // when importing, we do not provide a max |
| 70 | | check_import.checkNotPresent("Section table"); // we're importing it |
| 71 | | |
| 72 | 43 | check_export.checkInHeaders(); |
| 73 | 44 | check_export.checkExact("Section export"); |
| 74 | 45 | check_export.checkExact("entries 2"); |
| ... | ... | @@ -89,7 +60,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 89 | 60 | check_regular.checkExact("i32.const 1"); // we want to start function indexes at 1 |
| 90 | 61 | check_regular.checkExact("indexes 1"); // 1 function pointer |
| 91 | 62 | |
| 92 | | test_step.dependOn(&check_import.step); |
| 93 | 63 | test_step.dependOn(&check_export.step); |
| 94 | 64 | test_step.dependOn(&check_regular.step); |
| 95 | 65 | } |