https://github.com/saveourtool/codeql-test
https://github.com/saveourtool/codeql-test
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/saveourtool/codeql-test
- Owner: saveourtool
- Created: 2024-01-12T10:58:15.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-18T16:11:20.000Z (over 2 years ago)
- Last Synced: 2025-02-17T09:33:23.277Z (over 1 year ago)
- Language: C++
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## How to run
#### 1) Download codeql-bundle.tar.gz manually: [here](https://github.com/github/codeql-action/releases)
#### 2) Extract it.
#### 3) Add /codeql to PATH.
#### 4) Run unit tests for QL queries with:
```shell
codeql test run --
```
Where `` 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:
```shell
codeql test run --additional-packs= --
```
Where `` is dir with `.ql` files and `` 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:
```shell
codeql test accept --
```
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:
```shell
codeql test run --learn --
```