• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) GitHub, Inc.
3# Licensed under the Apache License, Version 2.0 (the "License")
4
5set -xe
6cd "src/lua"
7
8function fail {
9    echo "test failed: $1" >&2
10    exit 1
11}
12
13if [[ ! -x bcc-lua ]]; then
14    echo "bcc-lua not built --- skipping"
15    exit 0
16fi
17
18LIBRARY=$(ldd bcc-lua | grep luajit)
19if [ $? -ne 0 -o -z "$LIBRARY" ] ; then
20    fail "bcc-lua depends on libluajit"
21fi
22
23rm -f probe.lua
24echo "return function(BPF) print(\"Hello world\") end" > probe.lua
25
26PROBE="../../../examples/lua/offcputime.lua"
27
28if ! sudo ./bcc-lua "$PROBE" -d 1 >/dev/null 2>/dev/null; then
29    fail "bcc-lua cannot run complex probes"
30fi
31
32rm -f libbcc.so probe.lua
33