Changeset 3e23850


Ignore:
Timestamp:
2013-02-11T12:56:03Z (11 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
5a0ffa2
Parents:
7e5b4bd
git-author:
Mike Kazantsev <mk.fraggod@…> (11-02-13 12:56:03)
git-committer:
Miklos Vajna <vmiklos@…> (11-02-13 12:56:03)
Message:

skype: add ATTACH_GDB env flag, extend hacking instructions with info on pexpect/gdb

Location:
protocols/skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/skype/HACKING

    r7e5b4bd r3e23850  
    18184) irssi
    1919
     20
    2021== Tests
    2122
    2223The plugin is tested with a mocked IRC client and a mocked skyped.
     24
     25=== Requirements
     26
     27Python pexpect module is required to run the tests.
    2328
    2429To run tests with bitlbee built in a development tree and not (the one)
     
    3136which is probably not what you want to test, or produce "Unknown protocol"
    3237error.
     38
     39=== Running
     40
     41Tests can be run by running test.py script in this ("protocols/skype")
     42directory.
     43
     44For more control over how/which tests are being run from there, use "python -m
     45unittest" command:
     46
     47bitlbee/protocols/skype% python -m unittest test
     48bitlbee/protocols/skype% python -m unittest -f test
     49bitlbee/protocols/skype% python -m unittest test.Test.testMsg
     50
     51If bitlbee crashes during tests with SIGSEGV (segmentation fault), it's likely
     52that there is some problem with skype.c plugin.
     53To get a backtrace of such crash, use:
     54
     55bitlbee/protocols/skype% ATTACH_GDB=true python -m unittest test.Test.testMsg
     56
     57Example shows running "testMsg" test with gdb attached to bitlbee, which will
     58produce full backtrace in "t/gdb-<pid>.log" files (see pid in pexpect error
     59output of the test).
     60
     61=== Adding new tests
    3362
    3463To add a new test, the following steps are necessary:
  • protocols/skype/test.py

    r7e5b4bd r3e23850  
    2525                        try:
    2626                                bitlbee = pexpect.spawn('../../bitlbee', ['-d', 't/bitlbee'], logfile=pexpect_log)
     27                                if os.environ.get('ATTACH_GDB'):
     28                                        subprocess.Popen(['gdb', '-batch-silent',
     29                                                '-ex', 'set logging overwrite on',
     30                                                '-ex', 'set logging file t/gdb-%s.log' % bitlbee.pid,
     31                                                '-ex', 'set logging on',
     32                                                '-ex', 'handle all pass nostop noprint',
     33                                                '-ex', 'handle SIGSEGV pass stop print',
     34                                                '-ex', 'set pagination 0',
     35                                                '-ex', 'continue',
     36                                                '-ex', 'backtrace full',
     37                                                '-ex', 'info registers',
     38                                                '-ex', 'thread apply all backtrace',
     39                                                '-ex', 'quit',
     40                                                '../../bitlbee', str(bitlbee.pid) ])
    2741                                bitlbee_mock = open("t/%s-bitlbee.mock" % name)
    2842                                for i in bitlbee_mock.readlines():
Note: See TracChangeset for help on using the changeset viewer.