| 1 |
How these tests work: |
| 2 |
|
| 3 |
Dejagnu finds all *.c files, compiles them and runs them in a temporary |
| 4 |
directory while running the systemtap script sys.stp. |
| 5 |
|
| 6 |
If you need to know why a test is failing you can look in the test log, or |
| 7 |
> gcc -o testname testname.c |
| 8 |
> test-debug.tcl testname |
| 9 |
|
| 10 |
|
| 11 |
HOW TO WRITE TESTS |
| 12 |
|
| 13 |
1. write a test case C file using some system calls. |
| 14 |
|
| 15 |
2. After each system call, put a comment on the next line starting with "//" |
| 16 |
The comment should have the expected output. Where an arbitrary number |
| 17 |
is expected, put "NNNN" (for decimal) or "XXXX" (for hex). Or you can |
| 18 |
just write regular expressions. The "NNNN" and "XXXX" are just shorthand to |
| 19 |
aid readability and are converted to regular expressions in test.tcl. |
| 20 |
|
| 21 |
Normally opening and closing parentheses ('(' and ')') get quoted. If |
| 22 |
you want unquoted parentheses, use '[[[[' (for '(') or ']]]]' (for ')'). |
| 23 |
|
| 24 |
In addition, pipe characters ('|') get quoted. If you want an unquoted |
| 25 |
pipe, use '!!!!'. |
| 26 |
|
| 27 |
3. Somewhere is your test program puts a comment line like this: |
| 28 |
/* COVERAGE: syscall1 syscall2 ... */ |
| 29 |
where you list the systemcalls that are tested. Then you can run |
| 30 |
coverage.tcl and get a coverage report. |
| 31 |
|
| 32 |
You probably want to write your test case without the comments first. Make |
| 33 |
sure it compiles and works as expected. Then try it with |
| 34 |
"stap sys.stp -c ./testname" or test-debug.tcl to see the output. |
| 35 |
|
| 36 |
IMPORTANT: Note that the test scripts create a temporary directory for each |
| 37 |
test program. Each program will run in an empty directory. |