1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
The directory contains test suite for libchewing.
Here are the instructions:
1. Build
# make
2. Test default test case.
# make check
3. Simulate batch testing
# ./simulate
4. (Optional) Use your own test cases.
# ./genkeystroke test.txt
# cat test.txt | ./testchewing
5. (Optional) Stress test for libchewing robustness.
# ./randkeystroke | ./testchewing
Note:
1. The hash data is generated in current path, and feel free
to replace with any existing hash.dat like:
# cp -f ~/.chewing/uhash.dat .
2. The way to debug genkeystroke via gdb is a bit tricky since it uses ncurses
library. First, launch two X terminals such as rxvt. Assume X Terminal (1)
is the window where the expected ncurses application shows, and X Terminal
(2) the one where gdb runs.
X Terminal (1) X Terminal (2)
[where ncurses shows] [where gdb runs]
+-----------------+ +-------------------------------------------+
| $ tty | | $ libtool --mode=execute gdb genkeystroke |
| /dev/ttyp0 | | (gdb) tty /dev/ttyp0 |
| $ sleep 100000 | | (gdb) b main |
| (genkeystroke) | | (gdb) r test.txt |
+-----------------+ +-------------------------------------------+
Run "tty" inside X Terminal (1) to obtain the pseudo-tty device. It shows
"/dev/ttyp0" in the above example, and then we let shell sleep in order to
accept the I/O redirection from gdb session.
Inside gdb debugging session, it is the window, X Terminal (2), launching
the test suite program, genkeystroke, as usual. Then, pass the command
"tty /dev/ttyp0", obtained from X Terminal (1). Set the breakpoints and
run program after that. Of course, you shall make key strokes inside X
Terminal (1) instead of X Terminal (2) if you would like to input on test
suite.
Alternately, the automated script "debug-chewing-shell.sh" covers the above
actions. Change the variable $PREFERABLE_XTERM to other X terminals like
xterm as you wish.
3. Please do not change the content of default-test.txt, put your own test case
in other txt file.
|