From cc4ca7525aea44a4b7df1e8a12ca0236b4235b20 Mon Sep 17 00:00:00 2001 From: amai2012 Date: Sat, 5 Jan 2019 11:12:32 +0100 Subject: [PATCH] Clean up redundant actions in travis jobs (#1563) * Clean up redundant actions in travis jobs. * Drop validatePlatforms from Makefile target checkcfg * Print out CPU count. Adjust parameters for parallel jobs to 2 - the current result. --- .travis.yml | 30 +++++++++++++++--------------- Makefile | 2 +- tools/dmake.cpp | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84d0bf445..6dc177d2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,10 +43,12 @@ before_install: script: # fail the entire job as soon as one of the subcommands exits non-zero to save time and resources - set -e +# Determine CPU count. As of January 2019 it seems to be 2 - so use this for job count in suitable calls to make or cppcheck + - cat /proc/cpuinfo # download clang git, compile cppcheck, run cppcheck on clang code to look for crashes in cppcheck. if this is done, terminate build - - if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/clang/archive/a1f8bd3778cc5a53236a53500c6ab184e945eefa.zip" & make -j 4 & wait; unzip a1f8bd3778cc5a53236a53500c6ab184e945eefa.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-a1f8bd3778cc5a53236a53500c6ab184e945eefa ; ${CPPCHECK} . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" -iINPUTS -itest/Driver/Inputs/gen-response.c -itest/Index/index-many-logical-ops.c -itest/Sema/many-logical-ops.c --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/clang.cppcheck; cd ../ ; echo "CLANG" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/clang.cppcheck; exit; fi + - if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/clang/archive/a1f8bd3778cc5a53236a53500c6ab184e945eefa.zip" & make -j 2 & wait; unzip a1f8bd3778cc5a53236a53500c6ab184e945eefa.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-a1f8bd3778cc5a53236a53500c6ab184e945eefa ; ${CPPCHECK} . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" -iINPUTS -itest/Driver/Inputs/gen-response.c -itest/Index/index-many-logical-ops.c -itest/Sema/many-logical-ops.c --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/clang.cppcheck; cd ../ ; echo "CLANG" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/clang.cppcheck; exit; fi # check llvm as well - - if [[ "$CHECK_LLVM" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/6fa6453210fa34c1c28bd73a431d04734549f0d6.zip" & make -j 4 & wait; unzip 6fa6453210fa34c1c28bd73a431d04734549f0d6.zip > /dev/null; touch /tmp/llvm.cppcheck; cd ./llvm-6fa6453210fa34c1c28bd73a431d04734549f0d6 ; ${CPPCHECK} . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/llvm.cppcheck; cd ../ ; echo "LLVM" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/llvm.cppcheck; exit; fi + - if [[ "$CHECK_LLVM" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/6fa6453210fa34c1c28bd73a431d04734549f0d6.zip" & make -j 2 & wait; unzip 6fa6453210fa34c1c28bd73a431d04734549f0d6.zip > /dev/null; touch /tmp/llvm.cppcheck; cd ./llvm-6fa6453210fa34c1c28bd73a431d04734549f0d6 ; ${CPPCHECK} . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/llvm.cppcheck; cd ../ ; echo "LLVM" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/llvm.cppcheck; exit; fi # check if dmake needs to be rerun but if yes, don't fail the build but notify us. # to update dmake: "make dmake; ./dmake; and commit - echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change." @@ -54,16 +56,16 @@ script: # check with TEST_MATHLIB_VALUE enabled - touch lib/mathlib.cpp test/testmathlib.cpp - echo $CXXFLAGS - - make -s test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE + - make -s test -j2 CPPFLAGS=-DTEST_MATHLIB_VALUE - touch lib/mathlib.cpp test/testmathlib.cpp # compile cppcheck, default build - echo $CXXFLAGS - - make -s test -j4 + - make -s test -j2 # compile gui - cd gui - qmake - echo $CXXFLAGS - - make -s -j4 + - make -s -j2 # building gui generates some more files that cppcheck can check, so check the repo *after* building gui - cd ../ # use same hack as for clang to work around cppchecks broken exit status with -j 2 ; create file, tee everything to the file and stdout, grep for errors in the file @@ -77,22 +79,22 @@ script: - find lib gui -maxdepth 1 -name "*.dump" | xargs -n 1 -P 4 python addons/naming.py --private-member-variable='m[A-Z].*' # run extra tests - tools/generate_and_run_more_tests.sh -# Validate XML -# - make validateXML doesn't work in this context unfortunately - - ${CPPCHECK} --errorlist >/tmp/errorlist.xml - - xmllint --noout --relaxng cppcheck-errors.rng /tmp/errorlist.xml # check for missing CWE entries - make checkCWEEntries -# check test/cfg +# check cfg files - make checkcfg +# check platform files + - make validatePlatforms +# Validate Result XML - make validateXML +# Build gui - cd ./gui # clean rebuild - git clean -dfx . # can't set this as env flags, so try again with HAVE_RULES=yes - qmake HAVE_RULES=yes - echo $CXXFLAGS - - make -s -j4 + - make -s -j2 - cd ../ # note: trusty on travis has python pygments disabled so disable these tests on travis ## check htmlreport stuff @@ -108,7 +110,7 @@ script: - git clean -dfx # check what happens if we want to install it to some other dir, - echo $CXXFLAGS - - make -s SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg -j 4 + - make -s SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg -j 2 - sudo make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg install - sudo mkdir -p /usr/share/cppcheck/cfg - sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg @@ -116,11 +118,9 @@ script: - /usr/bin/cppcheck ./cli # check if reduce tool compiles - echo $CXXFLAGS - - make -s reduce -j 4 + - make -s reduce -j 2 # check if showtime=top5 works - ./tools/test_showtimetop5.sh -# check the files in cgf dir with xmllint - - xmllint --noout cfg/* # check matchcompiler - ./tools/test_matchcompiler.py # check --dump diff --git a/Makefile b/Makefile index d5603da0f..58e9dc18a 100644 --- a/Makefile +++ b/Makefile @@ -264,7 +264,7 @@ test: all check: all ./testrunner -q -checkcfg: cppcheck validateCFG validatePlatforms +checkcfg: cppcheck validateCFG ./test/cfg/runtests.sh dmake: tools/dmake.o cli/filelister.o $(SRCDIR)/pathmatch.o $(SRCDIR)/path.o externals/simplecpp/simplecpp.o diff --git a/tools/dmake.cpp b/tools/dmake.cpp index ad5d7e1e0..8ba29b274 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -373,7 +373,7 @@ int main(int argc, char **argv) fout << "\t./testrunner\n\n"; fout << "check:\tall\n"; fout << "\t./testrunner -q\n\n"; - fout << "checkcfg:\tcppcheck validateCFG validatePlatforms\n"; + fout << "checkcfg:\tcppcheck validateCFG\n"; fout << "\t./test/cfg/runtests.sh\n\n"; fout << "dmake:\ttools/dmake.o cli/filelister.o $(SRCDIR)/pathmatch.o $(SRCDIR)/path.o externals/simplecpp/simplecpp.o\n"; fout << "\t$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)\n\n";