xref: /aosp_15_r20/external/bcc/tests/lua/test_helper.lua (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1function setup_path()
2  local str = require("debug").getinfo(2, "S").source:sub(2)
3  local cwd = str:match("(.*/)")
4  local bpf_path = cwd.."/../../src/lua/?.lua;"
5  local test_path = cwd.."/?.lua;"
6  package.path = bpf_path..test_path..package.path
7end
8
9setup_path()
10
11USE_EXPECTED_ACTUAL_IN_ASSERT_EQUALS = false
12EXPORT_ASSERT_TO_GLOBALS = true
13require("luaunit")
14
15rawset(_G, "BCC", require("bcc.init"))
16rawset(_G, "BPF", BCC.BPF)
17
18log.enabled = false
19
20return function (name, f)
21  rawset(_G, name, f)
22  os.exit(LuaUnit.run())
23end
24