fixed #11249 (potential hang with -j and --showtime= when using threads) - synchronized access to `TimerResults::mResults` / added TSAN to CI (#4355)
This commit is contained in:
parent
13e8d5220c
commit
467648bec6
|
@ -276,12 +276,12 @@ jobs:
|
|||
ec=0
|
||||
# self check lib/cli
|
||||
mkdir b1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
# check gui with qt settings
|
||||
mkdir b2
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
# self check test and tools
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
# triage
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -53,8 +53,8 @@ jobs:
|
|||
if: false
|
||||
run: |
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -54,7 +54,7 @@ jobs:
|
|||
- name: Self check (unusedFunction)
|
||||
if: false # TODO: fails with preprocessorErrorDirective - see #10667
|
||||
run: |
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --inconclusive --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
env:
|
||||
DISABLE_VALUEFLOW: 1
|
||||
|
||||
|
@ -76,6 +76,6 @@ jobs:
|
|||
# TODO: find a way to report unmatched suppressions without need to add information checks
|
||||
- name: Self check (unusedFunction / no test)
|
||||
run: |
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --inconclusive --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
env:
|
||||
DISABLE_VALUEFLOW: 1
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
|
||||
name: thread sanitizer
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
env:
|
||||
TSAN_OPTIONS: halt_on_error=1
|
||||
|
||||
container:
|
||||
image: "ubuntu:22.04"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install missing software on ubuntu
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y cmake make libpcre3-dev
|
||||
apt-get install -y clang-14
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On
|
||||
env:
|
||||
CC: clang-14
|
||||
CXX: clang++-14
|
||||
|
||||
- name: Build cppcheck
|
||||
run: |
|
||||
cmake --build cmake.output --target cppcheck -- -j $(nproc)
|
||||
|
||||
- name: Build test
|
||||
run: |
|
||||
cmake --build cmake.output --target testrunner -- -j $(nproc)
|
||||
|
||||
- name: Run tests
|
||||
run: ./cmake.output/bin/testrunner
|
||||
|
||||
# TODO: disabled for now as it takes around 40 minutes to finish
|
||||
# TODO: no gui/temp/*.cpp files available
|
||||
- name: Self check
|
||||
if: false
|
||||
run: |
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
exit $ec
|
|
@ -51,8 +51,8 @@ jobs:
|
|||
- name: Self check
|
||||
run: |
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
unreadVariable
|
||||
shadowVar
|
||||
shadowFunction
|
||||
unusedStructMember
|
||||
nullPointer
|
||||
uninitvar
|
||||
noExplicitConstructor
|
||||
|
4
Makefile
4
Makefile
|
@ -715,7 +715,7 @@ test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/check.h lib/checkpo
|
|||
test/testpreprocessor.o: test/testpreprocessor.cpp externals/simplecpp/simplecpp.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testutils.h
|
||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testpreprocessor.o test/testpreprocessor.cpp
|
||||
|
||||
test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testutils.h
|
||||
test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/redirect.h test/testsuite.h test/testutils.h
|
||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testprocessexecutor.o test/testprocessexecutor.cpp
|
||||
|
||||
test/testrunner.o: test/testrunner.cpp externals/simplecpp/simplecpp.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/preprocessor.h lib/suppressions.h test/options.h test/testsuite.h
|
||||
|
@ -754,7 +754,7 @@ test/testsuppressions.o: test/testsuppressions.cpp cli/cppcheckexecutor.h cli/ex
|
|||
test/testsymboldatabase.o: test/testsymboldatabase.cpp externals/tinyxml2/tinyxml2.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testutils.h
|
||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testsymboldatabase.o test/testsymboldatabase.cpp
|
||||
|
||||
test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testutils.h
|
||||
test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/redirect.h test/testsuite.h test/testutils.h
|
||||
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp
|
||||
|
||||
test/testtimer.o: test/testtimer.cpp lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/suppressions.h lib/timer.h test/testsuite.h
|
||||
|
|
|
@ -56,9 +56,7 @@ Settings::Settings()
|
|||
inlineSuppressions(false),
|
||||
jobs(1),
|
||||
jointSuppressionReport(false),
|
||||
#ifdef THREADING_MODEL_FORK
|
||||
loadAverage(0),
|
||||
#endif
|
||||
maxConfigs(12),
|
||||
maxCtuDepth(2),
|
||||
maxTemplateRecursion(100),
|
||||
|
|
|
@ -212,10 +212,8 @@ public:
|
|||
/** Library */
|
||||
Library library;
|
||||
|
||||
#ifdef THREADING_MODEL_FORK
|
||||
/** @brief Load average value */
|
||||
int loadAverage;
|
||||
#endif
|
||||
|
||||
/** @brief Maximum number of configurations to check before bailing.
|
||||
Default is 12. (--max-configs=N) */
|
||||
|
|
|
@ -47,7 +47,12 @@ void TimerResults::showResults(SHOWTIME_MODES mode) const
|
|||
std::cout << std::endl;
|
||||
TimerResultsData overallData;
|
||||
|
||||
std::vector<dataElementType> data(mResults.begin(), mResults.end());
|
||||
std::vector<dataElementType> data;
|
||||
data.reserve(mResults.size());
|
||||
{
|
||||
std::lock_guard<std::mutex> l(mResultsSync);
|
||||
data.insert(data.begin(), mResults.begin(), mResults.end());
|
||||
}
|
||||
std::sort(data.begin(), data.end(), more_second_sec);
|
||||
|
||||
size_t ordinal = 1; // maybe it would be nice to have an ordinal in output later!
|
||||
|
@ -67,6 +72,8 @@ void TimerResults::showResults(SHOWTIME_MODES mode) const
|
|||
|
||||
void TimerResults::addResults(const std::string& str, std::clock_t clocks)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(mResultsSync);
|
||||
|
||||
mResults[str].mClocks += clocks;
|
||||
mResults[str].mNumberOfResults++;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
enum class SHOWTIME_MODES {
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
|
||||
private:
|
||||
std::map<std::string, struct TimerResultsData> mResults;
|
||||
mutable std::mutex mResultsSync;
|
||||
};
|
||||
|
||||
class CPPCHECKLIB Timer {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "processexecutor.h"
|
||||
#include "redirect.h"
|
||||
#include "settings.h"
|
||||
#include "testsuite.h"
|
||||
#include "testutils.h"
|
||||
|
@ -41,7 +42,7 @@ private:
|
|||
* Execute check using n jobs for y files which are have
|
||||
* identical data, given within data.
|
||||
*/
|
||||
void check(unsigned int jobs, int files, int result, const std::string &data) {
|
||||
void check(unsigned int jobs, int files, int result, const std::string &data, SHOWTIME_MODES showtime = SHOWTIME_MODES::SHOWTIME_NONE) {
|
||||
errout.str("");
|
||||
output.str("");
|
||||
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
}
|
||||
|
||||
settings.jobs = jobs;
|
||||
settings.showtime = showtime;
|
||||
ProcessExecutor executor(filemap, settings, *this);
|
||||
std::vector<ScopedFile> scopedfiles;
|
||||
scopedfiles.reserve(filemap.size());
|
||||
|
@ -68,6 +70,7 @@ private:
|
|||
|
||||
TEST_CASE(deadlock_with_many_errors);
|
||||
TEST_CASE(many_threads);
|
||||
TEST_CASE(many_threads_showtime);
|
||||
TEST_CASE(no_errors_more_files);
|
||||
TEST_CASE(no_errors_less_files);
|
||||
TEST_CASE(no_errors_equal_amount_files);
|
||||
|
@ -97,6 +100,17 @@ private:
|
|||
"}");
|
||||
}
|
||||
|
||||
// #11249 - reports TSAN errors
|
||||
void many_threads_showtime() {
|
||||
REDIRECT;
|
||||
check(16, 100, 100,
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
" char *a = malloc(10);\n"
|
||||
" return 0;\n"
|
||||
"}", SHOWTIME_MODES::SHOWTIME_SUMMARY);
|
||||
}
|
||||
|
||||
void no_errors_more_files() {
|
||||
check(2, 3, 0,
|
||||
"int main()\n"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "redirect.h"
|
||||
#include "settings.h"
|
||||
#include "testsuite.h"
|
||||
#include "testutils.h"
|
||||
|
@ -41,7 +42,7 @@ private:
|
|||
* Execute check using n jobs for y files which are have
|
||||
* identical data, given within data.
|
||||
*/
|
||||
void check(unsigned int jobs, int files, int result, const std::string &data) {
|
||||
void check(unsigned int jobs, int files, int result, const std::string &data, SHOWTIME_MODES showtime = SHOWTIME_MODES::SHOWTIME_NONE) {
|
||||
errout.str("");
|
||||
output.str("");
|
||||
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
}
|
||||
|
||||
settings.jobs = jobs;
|
||||
settings.showtime = showtime;
|
||||
ThreadExecutor executor(filemap, settings, *this);
|
||||
std::vector<ScopedFile> scopedfiles;
|
||||
scopedfiles.reserve(filemap.size());
|
||||
|
@ -67,6 +69,7 @@ private:
|
|||
|
||||
TEST_CASE(deadlock_with_many_errors);
|
||||
TEST_CASE(many_threads);
|
||||
TEST_CASE(many_threads_showtime);
|
||||
TEST_CASE(no_errors_more_files);
|
||||
TEST_CASE(no_errors_less_files);
|
||||
TEST_CASE(no_errors_equal_amount_files);
|
||||
|
@ -95,6 +98,17 @@ private:
|
|||
"}");
|
||||
}
|
||||
|
||||
// #11249 - reports TSAN errors - only applies to threads not processes though
|
||||
void many_threads_showtime() {
|
||||
REDIRECT;
|
||||
check(16, 100, 100,
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
" char *a = malloc(10);\n"
|
||||
" return 0;\n"
|
||||
"}", SHOWTIME_MODES::SHOWTIME_SUMMARY);
|
||||
}
|
||||
|
||||
void no_errors_more_files() {
|
||||
check(2, 3, 0,
|
||||
"int main()\n"
|
||||
|
|
Loading…
Reference in New Issue