File: test_standalone.sh

package info (click to toggle)
bpfcc 0.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,368 kB
  • sloc: ansic: 132,727; python: 36,226; cpp: 26,973; sh: 710; yacc: 525; makefile: 141; lex: 94
file content (32 lines) | stat: -rwxr-xr-x 664 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
# Copyright (c) GitHub, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

set -xe
cd "src/lua"

function fail {
    echo "test failed: $1" >&2
    exit 1
}

if [[ ! -x bcc-lua ]]; then
    echo "bcc-lua not built --- skipping"
    exit 0
fi

LIBRARY=$(ldd bcc-lua | grep luajit)
if [ $? -ne 0 -o -z "$LIBRARY" ] ; then
    fail "bcc-lua depends on libluajit"
fi

rm -f probe.lua
echo "return function(BPF) print(\"Hello world\") end" > probe.lua

PROBE="../../../examples/lua/offcputime.lua"

if ! sudo ./bcc-lua "$PROBE" -d 1 >/dev/null 2>/dev/null; then
    fail "bcc-lua cannot run complex probes"
fi

rm -f libbcc.so probe.lua