|
| 1 | +class CbmcAT631 < Formula |
| 2 | + desc "C Bounded Model Checker" |
| 3 | + homepage "https://www.cprover.org/cbmc/" |
| 4 | + url "https://github.com/diffblue/cbmc.git", |
| 5 | + tag: "cbmc-6.3.1", |
| 6 | + revision: "cbmc-d2b4455a109383562735cfb8b52ed8a6d2b6e197" |
| 7 | + license "BSD-4-Clause" |
| 8 | + |
| 9 | + bottle do |
| 10 | + root_url "https://github.com/diffblue/homebrew-cbmc/releases/download/bag-of-goodies" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "eb9a036d14b68a5f531fc134bae66178ef780b81406ed7664d2cf3d655c6bff7" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "cf6ce2452d773152d1ca5e40876176a7d29482be33189bd8ea6955ab67e0040d" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "0349025e92bf7cd155f2145024daf9163aa03eae344f0c7a907a3cc04fa015e1" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "e3afc36341a6769c8d7019e3ab1eb1159e562bf39d80902707d704a601044369" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "5479cbcce605574b23746ceaca1c9d12dd9d94e47d2e6c9551757b8d2af169b1" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "cmake" => :build |
| 19 | + depends_on "maven" => :build |
| 20 | + depends_on "openjdk" => :build |
| 21 | + depends_on "rust" => :build |
| 22 | + |
| 23 | + uses_from_macos "bison" => :build |
| 24 | + uses_from_macos "flex" => :build |
| 25 | + |
| 26 | + fails_with gcc: "5" |
| 27 | + |
| 28 | + def install |
| 29 | + system "cmake", "-S", ".", "-B", "build", "-Dsat_impl=minisat2;cadical", *std_cmake_args |
| 30 | + system "cmake", "--build", "build" |
| 31 | + system "cmake", "--install", "build" |
| 32 | + |
| 33 | + # lib contains only `jar` files |
| 34 | + libexec.install lib |
| 35 | + end |
| 36 | + |
| 37 | + test do |
| 38 | + # Find a pointer out of bounds error |
| 39 | + (testpath/"main.c").write <<~EOS |
| 40 | + #include <stdlib.h> |
| 41 | + int main() { |
| 42 | + char *ptr = malloc(10); |
| 43 | + char c = ptr[10]; |
| 44 | + } |
| 45 | + EOS |
| 46 | + assert_match "VERIFICATION FAILED", |
| 47 | + shell_output("#{bin}/cbmc --pointer-check main.c", 10) |
| 48 | + end |
| 49 | +end |
0 commit comments