Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #12465 - added (undocumented) command-line option --executor to specify the used executor implementation #6043

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

I wanted to wait with this until I am done with executor stuff but I need this in an upcoming unit test as there is stuff I cannot easily fix in the process implementation so I need to limit some tests to the thread one.

@firewave
Copy link
Collaborator Author

This still needs adjustments for the way we use the ThreadSanitizer in Python tests...

@firewave
Copy link
Collaborator Author

firewave commented Feb 26, 2024

This still needs adjustments for the way we use the ThreadSanitizer in Python tests...

This hits on something I am thinking about for a long time - forcing the invocation with a different default. This affects the following:

  • --executor
  • --clang
  • -j

In a perfect world running Cppcheck with either of those options added should not lead to any difference in the output.

So I guess the injection should be specific to those arguments. So if the argument is not specified in the argument list it should not be added. That seems test which explicitly depend on the default need to specify that on the command-line. --clang should not matter but tests which e.g. should be run with a single job need to specify -j1 and so on. We could also just prepend them and they would be overwritten by later one since we are processing them left-to-right but I would prefer not to have duplicated arguments.

That would allow us to have a much bigger test coverage in the Python tests without introducing additional cases. We might also be able to remove some (like all the *_j ones I added in #6042 and other PRs).

Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you envision that users will use this option? What are the valid use cases?

If your target is to use it for testing purposes.. imho we could let it be an unofficial option

releasenotes.txt Outdated
@@ -23,3 +23,6 @@ Other:
- Added '--template=simple'. It is expands to '{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]' without any additional location details.
- Removed deprecated platform type 'Unspecified'. Please use 'unspecified' instead.
- Removed deprecated 'Makefile' option 'SRCDIR'.
- Added CMake option 'DISALLOW_THREAD_EXECUTOR' to control the inclusion of the executor which performs the analysis within a thread of the main process.
- Removed CMake option 'USE_THREADS' in favor of 'DISALLOW_THREAD_EXECUTOR'.
- Added command-line option `--executor=` to specify the executor. Available options are 'auto', 'process' and 'thread'. 'auto' will prefer 'process' if it is available. Note: Windows has no implementation of 'process' as of now so it will always chose 'thread' for now.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chose => choose/use

@firewave
Copy link
Collaborator Author

firewave commented Mar 8, 2024

Do you envision that users will use this option? What are the valid use cases?

I guess it is unlikely the regular user will use this.

The thread mode has the following advantages:

  • it allows for (easier) debugging of the analysis with multiple jobs
  • it is (currently) faster if you have lots of small files (because of the way the ProcessExecutor is implemented - will be improved by the executor reworking)
  • it might also be faster if you have lots of data generated (also because of the way ProcessExecutor is implemented and because we need to transfer the data back to the main process)
  • it has less bugs (also related to data needed to be transferred back to the main process - e.g. unmatchedSuppression not reported properly - I do not have the ticket number handy). Will file missing tickets later on.

Spawning additional processes might also be a security violation. But as this has not yet been brought up yet I guess it is actually a valid use case.

If your target is to use it for testing purposes.. imho we could let it be an unofficial option

I am fine with not documenting it.

@firewave
Copy link
Collaborator Author

firewave commented Mar 8, 2024

  • it has less bugs (also related to data needed to be transferred back to the main process - e.g. unmatchedSuppression not reported properly - I do not have the ticket number handy). Will file missing tickets later on.

That's also one of the reasons why the executor stuff still isn't finished. I keep finding issues and gaps in the testings and before I shared the code I want to have at least one of the job implementations working as expected/intended (i.e. the single job one) so I know that the reworking didn't introduce any new bugs.

@firewave
Copy link
Collaborator Author

firewave commented Mar 8, 2024

This is also a per-requisite for #5647.

@danmar
Copy link
Owner

danmar commented Mar 10, 2024

I am fine with not documenting it.

Alright I suggest we make it undocumented for now. If we see a need to make it official later we can do it. Feel free to remove the help text and then merge it.

…CT_EXECUTOR` to inject `--executor` into cppcheck execution
@firewave firewave force-pushed the executor-opt branch 2 times, most recently from 7a169e8 to 42f74c2 Compare March 11, 2024 00:16
@firewave
Copy link
Collaborator Author

Alright I suggest we make it undocumented for now. If we see a need to make it official later we can do it. Feel free to remove the help text and then merge it.

I removed it from the documentation.

…to specify the used executor implementation
@firewave firewave changed the title fixed #12465 - added command-line option --executor to specify the used executor implementation fixed #12465 - added (undocumented) command-line option --executor to specify the used executor implementation Mar 11, 2024
@firewave firewave merged commit 6542816 into danmar:main Mar 11, 2024
63 checks passed
@firewave firewave deleted the executor-opt branch March 11, 2024 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants