-
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.9",
revision: "a35eb35fbba72fdd83b5f32dec87836fd5564946"
license "Apache-2.0"
bottle do
root_url "https://github.com/model-checking/cbmc-viewer/releases/download/viewer-3.9"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "d303de5c4ec434be51c7917c2dcf87e337f23dce88756f0ed583f9e5c8548712"
sha256 cellar: :any_skip_relocation, x86_64_linux: "0c809d7478aa9b1c467a1a9ec835c1542d570ff6245ab6ba1c41bb667eb6e577"
end
depends_on "cbmc" => :test
depends_on "[email protected]"
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