Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 1.66 KB

README.md

File metadata and controls

34 lines (28 loc) · 1.66 KB

How to run

1) Download codeql-bundle.tar.gz manually: here

2) Extract it.

3) Add /codeql to PATH.

4) Run unit tests for QL queries with:

codeql test run -- <test|dir>

Where <test|dir> is .ql file that defines a test to run or directory which will be searched recursively for tests to run. To run the test cases, use the path to the codeWithQueries folder.

If you want to put .ql files are separate from .cpp files, then you can use the command:

codeql test run --additional-packs=<queries-dir> -- <test|dir>

Where <queries-dir> is dir with .ql files and <test|dir> is .qlref file or directory which will be searched recursively for tests to run. To run the test cases, use the path to the folders queries and code.

After run, you will see the NAME.actual files (whose name matches to the NAME.ql test files). Each such file contains the result of running the test.

If the NAME.expected (whose name must matches to the NAME.ql test file) file does not exist or its contents do not match the NAME.actual file, the test will fail.

You can also rename the NAME.actual files left by codeql test run for failing tests into NAME.expected using the command:

codeql test accept -- <test|dir>

Such that future runs on the tests that give the same output will be considered to pass.

When running tests, you can also add --learn flag so that if a test produces unexpected output, instead of failing it, update its NAME.expected file to match the actual output, such that it passes:

codeql test run --learn -- <test|dir>