Skip to content

Create a unit_test macro#213

Open
furtib wants to merge 14 commits into
Ericsson:mainfrom
furtib:test_into_bazel_001
Open

Create a unit_test macro#213
furtib wants to merge 14 commits into
Ericsson:mainfrom
furtib:test_into_bazel_001

Conversation

@furtib

@furtib furtib commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Why:
We want to integrate our tests into Bazel.

What:

  • Added a Python script that checks whether specified patterns are available inside a file or a list of files.
  • Added a Bazel macro for creating a test using said Python file.
  • Demonstrated its use virtual include tests.

Addresses:
#210

Notes:
In very old Bazel versions (older than 6.4.0), bazel test ... must get the flag: --experimental_cc_implementation_deps.

@furtib furtib requested a review from Szelethus March 31, 2026 20:41
@furtib furtib self-assigned this Mar 31, 2026
@furtib furtib added the test ☑️ Adding or refactoring tests label Mar 31, 2026
@furtib furtib force-pushed the test_into_bazel_001 branch from 01027e4 to 3013225 Compare April 1, 2026 04:40

@nettle nettle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like the idea!
However I would consider not mixing python tests and bazel tests.
But as a prototype it is definitely good!
And, as @Szelethus mentioned, we need a strategy for bazel tests.
And... please dont touch legacy tests - I need them as the reference!

Comment thread test/unit/legacy/BUILD Outdated
Comment thread test/unit/BUILD
# See the License for the specific language governing permissions and
# limitations under the License.

exports_files(["grep_check.py"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess this should not be needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, I do need it.
Without it, the grep_check.py file would need to be in the same directory where the tests are defined.

@furtib

furtib commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

However I would consider not mixing python tests and bazel tests.

I'm completely lost as to what this means.

@furtib furtib force-pushed the test_into_bazel_001 branch from ffeae11 to 3e71779 Compare June 10, 2026 07:44
@furtib furtib marked this pull request as draft June 10, 2026 07:45
@furtib furtib force-pushed the test_into_bazel_001 branch from 3e71779 to f578d76 Compare June 10, 2026 11:46
@furtib furtib force-pushed the test_into_bazel_001 branch from f578d76 to 41ccf6b Compare June 10, 2026 11:52
@furtib furtib marked this pull request as ready for review June 10, 2026 13:46
@furtib furtib changed the title Create a unit_test macro for tests that assert on output files Create a unit_test macro Jun 10, 2026
@furtib

furtib commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

I have left this patch alone for a long time 😅.

So I realized that almost every unit test (except cache tests) is convertable to this format.
I'm still not sure about what you meant under "not mixing python tests and bazel tests", but hopefully I have fixed it?

@furtib furtib requested a review from nettle June 10, 2026 13:59
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.

2 participants