Commit c46137bd authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Merge velichkov's commit 598e7b45... to mouse07410's asn1c repository

Excerpt from commit log :

  Do not generate coverage data for the test C code
  When compiling tests remove the CODE_COVERAGE_CFLAGS flags from CFLAGS

and also add

  CFLAGS = $(filter-out $(CODE_COVERAGE_CFLAGS), @CFLAGS@)

to 'skeleton/Makefile.am' to avoid compilation error in vlm's repository.
parent 2d6b8c01
......@@ -4,7 +4,19 @@ SUBDIRS = check-src
dist_check_SCRIPTS = check-assembly.sh
TESTS_ENVIRONMENT= CC="${CC}" CFLAGS="${TESTSUITE_CFLAGS} ${CFLAGS}" CXXFLAGS="${CXXFLAGS}" srcdir=${srcdir} abs_top_srcdir=${abs_top_srcdir} abs_top_builddir=${abs_top_builddir} ${srcdir}/check-assembly.sh
#Filter out the coverage options from CFLAGS as we don't need
#code coverage data for the tests executables
CFLAGS = $(filter-out $(CODE_COVERAGE_CFLAGS), @CFLAGS@)
TESTS_ENVIRONMENT= \
CC="${CC}" \
CFLAGS="${TESTSUITE_CFLAGS} ${CFLAGS}" \
CXXFLAGS="${CXXFLAGS}" \
LDFLAGS="${LDFLAGS}" \
srcdir=${srcdir} \
abs_top_srcdir=${abs_top_srcdir} \
abs_top_builddir=${abs_top_builddir} \
${srcdir}/check-assembly.sh
TESTS =
TESTS += check-src/check-03.-fwide-types.c
......
......@@ -53,28 +53,34 @@ asn_module=$(echo "${abs_top_srcdir}/tests/${testno}"-*.asn1)
cat > "$testdir/Makefile" <<EOM
# This file is autogenerated by ../$0
COMMON_FLAGS= -I.
CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O0 -I ${abs_top_srcdir}/skeletons
COMMON_FLAGS= -I. -I${abs_top_srcdir}/skeletons
CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O0
CPPFLAGS = -DSRCDIR=../${srcdir}
CXXFLAGS = \${COMMON_FLAGS} ${CXXFLAGS}
LDFLAGS = ${LDFLAGS:-}
CC ?= ${CC}
all: check-executable
check-executable: compiled-module *.c*
OBJS=\$(patsubst %.c,%.o,\$(wildcard *.c))
all: compiled-module
\$(MAKE) check-executable
check-executable: \$(OBJS)
@rm -f *.core
\$(CC) \$(CPPFLAGS) \$(CFLAGS) -o check-executable *.c* -L${abs_top_builddir}/skeletons/.libs -lasn1cskeletons -lm
\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(LDFLAGS) -o check-executable \$(OBJS) -L${abs_top_builddir}/skeletons/.libs -lasn1cskeletons -lm
# Compile the corresponding .asn1 spec.
compiled-module: ${asn_module} ${abs_top_builddir}/asn1c/asn1c
${abs_top_builddir}/asn1c/asn1c \\
-S /tmp/do/not/copy/skeletons \\
-S ${abs_top_srcdir}/skeletons \\
-Wdebug-compiler \\
${AFLAGS} ${asn_module}
rm -f converter-sample.c
@touch compiled-module
check-succeeded: check-executable
check-succeeded: compiled-module
\$(MAKE) check-executable
@rm -f check-succeeded
./check-executable
@touch check-succeeded
......
......@@ -21,7 +21,7 @@
# Test also for gcov program and create GCOV variable that could be
# substituted.
#
# Note that all optimisation flags in CFLAGS must be disabled when code
# Note that all optimization flags in CFLAGS must be disabled when code
# coverage is enabled.
#
# Usage example:
......@@ -45,11 +45,6 @@
# (`make check`) and build a code coverage report detailing the code which
# was touched, then print the URI for the report.
#
# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
# deprecated. They have the same value.
#
# This code was derived from Makefile.decl in GLib, originally licenced
# under LGPLv2.1+.
#
......@@ -75,7 +70,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#serial 21
#serial 23
AC_DEFUN([AX_CODE_COVERAGE],[
dnl Check for --enable-code-coverage
......@@ -123,12 +118,19 @@ AC_DEFUN([AX_CODE_COVERAGE],[
])
dnl Build the code coverage flags
dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_LIBS="-lgcov"
CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
AX_CHECK_COMPILE_FLAG([-coverage], [
CODE_COVERAGE_CFLAGS="-O0 -g -coverage"
CODE_COVERAGE_CXXFLAGS="-O0 -g -coverage"
CODE_COVERAGE_LDFLAGS="-coverage"
CODE_COVERAGE_LIBS=""
], [
CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_LIBS="-lgcov"
dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
])
AC_SUBST([CODE_COVERAGE_CPPFLAGS])
AC_SUBST([CODE_COVERAGE_CFLAGS])
......@@ -218,7 +220,7 @@ CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
CODE_COVERAGE_IGNORE_PATTERN ?=
code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
......
SUBDIRS = . tests
CFLAGS = $(filter-out $(CODE_COVERAGE_CFLAGS), @CFLAGS@)
dist_pkgdata_DATA = \
${srcdir}/README \
......
......@@ -14,6 +14,9 @@ check_PROGRAMS = \
check-PER \
check-PER-INTEGER
#Filter out the coverage options from CFLAGS as we don't need
#code coverage data for the tests executables
CFLAGS = $(filter-out $(CODE_COVERAGE_CFLAGS), @CFLAGS@)
AM_CPPFLAGS = -I$(top_srcdir)/skeletons $(TESTSUITE_CFLAGS)
AM_LDFLAGS = $(top_builddir)/skeletons/libasn1cskeletons.la
LDADD = -lm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment