Commit a833369b authored by Vicent Marti's avatar Vicent Marti

lua: Fix tests to work in strict mode

parent 818eac98
require("test_helper")
TestClang = {}
local suite = require("test_helper")
local TestClang = {}
function TestClang:test_probe_read1()
local text = [[
......@@ -329,4 +328,4 @@ function TestClang:test_syntax_error()
BPF, {text=[[int failure(void *ctx) { if (); return 0; }]]})
end
os.exit(LuaUnit.run())
suite("TestClang", TestClang)
require("test_helper")
local suite = require("test_helper")
local TestDump = {}
function test_dump_func()
function TestDump:test_dump_func()
local raw = "\xb7\x00\x00\x00\x01\x00\x00\x00\x95\x00\x00\x00\x00\x00\x00\x00"
local b = BPF:new{text=[[int entry(void) { return 1; }]]}
assert_equals(b:dump_func("entry"), raw)
end
os.exit(LuaUnit.run())
suite("TestDump", TestDump)
......@@ -12,6 +12,12 @@ USE_EXPECTED_ACTUAL_IN_ASSERT_EQUALS = false
EXPORT_ASSERT_TO_GLOBALS = true
require("luaunit")
BCC = require("bcc.init")
BPF = BCC.BPF
rawset(_G, "BCC", require("bcc.init"))
rawset(_G, "BPF", BCC.BPF)
log.enabled = false
return function (name, f)
rawset(_G, name, f)
os.exit(LuaUnit.run())
end
require("test_helper")
local suite = require("test_helper")
local ffi = require("ffi")
local TestUprobes = {}
ffi.cdef[[
int getpid(void);
void malloc_stats(void);
]]
TestUprobes = {}
function TestUprobes:test_simple_library()
local text = [[
#include <uapi/linux/ptrace.h>
......@@ -68,4 +67,4 @@ function TestUprobes:teardown()
BPF.cleanup_probes()
end
os.exit(LuaUnit.run())
suite("TestUprobes", TestUprobes)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment