mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
libfuzzer test: use proper cache dir logic
This commit is contained in:
parent
07a5efd072
commit
ad1e09eab0
2 changed files with 9 additions and 1 deletions
|
|
@ -22,5 +22,6 @@ pub fn build(b: *std.Build) void {
|
|||
b.default_step = run_step;
|
||||
|
||||
const run_artifact = b.addRunArtifact(exe);
|
||||
run_artifact.addArg(b.cache_root.path orelse "");
|
||||
run_step.dependOn(&run_artifact.step);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,14 @@ extern fn fuzzer_init_corpus_elem(input_ptr: [*]const u8, input_len: usize) void
|
|||
extern fn fuzzer_coverage_id() u64;
|
||||
|
||||
pub fn main() !void {
|
||||
fuzzer_init(FuzzerSlice.fromSlice(""));
|
||||
var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
|
||||
defer _ = gpa.deinit();
|
||||
const args = try std.process.argsAlloc(gpa.allocator());
|
||||
defer std.process.argsFree(gpa.allocator(), args);
|
||||
|
||||
const cache_dir = args[1];
|
||||
|
||||
fuzzer_init(FuzzerSlice.fromSlice(cache_dir));
|
||||
fuzzer_init_corpus_elem("hello".ptr, "hello".len);
|
||||
fuzzer_set_name("test".ptr, "test".len);
|
||||
_ = fuzzer_coverage_id();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue