Debian Codegraph @

tests/README

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