test stap func. in CI
Change-Id: I3d50437e13679915e05f46355788cd362a3ff4e9
This commit is contained in:
parent
62ac895415
commit
95f55c330f
14
tests/ci/pyfunc.stp
Normal file
14
tests/ci/pyfunc.stp
Normal file
@ -0,0 +1,14 @@
|
||||
probe python.function.entry = process("/opt/stack/data/cpython_build/bin/python").mark("function__entry")
|
||||
{
|
||||
filename = user_string($arg1);
|
||||
funcname = user_string($arg2);
|
||||
lineno = $arg3;
|
||||
callargs = user_string($arg4);
|
||||
kwdict = user_string($arg5);
|
||||
}
|
||||
|
||||
probe python.function.entry
|
||||
{
|
||||
if (isinstr(funcname, "hk"))
|
||||
printf("%s\t%s\t%d\t%s\t%s\n", filename, funcname, lineno, callargs, kwdict)
|
||||
}
|
@ -38,6 +38,12 @@ function report_html_test {
|
||||
sca report --html > $BASE/logs/scalpels-report.html
|
||||
}
|
||||
|
||||
function stap_test {
|
||||
scal_ci=$BASE/new/scalpels/tests/ci/
|
||||
sudo stap -vvv $scal_ci/pyfunc.stp -c "$DATA_DIR/cpython_build/bin/python $scal_ci/test-func.py"
|
||||
}
|
||||
|
||||
debug_msg
|
||||
basic_test
|
||||
report_html_test
|
||||
stap_test
|
||||
|
32
tests/ci/test-func.py
Normal file
32
tests/ci/test-func.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding:utf-8 -*-
|
||||
# Author: Kun Huang <academicgareth@gmail.com>
|
||||
|
||||
def hk0():
|
||||
return 0
|
||||
|
||||
print hk0()
|
||||
|
||||
def hk1(a):
|
||||
b = a*a
|
||||
return b
|
||||
|
||||
print hk1(3) # 9
|
||||
|
||||
def hk2(a, *args):
|
||||
b = a * len(args)
|
||||
return b
|
||||
|
||||
print hk2(5, 'a', 'b', 'c') # 10
|
||||
|
||||
def hk3(a, **kw):
|
||||
b = a * kw.get('b')
|
||||
return b
|
||||
|
||||
print hk3(6, b=3) # 18
|
||||
|
||||
def hk4(a, b, *args):
|
||||
c = a * b * len(args)
|
||||
return c
|
||||
|
||||
print hk4(2, 3, 'b') #12
|
Loading…
Reference in New Issue
Block a user