|
| 1 | +class CbmcAT641 < 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.4.1", |
| 6 | + revision: "cbmc-c902db34beb113815f151c4d1f635e745ac79c0c" |
| 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: "f0391ab37a95bb557dbb6da68099f790576045c476e57942988f64eeef8919ec" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "e46944311044bddd28635081fb7a6c1979e29308e1b93c145ace4135c6614bd8" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "8166cb1f18a56d1c37d876ef98c293af148f7d3a57aa447059105084ed2e54e0" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "a4eb663da6492bf729d7b694fdc70a37205f90862721666667a8677b81b54eb7" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "5b3641671ef479223faee41b77228c10c3b438419078e718671d42626a6f8198" |
| 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