# Source
+## Debian - Source
+
+```
+ROUGH NOTES:
+
+Add jessie-backports repo
+Add non-free repo to sources.list
+Install latest 4.x kernel and headers from jessie-backports
+See updated control file for all package-build dependencies
+Other required tooling: devscripts
+
+debuild -b -uc -us
+
+Re-running tests:
+cd obj-x86_64-linux-gnu/
+sudo /usr/bin/ctest --force-new-ctest-process -j1 -V
+
+20: Test command: /home/mikep/bcc/obj-x86_64-linux-gnu/tests/wrapper.sh "py_uprobes" "sudo" "/home/mikep/bcc/tests/python/test_uprobes.py"
+20: Test timeout computed to be: 9.99988e+06
+20: Python 2.7.9
+20: .Arena 0:
+20: system bytes = 13803520
+20: in use bytes = 2970096
+20: Total (incl. mmap):
+20: system bytes = 14594048
+20: in use bytes = 3760624
+20: max mmap regions = 4
+20: max mmap bytes = 1589248
+20: F
+20: ======================================================================
+20: FAIL: test_simple_library (__main__.TestUprobes)
+20: ----------------------------------------------------------------------
+20: Traceback (most recent call last):
+20: File "/home/mikep/bcc/tests/python/test_uprobes.py", line 34, in test_simple_library
+20: self.assertEqual(b["stats"][ctypes.c_int(0)].value, 2)
+20: AssertionError: 0L != 2
+
+26: Test command: /home/mikep/bcc/obj-x86_64-linux-gnu/tests/wrapper.sh "lua_test_uprobes" "sudo" "/usr/bin/luajit" "test_uprobes.lua"
+26: Test timeout computed to be: 9.99988e+06
+26: Python 2.7.9
+26: Arena 0:
+26: system bytes = 12394496
+26: in use bytes = 1561664
+26: Total (incl. mmap):
+26: system bytes = 12394496
+26: in use bytes = 1561664
+26: max mmap regions = 4
+26: max mmap bytes = 999424
+26: .F
+26: Failed tests:
+26: -------------
+26: 1) TestUprobes.test_simple_library
+26: test_uprobes.lua:38: expected: 2, actual: 0
+26: stack traceback:
+26: test_uprobes.lua:38: in function 'TestUprobes.test_simple_library'
+26:
+26: Ran 2 tests in 0.141 seconds, 1 successes, 1 failures
+26: Failed
+26/28 Test #26: lua_test_uprobes .................***Failed 0.27 sec
+
+test 28
+ Start 28: lua_test_standalone
+
+28: Test command: /home/mikep/bcc/tests/lua/test_standalone.sh
+28: Test timeout computed to be: 9.99988e+06
+28: + cd src/lua
+28: + [[ ! -x bcc-lua ]]
+28: + ldd bcc-lua
+28: + grep -q luajit
+28: + rm -f libbcc.so probe.lua
+28: + echo 'return function(BPF) print("Hello world") end'
+28: + ./bcc-lua probe.lua
+28: Hello world
+28: + fail 'bcc-lua runs without libbcc.so'
+28: + echo 'test failed: bcc-lua runs without libbcc.so'
+28: test failed: bcc-lua runs without libbcc.so
+28: + exit 1
+28/28 Test #28: lua_test_standalone ..............***Failed 0.01 sec
+```
+
## Ubuntu - Source
To build the toolchain from source, one needs:
Section: misc
Priority: optional
Standards-Version: 3.9.5
-Build-Depends: debhelper (>= 9), cmake, libllvm3.7 | libllvm3.8, llvm-3.7-dev | llvm-3.8-dev, libclang-3.7-dev | libclang-3.8-dev, libelf-dev, bison, flex, libedit-dev, clang-format | clang-format-3.7, python-netaddr, python-pyroute2, luajit, libluajit-5.1-dev
+Build-Depends: debhelper (>= 9), cmake, libllvm3.7 | libllvm3.8,
+ llvm-3.7-dev | llvm-3.8-dev, libclang-3.7-dev | libclang-3.8-dev,
+ libelf-dev, bison, flex, libedit-dev,
+ clang-format | clang-format-3.7 | clang-format-3.8, python (>= 2.7),
+ python-netaddr, python-pyroute2, luajit, libluajit-5.1-dev, arping,
+ inetutils-ping | iputils-ping, iperf, netperf, ethtool
Homepage: https://github.com/iovisor/bcc
Package: libbcc
ipdb = IPDB(nl=ipr)
sim = Simulation(ipdb)
+allocated_interfaces = set(ipdb.interfaces.keys())
+
+def get_next_iface(prefix):
+ i = 0
+ while True:
+ iface = "{0}{1}".format(prefix, i)
+ if iface not in allocated_interfaces:
+ allocated_interfaces.add(iface)
+ return iface
+ i += 1
class TestBPFSocket(TestCase):
def setup_br(self, br, veth_rt_2_br, veth_pem_2_br, veth_br_2_pem):
br1.add_port(ipdb.interfaces[veth_rt_2_br])
br1.up()
subprocess.call(["sysctl", "-q", "-w", "net.ipv6.conf." + br + ".disable_ipv6=1"])
-
+
def set_default_const(self):
self.ns1 = "ns1"
self.ns2 = "ns2"
self.ns_router = "ns_router"
- self.br1 = "br1"
+ self.br1 = get_next_iface("br")
self.veth_pem_2_br1 = "v20"
self.veth_br1_2_pem = "v21"
- self.br2 = "br2"
+ self.br2 = get_next_iface("br")
self.veth_pem_2_br2 = "v22"
self.veth_br2_2_pem = "v23"