From db412054394302aa0fa4f8cd171bfc82d82f7412 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 21 Dec 2016 10:21:05 -0600 Subject: [PATCH] Add python 2.6 (RHEL6) probe support. * tapset/python2.stp: Add python 2.6 (RHEL6) support. * testsuite/systemtap.python/python2.exp: Ditto. --- tapset/python2.stp | 33 +++++++++++++------------- testsuite/systemtap.python/python2.exp | 16 ++++++++++--- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/tapset/python2.stp b/tapset/python2.stp index 12f5dedfc..b72159210 100644 --- a/tapset/python2.stp +++ b/tapset/python2.stp @@ -69,69 +69,70 @@ # current version of python 2 library on most systems. On older # systems, that version number might be different. If we could use # wildcards in @cast module paths we could work around this problem -# (see PR20394). +# (see PR20394). To work around this issue, we'll include 2.6 +# versions of the shared library in the @cast module list. # ########################################### @define Py2Object(object) %( @cast(@object, "PyObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2VarObject(object) %( @cast(@object, "PyVarObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2IntObject(object) %( @cast(@object, "PyIntObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2StringObject(object) %( @cast(@object, "PyStringObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2TypeObject(object) %( @cast(@object, "PyTypeObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2TupleObject(object) %( @cast(@object, "PyTupleObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2ListObject(object) %( @cast(@object, "PyListObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2SetObject(object) %( @cast(@object, "PySetObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2DictObject(object) %( @cast(@object, "PyDictObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2DictEntry(object) %( @cast(@object, "PyDictEntry", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2FrameObject(object) %( @cast(@object, "PyFrameObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2CodeObject(object) %( @cast(@object, "PyCodeObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2LongObject(object) %( @cast(@object, "PyLongObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2ClassObject(object) %( @cast(@object, "PyClassObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) @define Py2InstanceObject(object) %( @cast(@object, "PyInstanceObject", - "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so") + "python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so:/usr/lib64/libpython2.6.so:/usr/lib/libpython2.6.so") %) # diff --git a/testsuite/systemtap.python/python2.exp b/testsuite/systemtap.python/python2.exp index 9428ecba1..f051ea15e 100644 --- a/testsuite/systemtap.python/python2.exp +++ b/testsuite/systemtap.python/python2.exp @@ -11,6 +11,16 @@ if {! [file exists "$PYTHON"]} { then untested $test; return } # modify PYTHONPATH. set env(PYTHONPATH) $env(PYEXECDIR) +# +# In python 2.6, you have to specify the package name to run, like +# 'python -m HelperSDT.__main__'. In python 2.7, using '__main__' is +# automatic. Figure out what we need to do. +if {! [catch {exec sh -c "$PYTHON -V 2>&1 | fgrep -q 2.6"} dummy]} { + set module_name "HelperSDT.__main__" +} else { + set module_name "HelperSDT" +} + # # Test python backtraces. # @@ -49,7 +59,7 @@ pass "$test: debuginfo check" set traceback_lines 0 set error_seen 0 set returning_seen 0 -spawn stap $srcdir/$subdir/celsius-bt.stp -c "$PYTHON -m HelperSDT celsius.py 30" python2 +spawn stap $srcdir/$subdir/celsius-bt.stp -c "$PYTHON -m $module_name celsius.py 30" python2 expect { -timeout 120 -re {^30 Celsius is 86 Farenheit\r\n} { exp_continue } @@ -94,7 +104,7 @@ if {[catch {exec cp $srcdir/$subdir/python-var.py . 2>@1} out]} { set error_seen 0 # Note that we're incrementing MAXACTION, since we're doing lots of # actions in each probe. -spawn stap -DMAXACTION=2000 $srcdir/$subdir/python-var.stp -c "$PYTHON -m HelperSDT python-var.py" python2 +spawn stap -DMAXACTION=2000 $srcdir/$subdir/python-var.stp -c "$PYTHON -m $module_name python-var.py" python2 set types {"none" "type" "bool" "int" "long" "float" "complex" \ "string" "unicode" "tuple" "list" "xrange" "dictionary" \ "function" "class" "unbound" "instance" "method" "zip" \ @@ -266,7 +276,7 @@ set traceback_lines 0 set error_seen 0 set balance1_seen 0 set balance2_seen 0 -spawn stap $srcdir/$subdir/class.stp -c "$PYTHON -m HelperSDT class.py" python2 +spawn stap $srcdir/$subdir/class.stp -c "$PYTHON -m $module_name class.py" python2 expect { -timeout 120 -re {^Checkings current balance is: 10\r\n} { exp_continue } -- 2.43.5