mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Code coverage testing with gcov. Documentation is in the regression test
chapter. Author: Michelle Caisse <Michelle.Caisse@Sun.COM>
This commit is contained in:
207
configure
vendored
207
configure
vendored
@ -672,6 +672,10 @@ enable_shared
|
||||
enable_rpath
|
||||
enable_debug
|
||||
enable_profiling
|
||||
GCOV
|
||||
LCOV
|
||||
GENHTML
|
||||
enable_coverage
|
||||
DTRACE
|
||||
DTRACEFLAGS
|
||||
enable_dtrace
|
||||
@ -1356,6 +1360,7 @@ Optional Features:
|
||||
--disable-spinlocks do not use spinlocks
|
||||
--enable-debug build with debugging symbols (-g)
|
||||
--enable-profiling build with profiling enabled
|
||||
--enable-coverage build with coverage testing instrumentation
|
||||
--enable-dtrace build with DTrace support
|
||||
--enable-depend turn on automatic dependency tracking
|
||||
--enable-cassert enable assertion checks (for debugging)
|
||||
@ -2468,6 +2473,178 @@ fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
# --enable-coverage enables generation of code coverage metrics with gcov
|
||||
#
|
||||
|
||||
pgac_args="$pgac_args enable_coverage"
|
||||
|
||||
# Check whether --enable-coverage was given.
|
||||
if test "${enable_coverage+set}" = set; then
|
||||
enableval=$enable_coverage;
|
||||
case $enableval in
|
||||
yes)
|
||||
:
|
||||
;;
|
||||
no)
|
||||
:
|
||||
;;
|
||||
*)
|
||||
{ { echo "$as_me:$LINENO: error: no argument expected for --enable-coverage option" >&5
|
||||
echo "$as_me: error: no argument expected for --enable-coverage option" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
enable_coverage=no
|
||||
|
||||
fi
|
||||
|
||||
|
||||
for ac_prog in gcov
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_prog_GCOV+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$GCOV"; then
|
||||
ac_cv_prog_GCOV="$GCOV" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_GCOV="$ac_prog"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
GCOV=$ac_cv_prog_GCOV
|
||||
if test -n "$GCOV"; then
|
||||
{ echo "$as_me:$LINENO: result: $GCOV" >&5
|
||||
echo "${ECHO_T}$GCOV" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$GCOV" && break
|
||||
done
|
||||
|
||||
if test -z "$GCOV"; then
|
||||
{ { echo "$as_me:$LINENO: error: gcov not found" >&5
|
||||
echo "$as_me: error: gcov not found" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
for ac_prog in lcov
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_prog_LCOV+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$LCOV"; then
|
||||
ac_cv_prog_LCOV="$LCOV" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_LCOV="$ac_prog"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
LCOV=$ac_cv_prog_LCOV
|
||||
if test -n "$LCOV"; then
|
||||
{ echo "$as_me:$LINENO: result: $LCOV" >&5
|
||||
echo "${ECHO_T}$LCOV" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$LCOV" && break
|
||||
done
|
||||
|
||||
if test -z "$LCOV"; then
|
||||
{ { echo "$as_me:$LINENO: error: lcov not found" >&5
|
||||
echo "$as_me: error: lcov not found" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
for ac_prog in genhtml
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_prog_GENHTML+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$GENHTML"; then
|
||||
ac_cv_prog_GENHTML="$GENHTML" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_prog_GENHTML="$ac_prog"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
GENHTML=$ac_cv_prog_GENHTML
|
||||
if test -n "$GENHTML"; then
|
||||
{ echo "$as_me:$LINENO: result: $GENHTML" >&5
|
||||
echo "${ECHO_T}$GENHTML" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
test -n "$GENHTML" && break
|
||||
done
|
||||
|
||||
if test -z "$GENHTML"; then
|
||||
{ { echo "$as_me:$LINENO: error: genhtml not found" >&5
|
||||
echo "$as_me: error: genhtml not found" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# DTrace
|
||||
#
|
||||
@ -3580,13 +3757,16 @@ unset CFLAGS
|
||||
# CFLAGS are selected so:
|
||||
# If the user specifies something in the environment, that is used.
|
||||
# else: If the template file set something, that is used.
|
||||
# else: If coverage was enabled, don't set anything.
|
||||
# else: If the compiler is GCC, then we use -O2.
|
||||
# else: If the compiler is something else, then we use -0.
|
||||
# else: If the compiler is something else, then we use -O.
|
||||
|
||||
if test "$ac_env_CFLAGS_set" = set; then
|
||||
CFLAGS=$ac_env_CFLAGS_value
|
||||
elif test "${CFLAGS+set}" = set; then
|
||||
: # (keep what template set)
|
||||
elif test "$enable_coverage" = yes; then
|
||||
: # no optimization by default
|
||||
elif test "$GCC" = yes; then
|
||||
CFLAGS="-O2"
|
||||
else
|
||||
@ -3961,6 +4141,17 @@ if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
|
||||
# enable code coverage if --enable-coverage
|
||||
if test "$enable_coverage" = yes; then
|
||||
if test "$GCC" = yes; then
|
||||
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
|
||||
else
|
||||
{ { echo "$as_me:$LINENO: error: --enable-coverage is supported only when using GCC" >&5
|
||||
echo "$as_me: error: --enable-coverage is supported only when using GCC" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
fi
|
||||
|
||||
# enable profiling if --enable-profiling
|
||||
if test "$enable_profiling" = yes && test "$ac_cv_prog_cc_g" = yes; then
|
||||
if test "$GCC" = yes; then
|
||||
@ -26510,6 +26701,10 @@ enable_shared!$enable_shared$ac_delim
|
||||
enable_rpath!$enable_rpath$ac_delim
|
||||
enable_debug!$enable_debug$ac_delim
|
||||
enable_profiling!$enable_profiling$ac_delim
|
||||
GCOV!$GCOV$ac_delim
|
||||
LCOV!$LCOV$ac_delim
|
||||
GENHTML!$GENHTML$ac_delim
|
||||
enable_coverage!$enable_coverage$ac_delim
|
||||
DTRACE!$DTRACE$ac_delim
|
||||
DTRACEFLAGS!$DTRACEFLAGS$ac_delim
|
||||
enable_dtrace!$enable_dtrace$ac_delim
|
||||
@ -26549,10 +26744,6 @@ LDFLAGS_SL!$LDFLAGS_SL$ac_delim
|
||||
LD!$LD$ac_delim
|
||||
with_gnu_ld!$with_gnu_ld$ac_delim
|
||||
ld_R_works!$ld_R_works$ac_delim
|
||||
RANLIB!$RANLIB$ac_delim
|
||||
STRIP!$STRIP$ac_delim
|
||||
STRIP_STATIC_LIB!$STRIP_STATIC_LIB$ac_delim
|
||||
STRIP_SHARED_LIB!$STRIP_SHARED_LIB$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
@ -26594,6 +26785,10 @@ _ACEOF
|
||||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
RANLIB!$RANLIB$ac_delim
|
||||
STRIP!$STRIP$ac_delim
|
||||
STRIP_STATIC_LIB!$STRIP_STATIC_LIB$ac_delim
|
||||
STRIP_SHARED_LIB!$STRIP_SHARED_LIB$ac_delim
|
||||
TAR!$TAR$ac_delim
|
||||
LN_S!$LN_S$ac_delim
|
||||
AWK!$AWK$ac_delim
|
||||
@ -26644,7 +26839,7 @@ vpath_build!$vpath_build$ac_delim
|
||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 48; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
Reference in New Issue
Block a user