diff --git a/Formula/cbmc@5.59.0.rb b/Formula/cbmc@5.59.0.rb new file mode 100644 index 0000000..f86817f --- /dev/null +++ b/Formula/cbmc@5.59.0.rb @@ -0,0 +1,43 @@ +class CbmcAT5590 < Formula + desc "C Bounded Model Checker" + homepage "https://www.cprover.org/cbmc/" + url "https://github.com/diffblue/cbmc.git", + tag: "cbmc-5.59.0", + revision: "ae93642e6a329882f7a7066b824cc0946c56b127" + license "BSD-4-Clause" + + depends_on "cmake" => :build + depends_on "maven" => :build + depends_on "openjdk" => :build + + uses_from_macos "bison" => :build + uses_from_macos "flex" => :build + + on_linux do + depends_on "gcc" + end + + fails_with gcc: "5" + + def install + system "cmake", "-S", ".", "-B", "build", *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" + + # lib contains only `jar` files + libexec.install lib + end + + test do + # Find a pointer out of bounds error + (testpath/"main.c").write <<~EOS + #include + int main() { + char *ptr = malloc(10); + char c = ptr[10]; + } + EOS + assert_match "VERIFICATION FAILED", + shell_output("#{bin}/cbmc --pointer-check main.c", 10) + end +end