Skip to content

saveourtool/codeql-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published