-
Notifications
You must be signed in to change notification settings - Fork 96
/
cbmc-viewer.rb
64 lines (54 loc) · 2.56 KB
/
cbmc-viewer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class CbmcViewer < Formula
include Language::Python::Virtualenv
desc "Scans the output of CBMC and produces a browsable summary of the results"
homepage "https://github.com/model-checking/cbmc-viewer"
url "https://github.com/model-checking/cbmc-viewer.git",
tag: "viewer-3.10",
revision: "234256dbe50d86b0f31640d109e998a3e3fe8d4f"
license "Apache-2.0"
bottle do
root_url "https://github.com/model-checking/cbmc-viewer/releases/download/viewer-3.10"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "bbc15a0fb2be79edca3ba43edcdcc4e29fc4982ae7d5c08e9df2a3928d560f9c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "9cb594b67860fa98330aed99d73280aa8c8b18915154629830448b222234e94d"
end
depends_on "cbmc" => :test
depends_on "python@3.10"
depends_on "universal-ctags" => :optional
resource "Jinja2" do
url "https://files.pythonhosted.org/packages/91/a5/429efc6246119e1e3fbf562c00187d04e83e54619249eb732bb423efa6c6/Jinja2-3.0.3.tar.gz"
sha256 "611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7"
end
resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/bf/10/ff66fea6d1788c458663a84d88787bae15d45daa16f6b3ef33322a51fc7e/MarkupSafe-2.0.1.tar.gz"
sha256 "594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"
end
resource "voluptuous" do
url "https://files.pythonhosted.org/packages/c0/2c/ccbeb25364e3e0c5e4522f13d66e2fc639bb4d4ecdf73be0959552cbecb4/voluptuous-0.12.2.tar.gz"
sha256 "4db1ac5079db9249820d49c891cb4660a6f8cae350491210abce741fabf56513"
end
def install
virtualenv_install_with_resources
bash_completion.install "src/cbmc_viewer/etc/bash_completion.d/cbmc-viewer.sh"
end
test do
(testpath/"main.c").write <<~EOS
#include <stdlib.h>
static int global;
int main() {
int *ptr = malloc(sizeof(int));
assert(global > 0);
return 0;
}
EOS
system "goto-cc", "-o", "main.goto", "main.c"
(testpath/"cbmc.xml").write shell_output("cbmc main.goto --trace --xml-ui", 10)
(testpath/"coverage.xml").write shell_output("cbmc main.goto --cover location --xml-ui")
(testpath/"property.xml").write shell_output("cbmc main.goto --show-properties --xml-ui")
system bin/"cbmc-viewer", "--goto", "main.goto",
"--result", "cbmc.xml",
"--coverage", "coverage.xml",
"--property", "property.xml",
"--srcdir", "."
assert_predicate testpath/"report/html/index.html", :exist?
end
end