Skip to content

Add tests and CI jobs for warnings features - #35

Merged
nradakovic merged 1 commit into
mainfrom
nira_warnings_tests
Aug 27, 2026
Merged

Add tests and CI jobs for warnings features#35
nradakovic merged 1 commit into
mainfrom
nira_warnings_tests

Conversation

@nradakovic

Copy link
Copy Markdown
Member

Add tests and CI jobs for warnings features.

@nradakovic
nradakovic marked this pull request as ready for review August 26, 2026 15:42
Copilot AI lite review requested due to automatic review settings August 26, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a small warnings-feature test suite to the tests/ Bazel module and wires it into CI, so the GCC warnings feature flags are continuously validated (both “no false positives” and “does it actually catch a known violation”).

Changes:

  • Add a GCC warnings “positive” cc_test plus three manual “violation” cc_library targets (minimal/strict/all).
  • Register a dedicated GCC 15.3.0 toolchain for warnings-feature testing and add .bazelrc configs to pin it and enable the relevant features.
  • Add a new GitHub Actions job to run the positive test and verify each violation target fails with the expected diagnostic; document how to run these locally.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/warnings/strict_violation.cpp Adds an intentional -Wvla violation source used for negative validation under strict warnings.
tests/warnings/positive_test.cpp Adds a minimal “should compile clean” test used to detect false positives under -Werror.
tests/warnings/minimal_violation.cpp Adds an intentional -Wcast-qual violation source used for negative validation under minimal warnings.
tests/warnings/all_violation.cpp Adds an intentional -Wunused-variable violation source used for negative validation under all-wall warnings.
tests/MODULE.bazel Adds a dedicated GCC 15.3.0 toolchain and required deps for warnings-feature testing.
tests/BUILD.bazel Registers the new positive test and manual violation targets.
tests/.bazelrc Adds configs that pin the GCC 15 toolchain and enable warnings features + warnings_as_errors.
docs/warnings.md Documents how the warnings features are tested in tests/ and CI.
.github/workflows/tests.yml Adds a CI job matrix to run the positive test and validate expected failures for each warnings level.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/warnings.md Outdated
Comment on lines +366 to +370
`minimal_warnings_violation`, `strict_warnings_violation`, and
`all_wall_warnings_violation` are `cc_library` targets tagged `manual`,
each containing one documented, intentional violation (see the header
comment in the corresponding `tests/warnings/*_violation.cpp` file). They
must **fail to build** under their matching config:
@nradakovic nradakovic self-assigned this Aug 26, 2026
@nradakovic nradakovic added p3 Medium/Low - handle it within normal process compiler warnings Compiler warnings feature add or update. labels Aug 26, 2026
@nradakovic
nradakovic force-pushed the nira_warnings_tests branch 4 times, most recently from 71cc0b1 to 0c57db5 Compare August 27, 2026 09:17
@nradakovic
nradakovic requested a lite review from Copilot August 27, 2026 09:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

.github/workflows/tests.yml:172

  • warnings_as_errors is implemented as -Werror, so the diagnostic emitted for the VLA case is expected to reference -Wvla rather than -Werror=vla. Using -Werror=vla here may cause the negative test to fail even though the warning was correctly triggered.
          - label: strict_warnings
            config: feature_only_gcc_strict_warnings
            violation_target: strict_warnings_violation
            expected_diagnostic: "-Werror=vla"
          - label: all_wall_warnings

.github/workflows/tests.yml:176

  • For the unused-variable violation, the GCC option shown in diagnostics is expected to be -Wunused-variable (often [-Wunused-variable]). With warnings_as_errors implemented via -Werror, grepping for -Werror=unused-variable may not match the actual output.
          - label: all_wall_warnings
            config: feature_only_gcc_all_wall_warnings
            violation_target: all_wall_warnings_violation
            expected_diagnostic: "-Werror=unused-variable"

Comment on lines +164 to +168
- label: minimal_warnings
config: feature_only_gcc_minimal_warnings
violation_target: minimal_warnings_violation
expected_diagnostic: "-Werror=cast-qual"
- label: strict_warnings
Add tests and CI jobs for warnings features.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines +178 to +180
- name: Checkout
uses: actions/checkout@v6

@nradakovic
nradakovic merged commit 54a4c85 into main Aug 27, 2026
24 checks passed
@nradakovic
nradakovic deleted the nira_warnings_tests branch August 27, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler warnings Compiler warnings feature add or update. p3 Medium/Low - handle it within normal process

Projects

Development

Successfully merging this pull request may close these issues.

Update score_cpp_policies documentation for compiler warning features Create unit tests for compiler warning feature behavior

3 participants