Follow-up to r29036: Now that the "mergeinfo" transaction file is no
[svn.git] / tools / dev / gcov.patch
blob5b718b5d4d3488909210f5a0addc4f2a7bfabe6d
1 This patch can be used to generate a report showing what C source
2 lines are executed when the testsuite is run. gcc is required. After
3 applying this patch do:
5 $ ./configure --enable-gcov
6 $ make check
7 $ make gcov
9 Now look at gcov-report.html and the annotated source files it links
10 to.
12 See also gcov(1), gcc(1).
14 Index: Makefile.in
15 ===================================================================
16 --- Makefile.in (revision 8987)
17 +++ Makefile.in (working copy)
18 @@ -326,6 +326,36 @@
19 @$(MAKE) check \
20 BASE_URL=svn+ssh://localhost`pwd`/subversion/tests/clients/cmdline
22 +gcov:
23 + @echo -n "Collecting source files ..." ; \
24 + FILES=`find subversion/ -path '*/tests/*' -prune -o \
25 + -name '*.c' -print`; \
26 + echo "Done." ; \
27 + echo "Coverage report Subversion r`svnversion .`<br>" \
28 + echo "`date`<br>" \
29 + > gcov-report.html; \
30 + echo `uname -o -r -m` "<br>" \
31 + >> gcov-report.html; \
32 + (for file in $$FILES; do \
33 + echo $$file 1>&2 ; \
34 + base=`echo $$file | sed -e 's/.c$$//' `; \
35 + if [ -f "$$base.da" ] ; then \
36 + obj=$$base.o; \
37 + else \
38 + obj=`dirname $$base`/.libs/`basename $$base`.o; \
39 + fi; \
40 + stats=`gcov --preserve-paths \
41 + --object-directory=$$obj \
42 + $$file | sed -e "s/Creating.*//" | \
43 + sed -s "s|$$PWD/||"` \
44 + mangled=`echo $$base | tr '/' '#'`; \
45 + fixed=`echo $$base | tr '/' '_'`; \
46 + mv *$$mangled.c.gcov $$fixed.c.gcov; \
47 + echo -n $$stats | \
48 + sed -e "s/in file/in file <a href=\"$$fixed.c.gcov\">/"; \
49 + echo "</a><br>"; \
50 + done) | sort -g >> gcov-report.html
52 check-clean:
53 rm -rf subversion/tests/clients/cmdline/repositories \
54 subversion/tests/clients/cmdline/working_copies \
55 Index: configure.in
56 ===================================================================
57 --- configure.in (revision 8987)
58 +++ configure.in (working copy)
59 @@ -323,6 +323,15 @@
63 +AC_ARG_ENABLE(gcov,
64 +AC_HELP_STRING([--enable-gcov],
65 + [Turn on coverage testing (GCC only).]),
67 + if test "$enableval" = "yes" ; then
68 + CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
69 + fi
70 +])
72 AC_ARG_WITH(editor,
73 AC_HELP_STRING([--with-editor=PATH],
74 [Specify a default editor for the subversion client.]),