test stap func. in CI

Change-Id: I3d50437e13679915e05f46355788cd362a3ff4e9
This commit is contained in:
Kun Huang 2015-11-01 21:33:10 +08:00
parent 62ac895415
commit 95f55c330f
3 changed files with 52 additions and 0 deletions

14
tests/ci/pyfunc.stp Normal file
View 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)
}

View File

@ -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
View 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