Skip to content

Add skylib tests for compile_commands.bzl - #276

Closed
furtib wants to merge 2 commits into
Ericsson:mainfrom
furtib:test-bazel-mock-001
Closed

Add skylib tests for compile_commands.bzl#276
furtib wants to merge 2 commits into
Ericsson:mainfrom
furtib:test-bazel-mock-001

Conversation

@furtib

@furtib furtib commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Why:
We want fast and closely integrated tests. Skylib provides functions for Bazel-level unit testing.

What:

  • Refactored compile_commands.bzl to be more easily testable. Notably:
    • Made check_source_files and compile_commands_json functions public.
    • Added a short description for these newly public functions.
    • Moved the fail() call out of check_source_files so it is properly testable.
  • Added skylib unit tests for all functions that can be analyzed with them (basically all functions that don't use ctx or providers)
  • Added skylib analysis tests for functions that can't be analyzed with unit tests. These tests cannot test one function individually; they can only assert on the final output of the aspect, using the cc_binary/library targets from the BUILD file.

Notes:

  • I added a test for compilation flag duplication.

Addresses:
none

@furtib
furtib requested a review from Szelethus August 11, 2026 19:53
@furtib furtib self-assigned this Aug 11, 2026
@furtib furtib added the test ☑️ Adding or refactoring tests label Aug 11, 2026
@furtib

furtib commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

This PR is waaaay too big; will split into several pieces.
Starting with the expected to fail tests.

@furtib

furtib commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by: #284, and more to come.

@furtib furtib closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test ☑️ Adding or refactoring tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant