Skip to content

Commit 3a1658d

Browse files
committed
error if there is no fuzz function
1 parent 9def329 commit 3a1658d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

run.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
require 'coverage'
44

5+
# Is the `fuzz` function defined in the fuzz target?
6+
def fuzz_function_exists?(file_path)
7+
reader, writer = IO.pipe
8+
fork do
9+
load(file_path)
10+
begin
11+
method(:fuzz)
12+
rescue NameError
13+
writer.puts('false')
14+
else
15+
writer.puts('true')
16+
end
17+
end
18+
Process.wait
19+
writer.close
20+
reader.gets == "true\n"
21+
end
22+
523
if ARGV.length != 1
624
puts 'USAGE: fuzz.rb <FILE TO FUZZ>'
725
exit

0 commit comments

Comments
 (0)