Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables regression testing in bazel. #246

Merged
merged 10 commits into from
Jan 5, 2024

Conversation

francocipollone
Copy link
Collaborator

@francocipollone francocipollone commented Oct 13, 2023

🎉 New feature

closes #247

Summary

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if it affects the public API)

Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
stonier
stonier previously approved these changes Oct 17, 2023
Copy link
Collaborator

@stonier stonier left a comment

Choose a reason for hiding this comment

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

LGTM

@francocipollone francocipollone marked this pull request as ready for review October 18, 2023 12:53
@francocipollone
Copy link
Collaborator Author

@stonier One quick question as you have experience here. PR in maliput has been merged, now the test_utilities library is part of maliput.
However, here the bazel job isn't finding that library.
Do we have to manually push to BCR maliput like a "new release"?

@francocipollone
Copy link
Collaborator Author

@stonier One quick question as you have experience here. PR in maliput has been merged, now the test_utilities library is part of maliput. However, here the bazel job isn't finding that library. Do we have to manually push to BCR maliput like a "new release"?

Friendly ping here @stonier

@francocipollone
Copy link
Collaborator Author

I retriggered CI and now it is failing due to another issue not related to this PR:

ERROR: Error computing the main repository mapping: in module dependency chain <root> -> bazel_tools@_ -> rules_cc@0.0.9: module not found in registries: rules_cc@0.0.9

@francocipollone
Copy link
Collaborator Author

I retriggered CI and now it is failing due to another issue not related to this PR:

ERROR: Error computing the main repository mapping: in module dependency chain <root> -> bazel_tools@_ -> rules_cc@0.0.9: module not found in registries: rules_cc@0.0.9

This is fixed

@francocipollone
Copy link
Collaborator Author

@stonier One quick question as you have experience here. PR in maliput has been merged, now the test_utilities library is part of maliput. However, here the bazel job isn't finding that library. Do we have to manually push to BCR maliput like a "new release"?

Going back to this. I assume we have to create a maliput release that ships test_utilities library. Correct? @stonier

BUILD.bazel Outdated
hdrs = glob(["test/*.h"]),
copts = COPTS,
strip_include_prefix = "test",
visibility = ["//visibility:public"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This library only contains the test/assert_compare.h header file that is used in serveral test under regression folder.

I tried using visibility:private but I can't add this target as dep to a cc_test statement because there is no visibility.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! Done at ffa0582

@francocipollone
Copy link
Collaborator Author

francocipollone commented Nov 29, 2023

Pendings:

Copy link
Collaborator

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

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

PTAL

BUILD.bazel Outdated
hdrs = glob(["test/*.h"]),
copts = COPTS,
strip_include_prefix = "test",
visibility = ["//visibility:public"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

# ],
# )
# Not very bazel style (prefer individual test definitions)
def generate_unit_tests(sources):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest you also allow to pass a list of target dependencies.
That will allow to select in each library the target link dependencies and pair it to what we do in cmake.
I also prefer to have the for loop in each BUILD.bazel file and only pass here the src list with just one file instead of the entire list. It is a matter of composability.
Note you also have the ability to pass in kwargs and default values --> https://bazel.build/rules/macro-tutorial . That could help with target customization. For instance, if we have at some point a test that deserves promotion to size="medium" we could use default values and override the default "small".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I suggest you also allow to pass a list of target dependencies.
That will allow to select in each library the target link dependencies and pair it to what we do in cmake.

I understand that this is solution is actually better.

However I tried to replicate the current CMake setup, and in the current CMake setup we link to all the targets: https://github.com/maliput/maliput_malidrive/blob/eb547917ac19c1d56efdc5ab09665e49e9571e97/test/CMakeLists.txt

francocipollone and others added 2 commits December 4, 2023 13:22
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
@stonier
Copy link
Collaborator

stonier commented Jan 5, 2024

If bazel test //... now does something, you could/should enable them in https://github.com/maliput/maliput_malidrive/blob/main/.bcr/presubmit.yml

Otherwise, LGTM.

stonier
stonier previously approved these changes Jan 5, 2024
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
@francocipollone
Copy link
Collaborator Author

I will proceed and merge it

@francocipollone
Copy link
Collaborator Author

If bazel test //... now does something, you could/should enable them in https://github.com/maliput/maliput_malidrive/blob/main/.bcr/presubmit.yml

Otherwise, LGTM.

Done!

@francocipollone francocipollone merged commit 2b62902 into main Jan 5, 2024
4 checks passed
@francocipollone francocipollone deleted the francocipollone/enable_bazel_testing branch January 5, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Enable bazel testing for regression tests
3 participants