Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7798147

Browse files
committed
Expand test coverage support to entire tree
Test coverage support now covers the entire source tree, including contrib, instead of just src/backend. In a related but independent development, the commands make coverage and make coverage-html can be run in any directory. This turned out to be much easier than feared. Besides a few ad hoc fixes to pass the make target down the tree, change all affected makefiles to list their directories in the SUBDIRS variable, changed from variants like DIRS and WANTED_DIRS. MSVC build fix was attempted as well.
1 parent e605fbc commit 7798147

File tree

12 files changed

+57
-62
lines changed

12 files changed

+57
-62
lines changed

GNUmakefile.in

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# PostgreSQL top level makefile
33
#
4-
# $PostgreSQL: pgsql/GNUmakefile.in,v 1.50 2009/01/15 01:53:49 momjian Exp $
4+
# $PostgreSQL: pgsql/GNUmakefile.in,v 1.51 2009/08/07 20:50:21 petere Exp $
55
#
66

77
subdir =
@@ -20,7 +20,7 @@ install:
2020
$(MAKE) -C config $@
2121
@echo "PostgreSQL installation complete."
2222

23-
installdirs uninstall:
23+
installdirs uninstall coverage:
2424
$(MAKE) -C doc $@
2525
$(MAKE) -C src $@
2626
$(MAKE) -C config $@
@@ -61,25 +61,6 @@ GNUmakefile: GNUmakefile.in $(top_builddir)/config.status
6161
./config.status $@
6262

6363

64-
##########################################################################
65-
66-
coverage:
67-
$(MAKE) -C src/backend $@
68-
69-
.PHONY: coverage-html
70-
coverage-html: coverage
71-
rm -rf coverage
72-
mkdir coverage
73-
$(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir)/src `find src/backend -name lcov.info -print`
74-
75-
ifeq ($(enable_coverage),yes)
76-
clean distclean maintainer-clean: clean-coverage-local
77-
.PHONY: clean-coverage-local
78-
clean-coverage-local:
79-
rm -rf coverage
80-
endif
81-
82-
8364
##########################################################################
8465

8566
distdir = postgresql-$(VERSION)

contrib/Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# $PostgreSQL: pgsql/contrib/Makefile,v 1.87 2009/03/25 23:20:01 tgl Exp $
1+
# $PostgreSQL: pgsql/contrib/Makefile,v 1.88 2009/08/07 20:50:21 petere Exp $
22

33
subdir = contrib
44
top_builddir = ..
55
include $(top_builddir)/src/Makefile.global
66

7-
WANTED_DIRS = \
7+
SUBDIRS = \
88
adminpack \
99
auto_explain \
1010
btree_gin \
@@ -42,29 +42,29 @@ WANTED_DIRS = \
4242
vacuumlo
4343

4444
ifeq ($(with_openssl),yes)
45-
WANTED_DIRS += sslinfo
45+
SUBDIRS += sslinfo
4646
endif
4747

4848
ifeq ($(with_ossp_uuid),yes)
49-
WANTED_DIRS += uuid-ossp
49+
SUBDIRS += uuid-ossp
5050
endif
5151

5252
ifeq ($(with_libxml),yes)
53-
WANTED_DIRS += xml2
53+
SUBDIRS += xml2
5454
endif
5555

5656
# Missing:
5757
# start-scripts \ (does not have a makefile)
5858

5959

6060
all install installdirs uninstall distprep clean distclean maintainer-clean:
61-
@for dir in $(WANTED_DIRS); do \
61+
@for dir in $(SUBDIRS); do \
6262
$(MAKE) -C $$dir $@ || exit; \
6363
done
6464

6565
# We'd like check operations to run all the subtests before failing.
6666
check installcheck:
67-
@CHECKERR=0; for dir in $(WANTED_DIRS); do \
67+
@CHECKERR=0; for dir in $(SUBDIRS); do \
6868
$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
6969
done; \
7070
exit $$CHECKERR

doc/src/sgml/regress.sgml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.63 2009/04/27 16:27:36 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.64 2009/08/07 20:50:21 petere Exp $ -->
22

