From 5a912171fd9935a62ce5a2568ddac0872294740a Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Tue, 24 May 2016 20:33:13 +0200 Subject: [PATCH] qa.sh: Polish and make more flexible --- expat/qa.sh | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/expat/qa.sh b/expat/qa.sh index 070993a5..a2e15c40 100755 --- a/expat/qa.sh +++ b/expat/qa.sh @@ -15,8 +15,21 @@ set -o nounset : ${BASE_FLAGS:="-pipe -Wall -Wextra -pedantic -Wno-overlength-strings"} +RUN() { + local open='\e[1m' + local close='\e[0m' + + echo -e -n "${open}" + echo -n "# $*" + echo -e "${close}" + + env "$@" +} + main() { local mode="${1:-}" + shift + local RUNENV local BASE_FLAGS="${BASE_FLAGS}" @@ -48,25 +61,25 @@ main() { ;; esac - CFLAGS="-std=c89 ${BASE_FLAGS}" - CXXFLAGS="-std=c++98 ${BASE_FLAGS}" + local CFLAGS="-std=c89 ${BASE_FLAGS} ${CFLAGS:-}" + local CXXFLAGS="-std=c++98 ${BASE_FLAGS} ${CXXFLAGS:-}" ( - PS4='# ' set -e - set -x - CC="${CC}" CFLAGS="${CFLAGS}" \ - CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \ - ./configure + RUN CC="${CC}" CFLAGS="${CFLAGS}" \ + CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \ + ./configure "$@" - "${MAKE}" clean all - "${MAKE}" check run-xmltest + RUN "${MAKE}" clean all + RUN "${MAKE}" check run-xmltest ) || exit 1 - if [[ "${mode}" = coverage ]]; then + case "${mode}" in + coverage) find -name '*.gcda' | sort | xargs gcov - fi + ;; + esac } main "$@" -- 2.40.0