Skip to content

Commit 8e5296b

Browse files
committed
progress
1 parent 2cd8b18 commit 8e5296b

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

run.rb

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,22 @@ def start_reporting_process(reader)
2323
fork do
2424
seen = {}
2525
loop do
26-
encoded_bytes, cov_hash = reader.gets.strip.split('_')
26+
message = Marshal.load(Base64.strict_decode64(reader.gets.strip))
27+
28+
encoded_bytes = message[:bytes]
29+
# TODO: replace numbers in hash with booleans
30+
cov_hash = message[:cov].hash
2731

2832
if seen.include?(cov_hash)
2933
next
3034
end
3135

32-
decoded_bytes = Base64.strict_decode64(encoded_bytes).freeze
33-
seen[cov_hash] = decoded_bytes
34-
puts("Encountered new code path with input bytes: #{decoded_bytes.inspect}")
36+
# TODO: merge all the cov hashes we've seen to print coverage %
37+
# https://github.com/mame/coverage-helpers
38+
39+
seen[cov_hash] = encoded_bytes
40+
puts('Encountered new code path with input bytes:')
41+
puts("\tbytes: #{encoded_bytes.inspect}")
3542
end
3643
end
3744
end
@@ -55,8 +62,14 @@ def start_fuzzing_process(file_path, writer)
5562
exit(1)
5663
end
5764

58-
# TODO: replace numbers in hash with booleans
59-
writer.puts(Base64.strict_encode64(bytes) + '_' + Coverage.result.hash.to_s)
65+
writer.puts(
66+
Base64.strict_encode64(
67+
Marshal.dump({
68+
bytes: bytes,
69+
cov: Coverage.result,
70+
})
71+
)
72+
)
6073
end
6174
Process.wait
6275
end

0 commit comments

Comments
 (0)