| author | |
| committer | |
| log | 6f0d1255260410441c377a52dd73c308517276cd |
| tree | 1687a11910c70ccf8a718fbc33d2cfef64b58d41 |
| parent | 840e25a18ee33d8bc08f2134fc1595aec56c09cc |
| signature |
4 files changed, 18 insertions(+), 9 deletions(-)
build.zig+13-8| ... | @@ -4,13 +4,15 @@ const deps = @import("./deps.zig"); | ... | @@ -4,13 +4,15 @@ const deps = @import("./deps.zig"); |
| 4 | 4 | ||
| 5 | pub fn build(b: *std.Build) void { | 5 | pub fn build(b: *std.Build) void { |
| 6 | const target = b.standardTargetOptions(.{}); | 6 | const target = b.standardTargetOptions(.{}); |
| 7 | const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; | 7 | const mode = b.option(std.builtin.OptimizeMode, "mode", "") orelse .Debug; |
| 8 | const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false; | 8 | const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false; |
| 9 | 9 | ||
| 10 | const test_exe = b.addTest(.{ | 10 | const test_exe = b.addTest(.{ |
| 11 | .root_source_file = b.path("test.zig"), | 11 | .root_module = b.createModule(.{ |
| 12 | .target = target, | 12 | .root_source_file = b.path("test.zig"), |
| 13 | .optimize = mode, | 13 | .target = target, |
| 14 | .optimize = mode, | ||
| 15 | }), | ||
| 14 | }); | 16 | }); |
| 15 | deps.addAllTo(test_exe); | 17 | deps.addAllTo(test_exe); |
| 16 | test_exe.use_llvm = !disable_llvm; | 18 | test_exe.use_llvm = !disable_llvm; |
| ... | @@ -45,11 +47,14 @@ pub fn build(b: *std.Build) void { | ... | @@ -45,11 +47,14 @@ pub fn build(b: *std.Build) void { |
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | fn addFuzzer(b: *std.Build, target: std.Build.ResolvedTarget, comptime name: []const u8, afl_clang_args: []const []const u8) *std.Build.Step.InstallFile { | 49 | fn addFuzzer(b: *std.Build, target: std.Build.ResolvedTarget, comptime name: []const u8, afl_clang_args: []const []const u8) *std.Build.Step.InstallFile { |
| 48 | const fuzz_lib = b.addStaticLibrary(.{ | 50 | const fuzz_lib = b.addLibrary(.{ |
| 51 | .linkage = .static, | ||
| 49 | .name = "fuzz-" ++ name ++ "-lib", | 52 | .name = "fuzz-" ++ name ++ "-lib", |
| 50 | .root_source_file = b.path("fuzz/main.zig"), | 53 | .root_module = b.createModule(.{ |
| 51 | .target = target, | 54 | .root_source_file = b.path("fuzz/main.zig"), |
| 52 | .optimize = .Debug, | 55 | .target = target, |
| 56 | .optimize = .Debug, | ||
| 57 | }), | ||
| 53 | }); | 58 | }); |
| 54 | fuzz_lib.want_lto = true; | 59 | fuzz_lib.want_lto = true; |
| 55 | fuzz_lib.bundle_compiler_rt = true; | 60 | fuzz_lib.bundle_compiler_rt = true; |
licenses.txt+1| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | MIT: | 1 | MIT: |
| 2 | = https://spdx.org/licenses/MIT | 2 | = https://spdx.org/licenses/MIT |
| 3 | - This | 3 | - This |
| 4 | - git https://github.com/nektro/zig-expect | ||
| 4 | - git https://github.com/nektro/zig-extras | 5 | - git https://github.com/nektro/zig-extras |
| 5 | - git https://github.com/nektro/zig-sys-darwin | 6 | - git https://github.com/nektro/zig-sys-darwin |
| 6 | - git https://github.com/nektro/zig-sys-linux | 7 | - git https://github.com/nektro/zig-sys-linux |
test.zig+2-1| ... | @@ -3,6 +3,7 @@ const json = @import("json"); | ... | @@ -3,6 +3,7 @@ const json = @import("json"); |
| 3 | const build_options = @import("build_options"); | 3 | const build_options = @import("build_options"); |
| 4 | const nfs = @import("nfs"); | 4 | const nfs = @import("nfs"); |
| 5 | const nio = @import("nio"); | 5 | const nio = @import("nio"); |
| 6 | const expect = @import("expect").expect; | ||
| 6 | 7 | ||
| 7 | const JSONTestSuite_root = build_options.JSONTestSuite_root; | 8 | const JSONTestSuite_root = build_options.JSONTestSuite_root; |
| 8 | 9 | ||
| ... | @@ -579,7 +580,7 @@ fn expectCanonical(buffer: []const u8) !void { | ... | @@ -579,7 +580,7 @@ fn expectCanonical(buffer: []const u8) !void { |
| 579 | defer doc.deinit(alloc); | 580 | defer doc.deinit(alloc); |
| 580 | doc.acquire(); | 581 | doc.acquire(); |
| 581 | defer doc.release(); | 582 | defer doc.release(); |
| 582 | try std.testing.expectFmt(buffer, "{}", .{doc}); | 583 | try expect(buffer).toEqualNFmt("{}", .{doc}); |
| 583 | 584 | ||
| 584 | var buf: [4096]u8 = undefined; | 585 | var buf: [4096]u8 = undefined; |
| 585 | var out: nio.FixedBufferStream([]u8) = .init(&buf); | 586 | var out: nio.FixedBufferStream([]u8) = .init(&buf); |
zig.mod+2| ... | @@ -12,6 +12,8 @@ dependencies: | ... | @@ -12,6 +12,8 @@ dependencies: |
| 12 | root_dependencies: | 12 | root_dependencies: |
| 13 | - src: git https://github.com/nektro/zig-nio | 13 | - src: git https://github.com/nektro/zig-nio |
| 14 | - src: git https://github.com/nektro/zig-nfs | 14 | - src: git https://github.com/nektro/zig-nfs |
| 15 | - src: git https://github.com/nektro/zig-expect | ||
| 16 | |||
| 15 | - src: git https://github.com/nst/JSONTestSuite commit-984defc2deaa653cb73cd29f4144a720ec9efe7c | 17 | - src: git https://github.com/nst/JSONTestSuite commit-984defc2deaa653cb73cd29f4144a720ec9efe7c |
| 16 | id: bebdygynna6kk8zbbprkva6yd28x9wmf57vtzxjn | 18 | id: bebdygynna6kk8zbbprkva6yd28x9wmf57vtzxjn |
| 17 | license: MIT | 19 | license: MIT |