From c9d2550ecd3597b46791f2ae0f4a23aae50d5233 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Wed, 11 May 2016 10:44:32 -0700 Subject: [PATCH 1/3] Add minimal travis support. Add minimal travis.yml file that builds and packages falco. No actual tests yet. --- .travis.yml | 38 ++++++++++++++++++++++++++++++++++ test/falco_trace_regression.sh | 26 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .travis.yml create mode 100755 test/falco_trace_regression.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..a602ce53 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,38 @@ +language: c +env: + - BUILD_TYPE=Debug + - BUILD_TYPE=Release +before_install: + - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + - sudo apt-get update +install: + - sudo apt-get --force-yes install g++-4.8 + - sudo apt-get install rpm linux-headers-$(uname -r) + - git clone https://github.com/draios/sysdig.git ../sysdig +before_script: + - export KERNELDIR=/lib/modules/$(ls /lib/modules | sort | head -1)/build +script: + - set -e + - export CC="gcc-4.8" + - export CXX="g++-4.8" + - wget https://s3.amazonaws.com/download.draios.com/dependencies/cmake-3.3.2.tar.gz + - tar -xzf cmake-3.3.2.tar.gz + - cd cmake-3.3.2 + - ./bootstrap --prefix=/usr + - make + - sudo make install + - cd .. + - mkdir build + - cd build + - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - make VERBOSE=1 + - make package +# - cd .. +# - test/falco_trace_regression.sh build/userspace/falco/falco +notifications: + webhooks: + urls: +# - https://webhooks.gitter.im/e/fdbc2356fb0ea2f15033 + on_success: change + on_failure: always + on_start: never \ No newline at end of file diff --git a/test/falco_trace_regression.sh b/test/falco_trace_regression.sh new file mode 100755 index 00000000..928c06f3 --- /dev/null +++ b/test/falco_trace_regression.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -eu + +SCRIPT=$(readlink -f $0) +BASEDIR=$(dirname $SCRIPT) + +FALCO=$1 + +# For now, simply ensure that falco can run without errors. +FALCO_CMDLINE="$FALCO -c $BASEDIR/../falco.yaml -r $BASEDIR/../rules/falco_rules.yaml" +echo "Running falco: $FALCO_CMDLINE" +$FALCO_CMDLINE > $BASEDIR/falco.log 2>&1 & +FALCO_PID=$! +echo "Falco started, pid $FALCO_PID" +sleep 10 +if kill -0 $FALCO_PID > /dev/null 2>&1; then + echo "Falco ran successfully" + kill $FALCO_PID + ret=0 +else + echo "Falco did not start successfully. Full program output:" + cat $BASEDIR/falco.log + ret=1 +fi + +exit $ret From 467fe33e37d9735828b2462dbba53fadea406dcf Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Tue, 17 May 2016 16:07:40 -0700 Subject: [PATCH 2/3] Add travis badges. Showing both dev/master branches for now. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e582da56..b98aaf02 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ for an early release. On the other hand performance is still a work in progress. On busy hosts and/or with large rule sets, you may see the current version of falco using high CPU. Expect big improvements in coming releases. +Dev Branch: [![Build Status](https://travis-ci.org/draios/falco.svg?branch=dev)](https://travis-ci.org/draios/falco)
+Master Branch: [![Build Status](https://travis-ci.org/draios/falco.svg?branch=master)](https://travis-ci.org/draios/falco) + ####Table of Contents - [Overview](#overview) From 450c347ef38349aaf512dce62fc035bce16680f2 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Tue, 17 May 2016 16:26:05 -0700 Subject: [PATCH 3/3] Add a basic test to run falco. Add a basic test that loads the kernel module from the source directory and runs falco. No testing of behavior yet. --- .travis.yml | 4 ++-- test/falco_trace_regression.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a602ce53..d4953371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,8 +27,8 @@ script: - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE - make VERBOSE=1 - make package -# - cd .. -# - test/falco_trace_regression.sh build/userspace/falco/falco + - cd .. + - sudo test/falco_trace_regression.sh build/userspace/falco/falco notifications: webhooks: urls: diff --git a/test/falco_trace_regression.sh b/test/falco_trace_regression.sh index 928c06f3..a4b3498c 100755 --- a/test/falco_trace_regression.sh +++ b/test/falco_trace_regression.sh @@ -5,6 +5,10 @@ SCRIPT=$(readlink -f $0) BASEDIR=$(dirname $SCRIPT) FALCO=$1 +BUILDDIR=$(dirname $FALCO) + +# Load the built kernel module by hand +insmod $BUILDDIR/../../driver/sysdig-probe.ko # For now, simply ensure that falco can run without errors. FALCO_CMDLINE="$FALCO -c $BASEDIR/../falco.yaml -r $BASEDIR/../rules/falco_rules.yaml"