1 README for ltrace testsuite
2 18, October, 2005 by Yao Qi <qiyao@cn.ibm.com>
4 This is the README file for ltrace testsuite.
9 This testsuite is based on the dejagnu framework, which is again
10 dependent on Expect and Tcl. So all these three package (tcl, expect
11 and dejagnu) should be installed on your system before running these
14 After unpacking file ltrace-0.3.36.tar.gz:
16 tar -zxvfm ltrace-0.3.36.tar.gz
18 you'll find a directory named ltrace-0.3.36, which contains:
20 debian etc testsuite sysdeps
22 you can first build this package, then run the testsuite in the
27 2 Confiugre ltrace for 32-bit mode or 64-bit mode.
29 OR CC='gcc -m64' ./configure
34 4 Run all the test in default mode.
37 The default is to test the ltrace just built, using the default
38 compiler options. You can control this by adding a symbol to 'make check':
40 To test the shipped ltrace tool (as opposed to the just built by "make")
42 --tool_exec=/usr/bin/ltrace
44 To change compiler switches for the target test cases
46 CFLAGS_FOR_TARGET=-m64
48 To change the target compiler (instead of shipped gcc)
50 CC_FOR_TARGET=/opt/gcc-4.0/bin/gcc
53 You can run all the tests in different mode respectively as follows,
55 (1) ./run-my-tests.sh -m32
58 (test ltrace in build tree and compile test cases in 32-bit mode)
60 (2) ./run-my-tests.sh -m64
61 OR make check RUNTESTFLAGS="CFLAGS_FOR_TARGET=-m64"
63 (test ltrace in build tree and compile test cases in 64-bit mode)
65 (3) ./run-my-tests.sh -m32 /usr/bin/ltrace
66 OR make check RUNTESTFLAGS="--tool_exec=/usr/bin/ltrace"
68 (test shipped ltrace and compile test cases in 32-bit mode)
70 (4) ./run-my-tests.sh -m64 /usr/bin/ltrace
71 OR make check RUNTESTFLAGS="--tool_exec=/usr/bin/ltrace CFLAGS_FOR_TARGET=-m64"
73 (run shipped ltrace and compile test cases in 64-bit mode)
75 (5) cd testsuite; make test
77 (run ltrace in build tree and compile test cases same as ltrace itself)
80 (6) make check RUNTESTFLAGS="--tool_exec=/usr/bin/ltrace CFLAGS_FOR_TARGET=-m64 CC_FOR_TARGET=/opt/gcc-4.0/bin/gcc"
82 (run shipped ltrace and compile test cases in 64 bit mode by /opt/gcc-4.0/bin/gcc)
86 This testsuite for ltrace is a DejaGNU based testsuite that can
87 either be used to test your newly built ltrace, or for regression
88 testing a ltrace with local modifications.
90 Running the testsuite requires the prior installation of DejaGNU.
91 The directory ftp://sources.redhat.com/pub/dejagnu/ will contain a
92 recent snapshot. Once DejaGNU is installed or built and add the
93 location of runtest into $PATH, you can run the tests in one of the
94 four ways it mentioned in Quick Overview. The DejaGNU framework could
95 be built in following steps:
97 1 Uppack these three packages.
98 tar zxvf dejagnu-1.4.4.tar.gz
99 tar zxvf tcl8.4.9-src.tar.gz
100 tar zxvf expect-5.43.0.tar.gz
102 2 Build them and install.
121 See the DejaGNU documentation and dejagnu-1.4.4/README for further
125 Componets in ltrace testsuite
126 =============================
128 This testsuite include all the source code you need for ltrace
129 test in a single directory, which is "ltrace-0.3.36/testsuite".
130 This directory includes the following files and sub-directories:
133 configuration file for dejagnu-based test.
136 some basic functions used in all the test cases.
139 some basic tests for major fetures of ltrace.
141 (1) ltrace.main/main.exp does tests on tracing a function
142 implemented in a shared library.
144 (2) ltrace.main/main-internal.exp does tests on tracing a function
145 implemented in main executable.
147 (3) ltrace.main/signals.exp do test on tracing user-defined signals
148 sent by program to itself.
150 (4) ltrace.main/system_calls.exp do test on tracing all the system
154 some tests for minor fetures of ltrace.
156 (1) ltrace.minor/attach-process.exp do test on attching a process.
158 (2) ltrace.minor/count-record.exp do test on counting time and
161 (3) ltrace.minor/demangle.exp do test on demangling the C++ symbols.
163 (4) ltrace.minor/time-record-T.exp do test on showing the time spent
166 (5) ltrace.minor/time-record-tt.exp
167 (6) ltrace.minor/time-record-ttt.exp do test on printing absolute
168 timestamps in different format.
170 (7) ltrace.minor/trace-clone.exp do test on following clone to child
173 (8) ltrace.minor/trace-fork.exp do test on following fork to child
177 some tests in extreme condations.
179 (1) ltrace.torture/signals.exp do test on tracing flooded signals
180 send to program itself.
185 (1) Running ltrace with -u option requires the superuser privilege.
186 You must make sure you are root or have already got root's password.
188 (2) Check the *.ltrace files in each ltrace.* directories if there are
189 some FAILs in the output. They are informative.
191 (3) Add --verbose option in RUNTESTFLAGS when 'make check' if you want
192 to see more details of these tests.
197 Current testsuite is quite basic. The framework of testsuite is
198 extendable and scalealbe, so you can add new testcases into it easily.
199 I will describe how to do that in different ways.
201 (1) Add new test case in an existed testcase directory.
203 It is simple. Just add a foo.exp script and a relevant foo.c if
204 necessary. The dejagnu framework can run that script automatically when
205 you run "make check". The executable and object file would be generate
206 in the test, please add them in 'clean' entry in Makefile.in to ensure
207 that they could be cleaned up automatically when run 'make clean'.
209 (2) Add new test case in a new testcase directory.
211 It is a little complicated. Fisrt create a new directory in
212 testsuite/ with the same pattern as others, for example ltrace.bar,
213 and then create a Makefile.in, an Expect script foo.exp, and relative
214 foo.c if necessary. Then modify the configure.ac in ltrace-0.3.36/,
215 and add "testsuite/ltrace.bar/Makefile" into macro AC_OUTPUT,
216 testsuite/ltrace.bar/Makefile will be generated when you configure
219 Adding Makefile.in in the new directroy is just to remove
220 intermediate files and log files automatically later, such as foo.ltrace,
221 object files and executables. For example, if you want to remove A.ltrace,
222 B.ltrace, A and B at the time of cleanup, you can write Makefile.in
232 At last add the new directory 'ltrace.bar' into the macro SUBDIRS
233 in testsuite/Makefile.in.
235 Rerun the autoconf and ./configure in ./ltrace-0.3.36, the Makefile
241 (this is for editing this file with GNU emacs)