homebrew-core/Formula/afl-fuzz.rb

39 lines
1.1 KiB
Ruby
Raw Normal View History

require "formula"
class AflFuzz < Formula
homepage "http://lcamtuf.coredump.cx/afl/"
url "http://lcamtuf.coredump.cx/afl/releases/afl-1.77b.tgz"
sha256 "542f5ce26e1e6c7487bd0af9d0b776cded52014a9adcc1be9ca5bd4357a0c431"
head "http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz"
2014-12-06 22:36:01 +00:00
bottle do
2015-05-07 04:44:26 +00:00
sha256 "6432ca2854c3931990b9d38e60bfb8b43be030c3eafbe27467174f8454ff628c" => :yosemite
sha256 "09f9ae233fada70859c751cd77944f55a097563a58cdaa26acd528fe5469a5ae" => :mavericks
sha256 "e400018988d4e2fdc1e1327b9852d688e02eed6b7265c0de58ddd0ccb47955ea" => :mountain_lion
2014-12-06 22:36:01 +00:00
end
def install
system "make", "PREFIX=#{prefix}"
system "make", "install", "PREFIX=#{prefix}"
end
test do
cpp_file = testpath/"main.cpp"
2014-12-07 17:42:13 +00:00
exe_file = testpath/"test"
2014-12-07 17:42:13 +00:00
cpp_file.write <<-EOS.undent
#include <iostream>
int main() {
2014-12-07 17:42:13 +00:00
std::cout << "Hello, world!";
}
EOS
2014-12-07 17:42:13 +00:00
system "#{bin}/afl-clang++", "-g", cpp_file, "-o", exe_file
output = `#{exe_file}`
assert_equal 0, $?.exitstatus
assert_equal output, "Hello, world!"
end
end