mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
libfuzzer test: use proper cache dir logic
This commit is contained in:
parent
07a5efd072
commit
ad1e09eab0
@ -22,5 +22,6 @@ pub fn build(b: *std.Build) void {
|
|||||||
b.default_step = run_step;
|
b.default_step = run_step;
|
||||||
|
|
||||||
const run_artifact = b.addRunArtifact(exe);
|
const run_artifact = b.addRunArtifact(exe);
|
||||||
|
run_artifact.addArg(b.cache_root.path orelse "");
|
||||||
run_step.dependOn(&run_artifact.step);
|
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;
|
extern fn fuzzer_coverage_id() u64;
|
||||||
|
|
||||||
pub fn main() !void {
|
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_init_corpus_elem("hello".ptr, "hello".len);
|
||||||
fuzzer_set_name("test".ptr, "test".len);
|
fuzzer_set_name("test".ptr, "test".len);
|
||||||
_ = fuzzer_coverage_id();
|
_ = fuzzer_coverage_id();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user