diff --git a/tests/ci/pyfunc.stp b/tests/ci/pyfunc.stp new file mode 100644 index 0000000..c78e6a7 --- /dev/null +++ b/tests/ci/pyfunc.stp @@ -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) +} diff --git a/tests/ci/scalpels-ci.sh b/tests/ci/scalpels-ci.sh index 4bfaa9c..d5bcc65 100755 --- a/tests/ci/scalpels-ci.sh +++ b/tests/ci/scalpels-ci.sh @@ -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 diff --git a/tests/ci/test-func.py b/tests/ci/test-func.py new file mode 100644 index 0000000..94a6ddc --- /dev/null +++ b/tests/ci/test-func.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- +# Author: Kun Huang + +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