diff options
-rw-r--r-- | lcov-report/README | 129 | ||||
-rwxr-xr-x | lcov-report/lcov-report.sh | 355 | ||||
-rw-r--r-- | lcov-report/tinderbox/.tb/profiles/lcov-make-check/autogen.lastrun | 5 | ||||
-rw-r--r-- | lcov-report/tinderbox/.tb/profiles/lcov-make-check/config | 13 | ||||
-rw-r--r-- | lcov-report/tinderbox/.tb/profiles/lcov-make-check/phases.sh | 61 |
5 files changed, 211 insertions, 352 deletions
diff --git a/lcov-report/README b/lcov-report/README index f8afd82..df9962e 100644 --- a/lcov-report/README +++ b/lcov-report/README @@ -4,121 +4,50 @@ NAME DESCRIPTION - A small script to create gcov/lcov code coverage reports of tests run - on the libreoffice source code. + A small script to create gcov/lcov code coverage reports of + tests run on the libreoffice source code. SYNOPSIS - lcov-report.sh [-a|-b|-c] -s [DIRECTORY] -t [DIRECTORY] \ - -w [DIRECTORY] -d "test description" - --b - Run lcov commands before you run your tests. This creates a - baseline lcov tracefile. You can only supply one of '-a', '-b' - or '-c' simultaneously. - --a - Run lcov commands after you run your tests. This creates a - tracefile that contains the results of your tests, and combines - it with the baseline. You can only supply one of '-a', '-b' or - '-c' simultaneously. - --c - Specifies to compile the libreoffice sources in the location - specified by the '-s' flag. This flag is optional. If you - choose to omit it, you must make sure the libreoffice source - code is built using the appropriate FLAGS ('-fprofile-arcs - -ftest-coverage'). You can only supply one of '-a', '-b' or - '-c' simultaneously. - --C - Specifies the location the sourcecode gets compiled in. + lcov-report.sh -s [DIRECTORY] -t [DIRECTORY] -r [DIRECTORY] \ + -b [DIRECTORY] -s - Specify the location where the libreoffice source code is - located. This flag is mandatory. + Specify the location where the libreoffice source code is + located. This is expected to be a git repository. This option + is mandatory. -t - Specifies the directory in which to contain the lcov - tracefile's. This flag is mandatory when you run '-a' or '-b'. - --w - Specifies the directory in which to contain the generated HTML - report files. This flag is mandatory when you run '-a'. + Specifies the directory in which to put the lcov tracefile's. + This option is mandatory. --d - Specify a descriptive name for the test(s) you wish to create - a report for. For example, if your test consists of the make - target 'make check', you could specify '-d "make check"'. +-r + Specifies the directory in which to contain the generated HTML + report files. This option is mandatory. +-b + Specify a directory in which to build the libreoffice project, + in case you want to perform a 'out-of-source' build. This option + is optional: if you omit this option, a 'in-source-tree' build + is performed, and the build will be done in the same dirctory + that you specified with the '-s' option. EXAMPLE - Summary. - - In essence, you run the following commands: - - 1.) Compile LibreOffice. - 2.) Run 'lcov-report.sh' before you run your tests. - 3.) Run your tests. - 4.) Run 'lcov-report.sh' after your tests. - - That's it. - - - 1.) Compile LibreOffice. - - The first step is to compile the libreoffice code using - the appropriate FLAGS and options to autogen.sh and/or - ./configure. You can do this with lcov-report.sh in - the following way: - - lcov-report.sh -c -C /home/user/build -s \ - /home/user/src/libreoffice - - '-c' specifies that you want to compile the code. - - If you choose to build libreoffice yourself instead, make - sure to set these FLAGS: LDFLAGS+='-fprofile-arcs' - CFLAGS+='-fprofile-arcs -ftest-coverage' - CXXFLAGS+='-fprofile-arcs -ftest-coverage' - CPPFLAGS+='-fprofile-arcs -ftest-coverage'. Also, you - need to supply --disable-online-update to autogen.sh - and/or configure. - - - 2.) Run 'lcov-report.sh -b'. - - The next step is to create a gcov/lcov baseline. You - run this command ('-b') before you run your tests. - - lcov-report.sh -b -C /home/user/build -t \ - /home/user/traces -s /home/user/src/libreoffice \ - -d "make check" - - - 3.) Run tests. - - Now you can run the tests for which you want to report - code coverage. This could be as simple as - 'gb_GCOV=YES make check' in the build directory. - - - 4.) Run 'lcov-report.sh -a'. + Running the script could be as easy as running the following + command : - The last step is to create a lcov/gcov tracefile that - contains the data about the tests that were run, and - to create the html report. You run this command ('-a') - after you have completed running your tests. + ./lcov-report.sh -s ~/src/core -t ~/tmp/traces -r ~/tmp/html - lcov-report.sh -a -C /home/user/build \ - -s /home/user/src/libreoffice -t \ - /home/user/traces -w /home/user/html -d "make check" + The '-s' option in this example tells the script to go look for + the libreoffice source code in '~/src/core', the '-t' option + to put the lcov 'tracefiles' in '~/tmp/traces', and the '-r' + option to put the final html report in '~/tmp/html'. Because the + '-b' option is omitted in this example, a 'in-source-tree' build + will be performed. If you would like to perform an out-of-tree + build instead, you would only need to add someting like '-b + ~/tmp/build' to the commandline example above. - Make sure that you specify the same directory for the - tracefiles ('-t') as you did when running the command - '-b' before your tests, as lcov needs access to the - baseline file that was created in that step. diff --git a/lcov-report/lcov-report.sh b/lcov-report/lcov-report.sh index ab62d68..f9d9210 100755 --- a/lcov-report/lcov-report.sh +++ b/lcov-report/lcov-report.sh @@ -19,202 +19,193 @@ # die() { - echo "Error:" "$@" >&2 - exit -1; + echo "Error:" "$@" >&2 + exit 1; } init() { - if [ "${SOURCE_COMPILE?}${AFTER?}${BEFORE?}" != "TRUE" ] ; then - die "You can only supply one of '-a', '-b' or '-c' simultaneously." - fi - - if [ -n "${SRC_DIR?}" ] ; then - if [ "${SRC_DIR?}" = "${BUILD_DIR?}" ] ; then - die "Cannot set the source directory to the same value as the build directory." - fi - - if [ ! -d "${SRC_DIR?}" ] ; then - die "Failed to locate source code directory $SRC_DIR." - else - SRC_DIR=$(readlink -f "${SRC_DIR?}") - fi - - if [ ! -d "${SRC_DIR?}/.git" ] ; then - die "${SRC_DIR?} is not a git repository." - fi - - fi - - if [ "${AFTER?}" = "TRUE" ] ; then - if [ -z "${HTML_DIR?}" ] ; then - die "When specifying '-a', you also need to specify '-w'." - fi - - if [ -z "${BUILD_DIR?}" ] ; then - die "When specifying '-a', you also need to specify '-C'." - fi - - if [ -z "${SRC_DIR?}" ] ; then - die "When specifying '-a', you also need to specify '-s'." - fi - - if [ ! -d "${TRACEFILE_DIR?}" ] ; then - die "Failed to locate tracefile directory ${TRACEFILE_DIR?}." - fi - - if [ ! -d "${HTML_DIR?}" ] ; then - mkdir "${HTML_DIR?}" || die "Failed to create html directory ${HTML_DIR?}." - HTML_DIR=$(readlink -f "${HTML_DIR?}") - else - rm -rf "${HTML_DIR?}" - mkdir "${HTML_DIR?}" || die "Failed to create html directory ${HTML_DIR?}." - HTML_DIR=$(readlink -f "${HTML_DIR?}") - fi - fi - - if [ "${BEFORE?}" = "TRUE" -o "${AFTER?}" = "TRUE" ] ; then - if [ -z "${TRACEFILE_DIR?}" ] ; then - die "When specifying '-a' or '-b', you also need to specify '-t'." - fi - - if [ -z "${TEST_NAME?}" ] ; then - die "When specifying '-a' or '-b', you also need to specify '-d'." - fi - - if [ -z "${SRC_DIR?}" ] ; then - die "When specifying '-a', you also need to specify '-s'." - fi - - BUILD_DIR=$(readlink -f "${BUILD_DIR?}") - fi - - if [ "${BEFORE?}" = "TRUE" ] ; then - if [ ! -d "${TRACEFILE_DIR?}" ] ; then - mkdir "${TRACEFILE_DIR?}" || die "Failed to create tracefile directory ${TRACEFILE_DIR?}." - TRACEFILE_DIR=$(readlink -f "${TRACEFILE_DIR?}") - else - rm -rf "${TRACEFILE_DIR?}" - mkdir "${TRACEFILE_DIR?}" || die "Failed to create tracefile directory ${TRACEFILE_DIR?}." - TRACEFILE_DIR=$(readlink -f "${TRACEFILE_DIR?}") - fi - fi - - if [ "${SOURCE_COMPILE?}" = "TRUE" ] ; then - if [ -z "${BUILD_DIR?}" ] ; then - die "When specifying '-c', you also need to specify '-C'." - fi - - if [ -z "${SRC_DIR?}" ] ; then - die "When specifying '-c', you also need to specify '-s'." - fi - if [ ! -d "$BUILD_DIR" ] ; then - mkdir "$BUILD_DIR" || die "Failed to create source compile directory $BUILD_DIR." - BUILD_DIR=$(readlink -f "${BUILD_DIR?}") - else - rm -rf "$BUILD_DIR" - mkdir "$BUILD_DIR" || die "Failed to create source compile directory $BUILD_DIR." - BUILD_DIR=$(readlink -f "${BUILD_DIR?}") - fi - fi + if [ -z "${HTML_DIR?}" ] + then + die "HTML_DIR was not set." + fi + + if [ -z "${SRC_DIR?}" ] + then + die "SRC_DIR was not set." + fi + + if [ -z "${TRACEFILE_DIR?}" ] + then + die "TRACEFILE_DIR was not set." + fi + + if [ -z "${TEST_NAME?}" ] + then + die "TEST_NAME was not set." + fi + + if [ -n "${SRC_DIR?}" ] + then + if [ -z "${BUILD_DIR?}" ] + then + BUILD_DIR="${SRC_DIR?}" || die "Failed to set BUILD_DIR to SRC_DIR" + fi + + if [ ! -d "${SRC_DIR?}" ] + then + die "Failed to locate source code directory $SRC_DIR." + else + SRC_DIR=$(readlink -f "${SRC_DIR?}") + fi + + if [ ! -d "${SRC_DIR?}/.git" ] + then + die "${SRC_DIR?} is not a git repository." + fi + + fi + + if [ ! -d "${HTML_DIR?}" ] + then + mkdir "${HTML_DIR?}" || die "Failed to create html directory ${HTML_DIR?}." + HTML_DIR=$(readlink -f "${HTML_DIR?}") + else + rm -rf "${HTML_DIR?}" + mkdir "${HTML_DIR?}" || die "Failed to create html directory ${HTML_DIR?}." + HTML_DIR=$(readlink -f "${HTML_DIR?}") + fi + + if [ ! -d "${TRACEFILE_DIR?}" ] + then + mkdir "${TRACEFILE_DIR?}" || die "Failed to create tracefile directory ${TRACEFILE_DIR?}." + TRACEFILE_DIR=$(readlink -f "${TRACEFILE_DIR?}") + else + rm -rf "${TRACEFILE_DIR?}" + mkdir "${TRACEFILE_DIR?}" || die "Failed to create tracefile directory ${TRACEFILE_DIR?}." + TRACEFILE_DIR=$(readlink -f "${TRACEFILE_DIR?}") + fi + + if [ ! -d "${BUILD_DIR?}" ] + then + mkdir "${BUILD_DIR?}" || die "Failed to create source compile directory $BUILD_DIR." + BUILD_DIR=$(readlink -f "${BUILD_DIR?}") + else + BUILD_DIR=$(readlink -f "${BUILD_DIR?}") + fi } lcov_cleanup() { - lcov --zerocounters --directory "${BUILD_DIR?}" + lcov --zerocounters --directory "${BUILD_DIR?}" || die "Failed to run lcov --zerocounters --directory $BUILD_DIR" +} + +make_clean() +{ + pushd "${BUILD_DIR?}" > /dev/null || die "Failed to change directory to $BUILD_DIR" + + if [ -f "${BUILD_DIR?}"/Makefile ] + then + make distclean || die "Failed to make distclean" + fi + + popd > /dev/null || die "Failed to change directory out of $BUILD_DIR" } source_build() { - cd "${BUILD_DIR?}" + pushd "${BUILD_DIR?}" > /dev/null || die "Failed to change directory to $BUILD_DIR" - LDFLAGS+='-fprofile-arcs' CFLAGS+='-fprofile-arcs -ftest-coverage' CXXFLAGS+='-fprofile-arcs -ftest-coverage' CPPFLAGS+='-fprofile-arcs -ftest-coverage' \ - "${SRC_DIR?}/autogen.sh" --enable-python=internal --disable-online-update --without-system-libs --without-system-headers \ - || die "autogen.sh failed." + LDFLAGS+='-fprofile-arcs -lgcov' CFLAGS+='-fprofile-arcs -ftest-coverage' CXXFLAGS+='-fprofile-arcs -ftest-coverage' \ + "${SRC_DIR?}/autogen.sh" --enable-python=internal --without-system-libs --without-system-headers --disable-ccache \ + || die "autogen.sh failed." - gb_GCOV=YES make build-nocheck || die "make build-nocheck failed." + gb_GCOV=YES verbose=t make --output-sync=target || die "gb_GCOV=YES make failed." - cd - + popd > /dev/null || die "Failed to change directory out of $BUILD_DIR" +} + +run_tests() +{ + pushd "${BUILD_DIR?}" > /dev/null || die "Failed to change directory to $BUILD_DIR" + + gb_GCOV=YES verbose=t make check --output-sync=target || die "make check failed." + + popd > /dev/null || die "Failed to change directory out of $BUILD_DIR" } lcov_tracefile_baseline() { - lcov --rc geninfo_auto_base=1 --capture --initial --directory "${BUILD_DIR?}" --output-file "${TRACEFILE_DIR?}/lcov_base.info" --test-name "${TEST_NAME?}" \ - || die "Tracefile ${TRACEFILE_DIR?}/lcov_base.info generation failed." + lcov --rc geninfo_auto_base=1 --capture --initial --directory "${BUILD_DIR?}" --output-file "${TRACEFILE_DIR?}/lcov_base.info" --test-name "${TEST_NAME?}" \ + || die "Tracefile ${TRACEFILE_DIR?}/lcov_base.info generation failed." } lcov_tracefile_tests() { - lcov --rc geninfo_auto_base=1 --capture --directory "${BUILD_DIR?}" --output-file "${TRACEFILE_DIR?}/lcov_test.info" --test-name "${TEST_NAME?}" \ - || die "Tracefile ${TRACEFILE_DIR?}/lcov_test.info generation failed." + lcov --rc geninfo_auto_base=1 --capture --directory "${BUILD_DIR?}" --output-file "${TRACEFILE_DIR?}/lcov_test.info" --test-name "${TEST_NAME?}" \ + || die "Tracefile ${TRACEFILE_DIR?}/lcov_test.info generation failed." } lcov_tracefile_join() { - lcov --rc geninfo_auto_base=1 --add-tracefile "${TRACEFILE_DIR?}/lcov_base.info" \ - --add-tracefile "${TRACEFILE_DIR?}/lcov_test.info" --output-file "${TRACEFILE_DIR?}/lcov_total.info" --test-name "${TEST_NAME?}" \ - || die "Tracefile generation $TRACEFILE_DIR/lcov_total.info failed." + lcov --rc geninfo_auto_base=1 --add-tracefile "${TRACEFILE_DIR?}/lcov_base.info" \ + --add-tracefile "${TRACEFILE_DIR?}/lcov_test.info" --output-file "${TRACEFILE_DIR?}/lcov_total.info" --test-name "${TEST_NAME?}" \ + || die "Tracefile generation $TRACEFILE_DIR/lcov_total.info failed." } lcov_tracefile_cleanup() { - lcov --rc geninfo_auto_base=1 --remove "${TRACEFILE_DIR?}/lcov_total.info" \ - "/usr/include/*" "/usr/lib/*" "${SRC_DIR?}/*/UnpackedTarball/*" "${SRC_DIR?}/workdir/*" \ - "${BUILD_DIR?}/workdir/*" "${SRC_DIR?}/instdir/*" "${SRC_DIR?}/external/*" \ - -o "${TRACEFILE_DIR?}/lcov_filtered.info" --test-name "${TEST_NAME?}" \ - || die "tracefile generation ${TRACEFILE_DIR?}/lcov_filtered.info failed." + lcov --rc geninfo_auto_base=1 --remove "${TRACEFILE_DIR?}/lcov_total.info" \ + "/usr/include/*" "/usr/lib/*" "${SRC_DIR?}/*/UnpackedTarball/*" "${SRC_DIR?}/workdir/*" \ + "${BUILD_DIR?}/workdir/*" "${SRC_DIR?}/instdir/*" "${BUILD_DIR?}/instdir/*" \ + "${SRC_DIR?}/external/*" "${BUILD_DIR?}/external/*" \ + -o "${TRACEFILE_DIR?}/lcov_filtered.info" --test-name "${TEST_NAME?}" \ + || die "tracefile generation ${TRACEFILE_DIR?}/lcov_filtered.info failed." } lcov_mkhtml() { - mkdir "${HTML_DIR?}/report" || die "Failed to create subdirectory in ${HTML_DIR?}/report" + mkdir "${HTML_DIR?}/report" || die "Failed to create subdirectory in ${HTML_DIR?}/report" - genhtml --rc geninfo_auto_base=1 --prefix "${SRC_DIR?}" --ignore-errors source "${TRACEFILE_DIR?}/lcov_filtered.info" \ - --legend --title "${TEST_NAME?}" --rc genhtml_desc_html=1 \ - --output-directory="${HTML_DIR?}/report" --description-file "${TRACEFILE_DIR?}/${DESC_FILE?}" \ - || die "ERROR: Generation of html files in ${HTML_DIR?}/report failed." + genhtml --rc geninfo_auto_base=1 --prefix "${SRC_DIR?}" --ignore-errors source "${TRACEFILE_DIR?}/lcov_filtered.info" \ + --legend --title "${TEST_NAME?}" --rc genhtml_desc_html=1 \ + --output-directory="${HTML_DIR?}/report" --description-file "${TRACEFILE_DIR?}/${DESC_FILE?}" \ + || die "ERROR: Generation of html files in ${HTML_DIR?}/report failed." } lcov_get_commit() { - cd "${SRC_DIR?}" + pushd "${SRC_DIR?}" > /dev/null || die "Failed to change directory to $SRC_DIR" - COMMIT_SHA1=$(git log --date=iso | head -3 | awk '/^commit/ {print $2}') - COMMIT_DATE=$(git log --date=iso | head -3 | awk '/^Date/ {print $2}') - COMMIT_TIME=$(git log --date=iso | head -3 | awk '/^Date/ {print $3}') + COMMIT_SHA1=$(git log --date=iso | head -3 | awk '/^commit/ {print $2}') + COMMIT_DATE=$(git log --date=iso | head -3 | awk '/^Date/ {print $2}') + COMMIT_TIME=$(git log --date=iso | head -3 | awk '/^Date/ {print $3}') - cd - + popd > /dev/null || die "Failed to change directory out of $SRC_DIR" } lcov_mk_desc() { - echo "TN: ${TEST_NAME?}" > "${TRACEFILE_DIR?}/${DESC_FILE?}" - echo "TD: Commit SHA1: ${COMMIT_SHA1?} <br>" >> "${TRACEFILE_DIR?}/${DESC_FILE?}" - echo "TD: Commit DATE: ${COMMIT_DATE?} ${COMMIT_TIME?} <br>" >> "${TRACEFILE_DIR?}/${DESC_FILE?}" - echo "TD: Source Code Directory: ${SRC_DIR?} <br>" >> "${TRACEFILE_DIR?}/${DESC_FILE?}" + echo "TN: ${TEST_NAME?}" > "${TRACEFILE_DIR?}/${DESC_FILE?}" + echo "TD: Commit SHA1: ${COMMIT_SHA1?} <br>" >> "${TRACEFILE_DIR?}/${DESC_FILE?}" + echo "TD: Commit DATE: ${COMMIT_DATE?} ${COMMIT_TIME?} <br>" >> "${TRACEFILE_DIR?}/${DESC_FILE?}" + echo "TD: Source Code Directory: ${SRC_DIR?} <br>" >> "${TRACEFILE_DIR?}/${DESC_FILE?}" } usage() { - echo >&2 "Usage: lcov-report.sh [-a|-b|-c] -s [DIRECTORY] -C [DIRECTORY] -t [DIRECTORY] -w [DIRECTORY] -d "test description" - -b run lcov commands before your tests - -a run lcov commands after your tests - -c compile libreoffice sources - -C build directory to compile libreoffice sources in - -s source code directory - -t tracefile directory - -w html (www) directory - -d description of test that was ran" - exit 1 + echo >&2 "Usage: lcov-report.sh -s [DIRECTORY] -b [DIRECTORY] -t [DIRECTORY] -r [DIRECTORY] + -b build directory to compile libreoffice sources in. if omitted, will be set to the same value as source code directory. + -s source code directory. + -t tracefile directory. + -r html report directory." + exit 1 } # # Main # -SOURCE_COMPILE= -BEFORE= -AFTER= SRC_DIR= TRACEFILE_DIR= HTML_DIR= @@ -222,62 +213,48 @@ BUILD_DIR= COMMIT_SHA1= COMMIT_DATE= COMMIT_TIME= -TEST_NAME= + +TEST_NAME="LibreOffice_make_check" DESC_FILE=descfile.desc -if [ "$#" = "0" ] ; then - usage +if [ "$#" != "8" -a "$#" != "6" ] +then + usage fi -while getopts ":s:t:w:C:d:abc" opt ; do - case "$opt" in - s) - SRC_DIR="${OPTARG?}" - ;; - t) - TRACEFILE_DIR="${OPTARG?}" - ;; - w) - HTML_DIR="${OPTARG?}" - ;; - c) - SOURCE_COMPILE=TRUE - ;; - C) - BUILD_DIR="${OPTARG?}" - ;; - b) - BEFORE=TRUE - ;; - a) - AFTER=TRUE - ;; - d) - TEST_NAME="${OPTARG?}" - ;; - *) - usage - ;; - esac +while getopts ":s:t:r:b:" opt +do + case "$opt" in + s) + SRC_DIR="${OPTARG?}" + ;; + t) + TRACEFILE_DIR="${OPTARG?}" + ;; + r) + HTML_DIR="${OPTARG?}" + ;; + b) + BUILD_DIR="${OPTARG?}" + ;; + *) + usage + ;; + esac done init +make_clean +source_build +lcov_cleanup -if [ "${BEFORE?}" = "TRUE" ] ; then - lcov_cleanup - lcov_get_commit - lcov_tracefile_baseline - lcov_mk_desc -fi +lcov_get_commit +lcov_tracefile_baseline +lcov_mk_desc -if [ "${SOURCE_COMPILE?}" = "TRUE" ] ; then - source_build -fi +run_tests -if [ "${AFTER?}" = "TRUE" ] ; then - lcov_get_commit - lcov_tracefile_tests - lcov_tracefile_join - lcov_tracefile_cleanup - lcov_mkhtml -fi +lcov_tracefile_tests +lcov_tracefile_join +lcov_tracefile_cleanup +lcov_mkhtml diff --git a/lcov-report/tinderbox/.tb/profiles/lcov-make-check/autogen.lastrun b/lcov-report/tinderbox/.tb/profiles/lcov-make-check/autogen.lastrun index 972c3e5..ffb238d 100644 --- a/lcov-report/tinderbox/.tb/profiles/lcov-make-check/autogen.lastrun +++ b/lcov-report/tinderbox/.tb/profiles/lcov-make-check/autogen.lastrun @@ -1,4 +1 @@ ---enable-python=internal ---disable-online-update ---without-system-libs ---without-system-headers +# No need to set these for gcov/lcov code coverage, it is handled by the 'lcov-report.sh' script itself. diff --git a/lcov-report/tinderbox/.tb/profiles/lcov-make-check/config b/lcov-report/tinderbox/.tb/profiles/lcov-make-check/config index b7e778e..a37a756 100644 --- a/lcov-report/tinderbox/.tb/profiles/lcov-make-check/config +++ b/lcov-report/tinderbox/.tb/profiles/lcov-make-check/config @@ -3,13 +3,12 @@ TB_TYPE=tb # These are for use in the lcov script TB_LCOV_TRACEFILE_DIR=~/tmp/traces TB_LCOV_HTML_DIR=~/tmp/html -TB_LCOV_TEST_NAME="make check" TB_LCOV_REPORT=~/source/buildbot/lcov-report/lcov-report.sh -# These are set for gcov/lcov code coverage -LDFLAGS='-fprofile-arcs' -CFLAGS='-fprofile-arcs -ftest-coverage' -CXXFLAGS='-fprofile-arcs -ftest-coverage' -CPPFLAGS='-fprofile-arcs -ftest-coverage' -export LDFLAGS CFLAGS CXXFLAGS CPPFLAGS +# No need to set these for gcov/lcov code coverage, it is handled by the 'lcov-report.sh' script itself. +# LDFLAGS='-fprofile-arcs -lgcov' +# CFLAGS='-fprofile-arcs -ftest-coverage' +# CXXFLAGS='-fprofile-arcs -ftest-coverage' +# CPPFLAGS='-fprofile-arcs -ftest-coverage' +# export LDFLAGS CFLAGS CXXFLAGS diff --git a/lcov-report/tinderbox/.tb/profiles/lcov-make-check/phases.sh b/lcov-report/tinderbox/.tb/profiles/lcov-make-check/phases.sh index f4218be..8186688 100644 --- a/lcov-report/tinderbox/.tb/profiles/lcov-make-check/phases.sh +++ b/lcov-report/tinderbox/.tb/profiles/lcov-make-check/phases.sh @@ -1,69 +1,26 @@ #!/usr/bin/env bash # -*- tab-width : 4; indent-tabs-mode : nil -*- -lcov-make-check_do_make() +lcov-make-check_do_lcov_report() { - if [ "${R}" = "0" ] ; then - # we for MAKE_RESTARTS=1 because 1/ we know that Makefile is up to date - # and 2/ the 'restart' mechanism in make is messed-up by the fact that we trap SIGINT - if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} MAKE_RESTARTS=1 gb_GCOV=YES build-nocheck > "tb_${P?}_build-nocheck.log" 2>&1 ; then - tb_REPORT_LOG="tb_${P?}_build-nocheck.log" - tb_REPORT_MSGS="build failed - error is:" - [ $V ] && echo "make failed :" - [ $V ] && cat tb_${P?}_build-nocheck.log - R=1 - else - if ! ${TB_LCOV_REPORT} -b -C "$TB_BUILD_DIR" -s "$TB_GIT_DIR" -t "$TB_LCOV_TRACEFILE_DIR" -d "$TB_LCOV_TEST_NAME" >> "tb_${P?}_build-nocheck.log" 2>&1 ; then - tb_REPORT_LOG="tb_${P}_build-nocheck.log" - tb_REPORT_MSGS="lcov before failed - error is:" - [ $V ] && echo "lcov before failed :" - [ $V ] && cat tb_${P?}_build-nocheck.log - R=1 - else - if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} MAKE_RESTARTS=1 gb_GCOV=YES check >> "tb_${P?}_build-nocheck.log" 2>&1 ; then - tb_REPORT_LOG="tb_${P?}_build-nocheck.log" - tb_REPORT_MSGS="make check failed - error is:" - [ $V ] && echo "make failed :" - [ $V ] && cat tb_${P?}_build-nocheck.log - R=1 - else - if ! ${TB_LCOV_REPORT} -a -s "$TB_GIT_DIR" -C "$TB_BUILD_DIR" -t "$TB_LCOV_TRACEFILE_DIR" -d "$TB_LCOV_TEST_NAME" -w "$TB_LCOV_HTML_DIR" >> "tb_${P?}_build-nocheck.log" 2>&1 ; then - tb_REPORT_LOG="tb_${P?}_build-nocheck.log" - tb_REPORT_MSGS="lcov after failed - error is:" - [ $V ] && echo "lcov after failed :" - [ $V ] && cat tb_${P?}_build-nocheck.log + if ! ${TB_LCOV_REPORT} -s "$TB_GIT_DIR" -b "$TB_BUILD_DIR" -t "$TB_LCOV_TRACEFILE_DIR" -r "$TB_LCOV_HTML_DIR" >> "tb_${P?}_make-check.log" 2>&1 ; then + tb_REPORT_LOG="tb_${P?}_make-check.log" + tb_REPORT_MSGS="lcov report failed - error is:" + [ $V ] && echo "lcov report failed :" + [ $V ] && cat tb_${P?}_make-check.log R=1 fi - fi - fi - fi - fi } do_make() { - lcov-make-check_do_make + lcov-make-check_do_lcov_report } lcov-make-check_do_autogen() { -local current_timestamp= - - if [ "${R}" = "0" ] ; then - export EXTRA_BUILDID= - if [ "${TB_TYPE?}" = "tb" ] ; then - current_timestamp=$(sed -e "s/ /_/" "${TB_METADATA_DIR?}/${P?}_current-git-timestamp.log") - export EXTRA_BUILDID="TinderBox: ${TB_NAME?}, Branch:${TB_BRANCH?}, Time: $current_timestamp" - fi - "${TB_GIT_DIR?}/autogen.sh" > "tb_${P?}_autogen.log" 2>&1 - if [ "$?" != "0" ] ; then - tb_REPORT_LOG=tb_${P?}_autogen.log - tb_REPORT_MSGS="autogen/configure failed - error is:" - [ $V ] && echo "autogen failed" - [ $V ] && cat tb_${P?}_autogen.log - R=1 - fi - fi + # no need to run autogen.sh, it is handled by the 'lcov-report.sh' script itself. + return 0 } do_autogen() |