33
<chapter id="regress">
44
<title id="regress-title">Regression Tests</title>
@@ -476,6 +476,7 @@ gmake coverage-html
476476
</screen>
477477
Then point your HTML browser
478478
to <filename>coverage/index.html</filename>.
479+
The <command>gmake</command> commands also work in subdirectories.
479480
</para>
480481

481482
<para>

src/Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/Makefile,v 1.45 2009/02/24 10:06:32 petere Exp $
7+
# $PostgreSQL: pgsql/src/Makefile,v 1.46 2009/08/07 20:50:22 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -73,5 +73,14 @@ distclean maintainer-clean:
7373
$(MAKE) -C test/thread $@
7474
rm -f Makefile.port Makefile.global
7575

76+
coverage:
77+
$(MAKE) -C timezone $@
78+
$(MAKE) -C backend $@
79+
$(MAKE) -C backend/utils/mb/conversion_procs $@
80+
$(MAKE) -C backend/snowball $@
81+
$(MAKE) -C interfaces $@
82+
$(MAKE) -C bin $@
83+
$(MAKE) -C pl $@
84+
7685

7786
.PHONY: install-local installdirs-local uninstall-local

src/Makefile.global.in

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.255 2009/08/04 22:04:37 petere Exp $
2+
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.256 2009/08/07 20:50:22 petere Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -617,12 +617,22 @@ lcov.info: $(gcda_files)
617617
%.c.gcov: %.gcda | lcov.info
618618
$(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
619619

620+
coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
621+
$(if $(SUBDIRS),for dir in $(SUBDIRS); do $(MAKE) -C $$dir coverage || exit; done)
622+
623+
.PHONY: coverage-html
624+
coverage-html: coverage
625+
rm -rf coverage
626+
mkdir coverage
627+
$(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print`
628+
620629

621630
# hook for clean-up
622631
clean distclean maintainer-clean: clean-coverage
623632

624633
.PHONY: clean-coverage
625634
clean-coverage:
635+
rm -rf coverage
626636
rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
627637

628638

src/backend/common.mk

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Common make rules for backend
33
#
4-
# $PostgreSQL: pgsql/src/backend/common.mk,v 1.8 2008/09/05 12:11:18 petere Exp $
4+
# $PostgreSQL: pgsql/src/backend/common.mk,v 1.9 2009/08/07 20:50:22 petere Exp $
55
#
66

77
# When including this file, set OBJS to the object files created in
@@ -46,9 +46,3 @@ ifdef SUBDIRS
4646
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean || exit; done
4747
endif
4848
rm -f $(subsysfilename) $(OBJS)
49-
50-
51-
coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
52-
ifdef SUBDIRS
53-
for dir in $(SUBDIRS); do $(MAKE) -C $$dir coverage || exit; done
54-
endif

src/backend/utils/mb/conversion_procs/Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for utils/mb/conversion_procs
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.21 2009/02/10 19:29:39 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.22 2009/08/07 20:50:22 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -17,7 +17,7 @@ SQLSCRIPT = conversion_create.sql
1717
# This file can be placed as src/test/regress/conversion.sql
1818
REGRESSION_SCRIPT = conversion.sql
1919

20-
DIRS = \
20+
SUBDIRS = \
2121
ascii_and_mic cyrillic_and_mic euc_cn_and_mic euc_jp_and_sjis \
2222
euc_kr_and_mic euc_tw_and_big5 latin2_and_win1250 latin_and_mic \
2323
utf8_and_ascii utf8_and_big5 utf8_and_cyrillic utf8_and_euc_cn \
@@ -162,7 +162,7 @@ CONVERSIONS = \
162162
shift_jis_2004_to_euc_jis_2004 SHIFT_JIS_2004 EUC_JIS_2004 shift_jis_2004_to_euc_jis_2004 euc_jis_2004_and_shift_jis_2004
163163

164164
all: $(SQLSCRIPT)
165-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
165+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
166166

167167
$(SQLSCRIPT): Makefile
168168
ifeq ($(enable_shared), yes)
@@ -205,16 +205,16 @@ $(REGRESSION_SCRIPT): Makefile
205205

206206
install: $(SQLSCRIPT) installdirs
207207
$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
208-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
208+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
209209

210210
installdirs:
211211
$(mkinstalldirs) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(pkglibdir)'
212212

213213
uninstall:
214214
rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
215-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
215+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
216216

217217
clean distclean maintainer-clean:
218218
rm -f $(SQLSCRIPT)
219-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
219+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
220220

src/bin/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/Makefile,v 1.54 2009/01/01 17:23:53 momjian Exp $
8+
# $PostgreSQL: pgsql/src/bin/Makefile,v 1.55 2009/08/07 20:50:22 petere Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

1212
subdir = src/bin
1313
top_builddir = ../..
1414
include $(top_builddir)/src/Makefile.global
1515

16-
DIRS = initdb pg_ctl pg_dump \
16+
SUBDIRS = initdb pg_ctl pg_dump \
1717
psql scripts pg_config pg_controldata pg_resetxlog
1818
ifeq ($(PORTNAME), win32)
19-
DIRS+=pgevent
19+
SUBDIRS+=pgevent
2020
endif
2121

2222
all install installdirs uninstall distprep clean distclean maintainer-clean:
23-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
23+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done

src/interfaces/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/Makefile,v 1.56 2008/03/18 16:24:50 petere Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/Makefile,v 1.57 2009/08/07 20:50:22 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/interfaces
1212
top_builddir = ../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
DIRS = libpq ecpg
15+
SUBDIRS = libpq ecpg
1616

1717
all install installdirs uninstall distprep clean distclean maintainer-clean:
18-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
18+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done

src/pl/Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/pl/Makefile,v 1.27 2008/03/18 16:24:50 petere Exp $
7+
# $PostgreSQL: pgsql/src/pl/Makefile,v 1.28 2009/08/07 20:50:22 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/pl
1212
top_builddir = ../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
DIRS = plpgsql
15+
SUBDIRS = plpgsql
1616

1717
ifeq ($(with_perl), yes)
18-
DIRS += plperl
18+
SUBDIRS += plperl
1919
endif
2020

2121
ifeq ($(with_python), yes)
22-
DIRS += plpython
22+
SUBDIRS += plpython
2323
endif
2424

2525
ifeq ($(with_tcl), yes)
26-
DIRS += tcl
26+
SUBDIRS += tcl
2727
endif
2828

2929
all install installdirs uninstall distprep clean distclean maintainer-clean:
30-
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
30+
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
3131

3232
# We'd like check operations to run all the subtests before failing.
3333
check installcheck:
34-
@CHECKERR=0; for dir in $(DIRS); do \
34+
@CHECKERR=0; for dir in $(SUBDIRS); do \
3535
$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
3636
done; \
3737
exit $$CHECKERR

src/pl/plpgsql/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/pl/plpgsql/Makefile,v 1.9 2008/03/18 16:24:50 petere Exp $
7+
# $PostgreSQL: pgsql/src/pl/plpgsql/Makefile,v 1.10 2009/08/07 20:50:22 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/pl/plpgsql
1212
top_builddir = ../../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
all install installdirs uninstall distprep clean distclean maintainer-clean:
15+
all install installdirs uninstall distprep clean distclean maintainer-clean coverage:
1616
$(MAKE) -C src $@

src/tools/msvc/Mkvcbuild.pm

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package Mkvcbuild;
33
#
44
# Package that generates build files for msvc build
55
#
6-
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.41 2009/07/16 17:43:52 tgl Exp $
6+
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.42 2009/08/07 20:50:22 petere Exp $
77
#
88
use Carp;
99
use Win32;
@@ -321,7 +321,7 @@ sub mkvcbuild
321321

322322
$mf = Project::read_file('src\backend\utils\mb\conversion_procs\Makefile');
323323
$mf =~ s{\\s*[\r\n]+}{}mg;
324-
$mf =~ m{DIRS\s*=\s*(.*)$}m || die 'Could not match in conversion makefile' . "\n";
324+
$mf =~ m{SUBDIRS\s*=\s*(.*)$}m || die 'Could not match in conversion makefile' . "\n";
325325
foreach my $sub (split /\s+/,$1)
326326
{
327327
my $mf = Project::read_file('src\backend\utils\mb\conversion_procs\\' . $sub . '\Makefile');

0 commit comments

Comments
 (0)