1 | == Tabs |
---|
2 | |
---|
3 | I use the following tabs during the development: |
---|
4 | |
---|
5 | 1) bitlbee-skype: |
---|
6 | |
---|
7 | vim, make, etc. |
---|
8 | |
---|
9 | 2) bitlbee: |
---|
10 | |
---|
11 | gdb --args ./bitlbee -v -n -D |
---|
12 | run |
---|
13 | |
---|
14 | 3) skyped: |
---|
15 | |
---|
16 | python skyped.py -n -d |
---|
17 | |
---|
18 | 4) irssi |
---|
19 | |
---|
20 | |
---|
21 | == Tests |
---|
22 | |
---|
23 | The plugin is tested with a mocked IRC client and a mocked skyped. |
---|
24 | |
---|
25 | === Requirements |
---|
26 | |
---|
27 | Python pexpect module is required to run the tests. |
---|
28 | |
---|
29 | To run tests with bitlbee built in a development tree and not (the one) |
---|
30 | installed in the system (e.g. /usr), make sure to specify --plugindir= option to |
---|
31 | ./configure script during the build process: |
---|
32 | |
---|
33 | bitlbee% ./configure --skype=1 --plugindir="$(realpath .)" |
---|
34 | |
---|
35 | Otherwise bitlbee will try to load skype.so (among other things) from /usr/lib, |
---|
36 | which is probably not what you want to test, or produce "Unknown protocol" |
---|
37 | error. |
---|
38 | |
---|
39 | === Running |
---|
40 | |
---|
41 | Tests can be run by running test.py script in this ("protocols/skype") |
---|
42 | directory. |
---|
43 | |
---|
44 | For more control over how/which tests are being run from there, use "python -m |
---|
45 | unittest" command: |
---|
46 | |
---|
47 | bitlbee/protocols/skype% python -m unittest test |
---|
48 | bitlbee/protocols/skype% python -m unittest -f test |
---|
49 | bitlbee/protocols/skype% python -m unittest test.Test.testMsg |
---|
50 | |
---|
51 | If bitlbee crashes during tests with SIGSEGV (segmentation fault), it's likely |
---|
52 | that there is some problem with skype.c plugin. |
---|
53 | To get a backtrace of such crash, use: |
---|
54 | |
---|
55 | bitlbee/protocols/skype% ATTACH_GDB=true python -m unittest test.Test.testMsg |
---|
56 | |
---|
57 | Example shows running "testMsg" test with gdb attached to bitlbee, which will |
---|
58 | produce full backtrace in "t/gdb-<pid>.log" files (see pid in pexpect error |
---|
59 | output of the test). |
---|
60 | |
---|
61 | === Adding new tests |
---|
62 | |
---|
63 | To add a new test, the following steps are necessary: |
---|
64 | |
---|
65 | 1) Add a new -skyped.mock file: just do the test manually, copy&paste the |
---|
66 | skyped output and clean it up, so Alice talks to Bob. You can test the created |
---|
67 | mock file by starting skyped with the -m option, and testing it from an IRC |
---|
68 | client manually. |
---|
69 | |
---|
70 | 2) Add a new -bitlbee.mock file: do the test manually from irssi, and use: |
---|
71 | |
---|
72 | /connect -rawlog rawlog localhost |
---|
73 | |
---|
74 | Then clean up the rawlog: the input lines are parsed as matching patterns, so |
---|
75 | boring prefix/suffix text can be left out, non-interesting lines can be |
---|
76 | deleted. The output lines still have to be strict IRC commands, as usual. |
---|
77 | |
---|
78 | 3) Add the new test to test.py and run it! |
---|
79 | |
---|
80 | // vim: ft=asciidoc |
---|