mirror of
https://github.com/whisperity/CodeChecker-Action.git
synced 2026-02-09 22:57:45 +00:00
nit: Make the CTU test have a valid finding with defualt configuration
This commit is contained in:
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -82,9 +82,12 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- run: test/fix_compile_json_paths.sh
|
||||
- uses: ./
|
||||
id: codechecker
|
||||
with:
|
||||
logfile: 'test/ctu/compile_commands.json'
|
||||
ctu: true
|
||||
- name: "Reject test if previous step did not produce CTU finding"
|
||||
run: cat ${{ steps.codechecker.outputs.result-log }} | grep "Dereference of null pointer"
|
||||
|
||||
fail-on-error:
|
||||
name: "Parse: Fail the build on error"
|
||||
|
||||
13
README.md
13
README.md
@@ -146,9 +146,10 @@ runs:
|
||||
|
||||
The action exposes the following outputs which may be used in a workflow's steps succeeding the analysis.
|
||||
|
||||
| Variable | Value | Description |
|
||||
|-------------------|-------------------------------------------|-------------------------------------------------------------------------------|
|
||||
| `analyze-output` | Auto-generated, or `analyze-output` input | The directory where the **raw** analysis output files are available. |
|
||||
| `logfile` | Auto-generated, or `logfile` input | The JSON Compilation Database of the analysis that was executed. |
|
||||
| `result-html-dir` | Auto-generated. | The directory where the **user-friendly HTML** bug reports were generated to. |
|
||||
| `warnings` | `true` or `false` | Whether the static analysers reported any findings. |
|
||||
| Variable | Value | Description |
|
||||
|-------------------|-------------------------------------------|-----------------------------------------------------------------------------------|
|
||||
| `analyze-output` | Auto-generated, or `analyze-output` input | The directory where the **raw** analysis output files are available. |
|
||||
| `logfile` | Auto-generated, or `logfile` input | The JSON Compilation Database of the analysis that was executed. |
|
||||
| `result-html-dir` | Auto-generated. | The directory where the **user-friendly HTML** bug reports were generated to. |
|
||||
| `result-log` | Auto-generated. | `CodeChecker parse`'s output log file which contains the findings dumped into it. |
|
||||
| `warnings` | `true` or `false` | Whether the static analysers reported any findings. |
|
||||
|
||||
@@ -56,6 +56,9 @@ outputs:
|
||||
warnings:
|
||||
description: 'Whether the static analyser(s) reported any findings.'
|
||||
value: ${{ steps.parse.outputs.HAS_FINDINGS }}
|
||||
result-log:
|
||||
description: 'The file where the output of CodeChecker parse is written to verbatim.'
|
||||
value: ${{ steps.parse.outputs.OUTPUT_LOG }}
|
||||
result-html-dir:
|
||||
description: 'The output directory where the user-friendly HTML reports were stored to.'
|
||||
value: ${{ steps.parse.outputs.HTML_DIR }}
|
||||
|
||||
@@ -19,9 +19,8 @@ if [[ ! -z "$IN_CONFIGFILE" ]]; then
|
||||
echo "Using configuration file \"$IN_CONFIGFILE\"!"
|
||||
fi
|
||||
|
||||
CTU_FLAG=$([[ "$IN_CTU" == "true" ]] && echo "--ctu --ctu-ast-mode load-from-pch" || echo "")
|
||||
if [[ "$IN_CTU" == "true" ]]; then
|
||||
CTU_FLAG="--ctu --ctu-ast-mode load-from-pch"
|
||||
CTU_FLAGS="--ctu --ctu-ast-mode load-from-pch"
|
||||
echo "::notice title=Cross Translation Unit analyis::CTU has been enabled, the analysis might take a long time!"
|
||||
fi
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@ OUTPUT_DIR="$IN_OUTPUT_DIR"
|
||||
if [[ -z "$OUTPUT_DIR" ]]; then
|
||||
OUTPUT_DIR=~/"$ACTION_NAME"_Results-HTML
|
||||
fi
|
||||
|
||||
mkdir -pv "$(dirname $"OUTPUT_DIR")"
|
||||
|
||||
OUTPUT_LOG="$(dirname "$IN_OUTPUT_DIR")"/"$(basename "$IN_OUTPUT_DIR")_Parse.log"
|
||||
|
||||
if [[ ! -z "$IN_CONFIGFILE" ]]; then
|
||||
CONFIG_FLAG_1="--config"
|
||||
CONFIG_FLAG_2=$IN_CONFIGFILE
|
||||
@@ -34,8 +35,11 @@ echo "::set-output name=HTML_DIR::$OUTPUT_DIR"
|
||||
|
||||
"$CODECHECKER_PATH"/CodeChecker parse \
|
||||
"$RAW_RESULT_DIR" \
|
||||
--trim-path-prefix "$PROJECT_PATH"
|
||||
--trim-path-prefix "$PROJECT_PATH" \
|
||||
> "$OUTPUT_LOG"
|
||||
EXIT_CODE=$?
|
||||
echo "::set-output name=OUTPUT_LOG::$OUTPUT_LOG"
|
||||
|
||||
|
||||
if [[ "$EXIT_CODE" == "2" ]]; then
|
||||
echo "::set-output name=HAS_FINDINGS::true"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
int zero() {
|
||||
return 0;
|
||||
int broken(int* iptr) {
|
||||
*iptr = 42;
|
||||
return *iptr;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
int zero();
|
||||
int broken(int* iptr);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return argc / zero();
|
||||
int* ptr = nullptr;
|
||||
return broken(ptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user