|
| 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: "cafa46eac570b518e09a3a259f08564cf628440de748db7a7ee97e355c69f91f" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "9caee22e3e5d624f92fc66a19375481e9f9cd062f236af1ea38c11963b86ca34" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "f223546676fff726c4759f6ce118d03369706b8fa9b0869d8baac33624dd3aca" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "64b75d623aece2d92aeb771252fe3228f8e87a2ac5cd989365192f87bdf5d360" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "4acc40ac65e85947a6a62fff832a5842fa73fe10acc6cb827669c0d5e646ae96" |
| 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