Test the checker
While you're still testing, it's best to deploy the checker to your desktop, rather than the server project.
- Deploy the custom checker to your desktop by extracting the zip file into the
<username>/.klocwork/plugins
directory, creating the directory if it doesn't already exist. - Set up a local project in the directory where you developed the checker.
kwcheck create -b <build_specification>
<build_specification> was created with
make install buildspec
ornmake install buildspec
. By default, the build specification is written tokwinject.out
in the current working directory. - Run kwcheck to see if the issue is detected in your test case:
kwcheck run
Tip: When you're running the
kwcheck
command repeatedly, usekwcheck
with the-r
option to make sure Klocwork doesn't skip files that have no apparent changes.When you run kwcheck with the default
testcase.cc
file, the checker will find the three instances of assignment with possible loss of data, and Klocwork will display a message like this one:1(Local) /.../testcase.c:7 CHECK.VAR.SIZE (3:Severity 3) Analyze Assignment with possible loss of data 2 (Local) /.../testcase.c:11 CHECK.VAR.SIZES (3:Severity 3) Analyze Assignment with possible loss of data 3 (Local) /.../testcase.c:15 CHECK.VAR.SIZE(3:Severity 3) Analyze Assignment with possible loss of data
- If you are satisfied with the results, you can deploy your checker to the server.
- Uninstall the checker from your desktop by deleting the files that you extracted in Step 1 from the
plugins
directory .