* Add try_retry-logic to get_packages_count()
Occasionally, get_packages_count() fails, which is a bit annoying since
it happens after compilation and therefore can take some time to detect.
Add try-retry to the function to make it more robust.
* Move try_retry-logic to lib.get_package()
Moving it to the library means test-my-pr also benefits from it. This
fixes Trac ticket #11405.
* donate_cpu_lib.py: bumped version
* donate-cpu.py: replaced `version.StrictVersion` from deprecated `distutils` with `version.Version` from `packaging`
* donate_cpu_lib.py: omit `-rp=` from `cppcheck-options`
* donate-cpu.py: use `get_client_version()` instead of constant
* donate_cpu_lib.py: use `os.path.join()`
* donate-cpu: removed remaining usage of `os.chdir()`
* donate_cpu_lib.py: moved library includes code into class
* donate_cpu_lib.py: pre-compile library include regular expressions
* donate_cpu_lib.py: pre-compile some more regular expressions
* donate_cpu_lib.py: small unpack_package() cleanup and optimization
* donate_cpu_lib.py: added some information about the extracted files to unpack_package()
* donate_cpu_lib.py: bumped version
* added test_donate_cpu_lib.py
* donate_cpu_lib.py: greatly improved `LibraryIncludes.get_libraries()` performance
only scan each file once for previously undetected libraries only
* test_donate_cpu_lib.py: fix for Python 3.5
* scriptcheck.yml: added `-v` to pytest calls so we get the complete diff on assertions
* fixed `test_arguments_regression()` Python tests with additional pytest arguments
* donate_cpu_lib.py: use `subprocess.check_call()`
* test_donate_cpu_lib.py: sort results to address differences in order with Python 3.5
* Better git usage in donate-cpu.py to reduce bandwidth and disk usage
Main changes:
* Bump client version
* Move try+retry logic to function try_retry to reduce duplication
* Use exponential backoff for try_retry
* git clone with --depth=1 to reduce bandwidth and disk use
* Use multiple worktree to work with multiple versions, instead of back-and-forth checkouts
* donate-cpu.py fixes for review comments and automated check failures
* Move compile_cppcheck within (if ver == 'main) branch to avoid duplicate compile_cppcheck+compile_version cals
* Use classic format syntax for python 3.5 compatibility
* Fix undefined CalledProcessError detected by pylint
* donate-cpu.py code changes following code review
* Migration existing "cppcheck" directory if available instead of "git clone"
* Logging message tweaks
* Use subprocess' cwd parameter instead of os.chdir() to avoid risk around changing and not restoring the working directory
* Update tools/test-my-pr.py to account for donate_cpu_lib changes
* donate-cpu.py: ensure correct workspace locations with relative --work-path
This adds a timeout of 60 minutes for the Cppcheck analysis.
Timed out results do not count as crash but they are uploaded and
marked with "TO!" in the list of the latest results. No "diff" is
generated for timed out results so they do not add wrong entries to
the "Diff report".
In test-my-pr.py the timed out results are listed separately just like
the crashes.
donate-cpu-server.py: Add timeout report
Using .tar.xz packages adds about 4500 additional packages that can be
tested and changes many existing packages where a more recent version
can be used now that is only available as .tar.xz file.
Related ticket: https://trac.cppcheck.net/ticket/9508
donate-cpu.py: Require at least Python 3.4
xz support was added with 3.3.
Yesterday, I observed that some client with a wrong jobs setting
(only "-j") requested one package after another and always uploaded
results where it only said that the argument "-j" is invalid for
Cppcheck.
This check should avoid such cases where results are overwritten with
useless data and the server is kept busy for nothing.
* donate-cpu.py: Add internal timing information of Cppcheck to output
The option "--showtime=top5" is added to the Cppcheck command line.
The timing output is collected and only for HEAD it is shown in the new
category "head-timing-info" in the results output.
The timing output is indented with one white space, so even in the
unlikely case that a function is named "head result:" or "diff:" it does
not break the parser in the server.
* donate-cpu.py: Also print the "old" timing information for comparison
Some projects only use this (older?) style of Qt header inclusion.
There are (older) books and examples which use this style, too.
It seems to be perfectly valid, so we should support it.
There is no point in checking which libraries to use for each cppcheck
version since there is no change. Refactor the checking to a separate
function and run that once instead. This halves the time it takes to
check for libraries.
I looked into many packages where the detection failed and they all use
`#include "ruby.h"`. Some of these packages seem to be Ruby modules,
others seem to be "normal" software.
This adds one line in the package report to show the git hash and commit
date. This makes it possible to see exactely which revision the result
was obtained with.
The cppcheck head info line is now shown as
head-info: 1a25d3f9e (2019-08-30 18:34:14 +0200)
Check if fetching and updating the cppcheck sources are successful. If
not successful after five retries, try removing the existing clone and
checkout again.
Sometimes there are no relevant source files (.c, .cpp, ...) extracted,
but other files are (.h, ...).
There could be only header files for example. Then Cppcheck returns with
exit code 1 and prints an error message. This is no crash and now no
longer reported as such.
* donate-cpu.py: treat signal 6 (SIGABRT) as crash as well so we get a stack trace in the result
* donate-cpu.py: simplified returncode/signal check / also generate stack traces for SIGILL, SIGFPE, SIGBUS
* donate-cpu.py: avoid usage of "not" in if
* donate-cpu.py: do not overwrite returncode in crash handling