summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.syscall/README
blob: 41e6d895771479c213c0cc7bb6a4da746290a8f7 (plain)
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
How these tests work:

Dejagnu finds all *.c files, compiles them and runs them in a temporary 
directory  while running the systemtap script sys.stp.  To avoid 
recompiling sys.stp over and over, the test.exp is smart enough to 
compile sys.stp once and save the module.


You can run all the tests here with
> runtest test.exp

You can run single tests with
> gcc -o testname testname.c
>./test.tcl testname

OR, if you want to run multiple tests and don't want all the delays
with recompiling sys.stp each time,

> stap -kp4 sys.stp
Keeping temporary directory "/tmp/stapPThTaQ"
> ./test.tcl testname /tmp/stapPThTaQ/*.ko
> ./test.tcl testname2 /tmp/stapPThTaQ/*.ko
...
> rm -rf /tmp/stapPThTaQ

Finally, if you need to know why a test is failing, use
"test-debug.tcl" exactly as above. After running the test, it will open a
window with the results and expected results.



HOW TO WRITE TESTS

1. write a test case C file using some system calls.

2. After each system call, put a comment on the next line starting with "//"
The comment should have the expected output.  Where an arbitrary number
is expected, put "NNNN" (for decimal) or "XXXX" (for hex). Or you can
just write regular expressions. The "NNNN" and "XXXX" are just shorthand to
aid readability and are converted to regular expressions in test.tcl.

3. Somewhere is your test program puts a comment line like this:
/* COVERAGE: syscall1 syscall2 ... */
where you list the systemcalls that are tested.  Then you can run 
coverage.tcl and get a coverage report.

You probably want to write your test case without the comments first. Make
sure it compiles and works as expected. Then try it with 
"stap sys.stp -c ./testname" or test-debug.tcl to see the output.

IMPORTANT: Note that the test scripts create a temporary directory for each 
test program. Each program will run in an empty directory.