From Fedora Project Wiki

(convert to new category system)
(updated to match current abrt)
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{QA/Test_Case
{{QA/Test_Case
|description=This test case tests the functionality of the [[Features/ABRT|ABRT]] Python exception handler.
|description=This test case tests the functionality of the ABRT Python exception handler.
|actions=
|actions=
# Ensure the package is installed: {{command|su -c 'yum install abrt-addon-python'}}
# Ensure the package is installed: {{command|su -c 'yum install abrt-addon-python'}}
# Confirm in {{filename|/etc/abrt/plugins/Python.conf}} that the '''Python''' addon is enabled. The conf file should contain this line: <tt>Enabled = Yes</tt>
# Find a python {{filename|.py}} file which is part of an official Fedora package. For example, {{filename|/usr/bin/pydoc}} which is provided by the {{package|python}} package. Other files you might use for experiments: /usr/bin/pygtk-demo, /usr/bin/yum, /usr/bin/fetch_file
# Next, ensure that {{filename|/etc/abrt/abrt.conf}} has at least one reporter defined for the '''Python''' addon.  For example, <tt>Python = Logger, Mailx</tt>
# Make a back-up of the file: {{command|su -c 'cp -a /usr/bin/pydoc /usr/bin/pydoc.save'}}
# Restart ABRT with the command {{command|su -c 'service abrtd restart'}}
# Edit the file to contain some invalid Python code.  Add "0/0" (without quotes) line near the top (after the line which begins with ''#'').
# Find a python {{filename|.py}} file which is part of an official Fedora package. For example, {{filename|/usr/share/doc/smolt-1.*/lite2my.py}} which is provided by the {{package|smolt}} package. First, save a back-up of the file: {{command|su -c 'cp -a /usr/share/doc/smolt-1.*/lite2my.py /tmp/'}}
# Execute the modified file.
# Now, edit the file {{filename|/usr/share/doc/smolt-1.*/lite2my.py}} to contain some invalid Python code.  For example,
# Revert the modified python file: {{command|su -c 'cp -a /usr/bin/pydoc.save /usr/bin/pydoc'}}
#: <pre>
#: #!/usr/bin/python
#: "11" + 11</pre>
# Next, execute the modified file using python.  For example, in terminal type: {{command|python /usr/share/doc/smolt-1.*/lite2my.py}}
# Revert the modified python file: {{command|su -c 'cp -a /tmp/lite2my.py /usr/share/doc/smolt-1.*/lite2my.py'}}
|results=
|results=
# A python traceback should be generated at the command line:
# A python traceback should be generated at the command line:
#: <pre>
#:Traceback (most recent call last):
#: Traceback (most recent call last):
#: File "/usr/bin/pydoc", line 3, in <module>
#:   File "/usr/share/doc/smolt-1.4.2.2/lite2my.py", line 2, in <module>
#:   0/0
#:     print "11" + 11
# ABRT should catch the traceback, and if you inspect the report via {{command|gnome-abrt}}, the trace in report window should be the same as in the terminal where you executed the command
#: TypeError: cannot concatenate 'str' and 'int' objects</pre>
# ABRT should catch the traceback, and if you inspect the report via {{command|abrt-gui}}, the trace in report window should be the same as in the terminal where you executed the command
# The ABRT plugin should not cause any unintended behaviour in python scripts when installed
# The ABRT plugin should not cause any unintended behaviour in python scripts when installed
}}
}}
[[Category:Package_abrt_test_cases]]
[[Category:Package_abrt_test_cases]]

Revision as of 12:22, 3 May 2013

Description

This test case tests the functionality of the ABRT Python exception handler.


How to test

  1. Ensure the package is installed: su -c 'yum install abrt-addon-python'
  2. Find a python .py file which is part of an official Fedora package. For example, /usr/bin/pydoc which is provided by the Package-x-generic-16.pngpython package. Other files you might use for experiments: /usr/bin/pygtk-demo, /usr/bin/yum, /usr/bin/fetch_file
  3. Make a back-up of the file: su -c 'cp -a /usr/bin/pydoc /usr/bin/pydoc.save'
  4. Edit the file to contain some invalid Python code. Add "0/0" (without quotes) line near the top (after the line which begins with #).
  5. Execute the modified file.
  6. Revert the modified python file: su -c 'cp -a /usr/bin/pydoc.save /usr/bin/pydoc'

Expected Results

  1. A python traceback should be generated at the command line:
    Traceback (most recent call last):
    File "/usr/bin/pydoc", line 3, in <module>
    0/0
  2. ABRT should catch the traceback, and if you inspect the report via gnome-abrt, the trace in report window should be the same as in the terminal where you executed the command
  3. The ABRT plugin should not cause any unintended behaviour in python scripts when installed