Skip to content

Add generator to generate tests that service client headers are buildable #3391

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

SergeyRyabinin
Copy link
Contributor

@SergeyRyabinin SergeyRyabinin commented Apr 23, 2025

Issue #, if available:
#3389
Description of changes:
Prevent such issues by a include all headers test.
Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

SergeyRyabinin added a commit that referenced this pull request Apr 24, 2025
SergeyRyabinin added a commit that referenced this pull request Apr 28, 2025
@SergeyRyabinin SergeyRyabinin force-pushed the sr/genIncludeTest branch 3 times, most recently from 45fef39 to 3c54f1c Compare April 28, 2025 22:06
@SergeyRyabinin SergeyRyabinin marked this pull request as ready for review April 29, 2025 17:21
cfgInit.shouldDisableIMDS = true;
Aws::Client::ClientConfiguration config(cfgInit);
AWS_UNREFERENCED_PARAM(config);
// auto pClient = Aws::MakeUnique<{{ t_namespace }}::{{ t_cpp_name }}>("{{ t_test_name }}", config);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

commented out because CodeCatalyst client is not default constructible.

TODO: fix that client or this test generation.


for root, dirs, files in os.walk(service_client_include_dir):
for filename in files:
if filename.endswith(".h") or filename.endswith(".hpp"):
Copy link
Contributor

Choose a reason for hiding this comment

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

do any of our files actually end with .hpp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, but if ever anyone is going to add an .hpp - this generator will pick them up.

with open(f"{test_file_path}", mode="w", encoding="utf-8") as rendered_test_f:
rendered_test_f.write(rendered_test)

return 0
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why return 0 if we dont return any other value? maybe prefer void

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just following the pattern of "generator return 0" on success, and throws an exception on error (and something such as return -1 in the middle).

@SergeyRyabinin SergeyRyabinin merged commit 9baf290 into main Apr 30, 2025
4 checks passed
@SergeyRyabinin SergeyRyabinin deleted the sr/genIncludeTest branch April 30, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants