homebrew-core/Formula/sysdig.rb
2015-10-04 02:49:17 +01:00

51 lines
1.8 KiB
Ruby

class Sysdig < Formula
desc "System-level exploration and troubleshooting tool"
homepage "http://www.sysdig.org/"
url "https://github.com/draios/sysdig/archive/0.2.0.tar.gz"
sha256 "efade09f94f9e98f177149cde080b5436bb8a3da4e1a664699f2780ba22921ea"
bottle do
sha256 "a238526bb2cf7844076733b4dbbe0d0634d0cf09e934b1e26bbda92ccf22e04e" => :el_capitan
sha256 "25fd82fd5fd43dee5ab86ea8dd0b1a1c5cfb40f9cc05d78e38b9c174f4b211c3" => :yosemite
sha256 "14f9d4195dea6e616a8b859337339249bc267a4abc7291f887b3777d9db31c35" => :mavericks
end
depends_on "cmake" => :build
depends_on "luajit"
# More info on https://gist.github.com/juniorz/9986999
resource "sample_file" do
url "https://gist.githubusercontent.com/juniorz/9986999/raw/a3556d7e93fa890a157a33f4233efaf8f5e01a6f/sample.scap"
sha256 "efe287e651a3deea5e87418d39e0fe1e9dc55c6886af4e952468cd64182ee7ef"
end
def install
ENV.libcxx if MacOS.version < :mavericks
mkdir "build" do
args = %W[
-DSYSDIG_VERSION=#{version}
-DUSE_BUNDLED_LUAJIT=OFF
-DUSE_BUNDLED_ZLIB=OFF
] + std_cmake_args
system "cmake", "..", *args
system "make", "install"
end
(share/"demos").install resource("sample_file").files("sample.scap")
end
test do
# tests if it can load chisels
`#{bin}/sysdig -cl`
assert_equal 0, $?.exitstatus
# tests if it can read a sample capture file
# uses a custom output format because evt.time (in default format) is not UTC
expected_output = "1 open fd=5(<f>/tmp/sysdig/sample.scap) name=sample.scap(/tmp/sysdig/sample.scap) flags=262(O_TRUNC|O_CREAT|O_WRONLY) mode=0"
assert_equal expected_output, `#{bin}/sysdig -r #{share}/demos/sample.scap -p "%evt.num %evt.type %evt.args" "evt.type=open and evt.arg.name contains /tmp/sysdig/sample.scap"`.strip
assert_equal 0, $?.exitstatus
end
end