Skip to content

Updated ACE tests for Android NDK's Clang#2430

Merged
mitza-oci merged 1 commit into
DOCGroup:masterfrom
mitza-oci:ace-android-tests
Jul 25, 2025
Merged

Updated ACE tests for Android NDK's Clang#2430
mitza-oci merged 1 commit into
DOCGroup:masterfrom
mitza-oci:ace-android-tests

Conversation

@mitza-oci
Copy link
Copy Markdown
Member

@mitza-oci mitza-oci commented Jul 23, 2025

Avoids errors and warnings on this platform

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of unused parameters and variables to prevent compiler warnings on unsupported platforms.
    • Test functions now return error counts to better reflect test outcomes.
    • Constants and functions are now conditionally compiled based on feature availability (e.g., IPv6, mktemp, threading).
  • Refactor

    • Streamlined infinite loop constructs for clarity.
    • Reformatted and cleaned up code for readability and consistency.
    • Removed unnecessary inheritance and unused variables.
  • New Features

    • Added a default copy constructor to the Element_Counter template class.

Avoids errors and warnings on this platform
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 23, 2025

Walkthrough

The changes primarily refactor and clean up several test files by adjusting variable scope, improving conditional compilation, updating loop constructs, and correcting return values. Some unused variables and constants are removed, and explicit constructors are added for clarity. No major logic or control flow changes are introduced.

Changes

File(s) Change Summary
ACE/tests/Compiler_Features_16_Test.cpp Removed unused variable, reformatted namespace and operator overload signature.
ACE/tests/MM_Shared_Memory_Test.cpp Moved static variables and function under conditional compilation guard.
ACE/tests/Multicast_Interfaces_Test.cpp Added unused-parameter handling for unsupported platforms in function.
ACE/tests/OS_Test.cpp Changed function to return accumulated error count instead of always returning 0.
ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp Removed inheritance from std::function in struct declaration.
ACE/tests/Recursive_Condition_Test.cpp Moved variable declaration inside conditional block and updated return value to reflect test status.
ACE/tests/SOCK_Send_Recv_Test_IPV6.cpp Added IPv6 conditional guard around constants and function definition.
ACE/tests/STL_algorithm_Test_T.cpp Explicitly defaulted copy constructor added to template class.
ACE/tests/Sendfile_Test.cpp Removed unused constants and related comments.
ACE/tests/Thread_Pool_Test.cpp Replaced infinite for-loops with while(true) loops for clarity.
ACE/tests/randomize.h Changed float literal to double in division for coefficient calculation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • iguessthislldo

Poem

In the warren where the code does dwell,
We tidied loops and guarded well,
Unused lines now hop away,
Conditionals keep bugs at bay.
With copy made explicit and types now true,
This bunny’s proud of what we do!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 675c2f8 and 6e9a5a3.

📒 Files selected for processing (11)
  • ACE/tests/Compiler_Features_16_Test.cpp (1 hunks)
  • ACE/tests/MM_Shared_Memory_Test.cpp (2 hunks)
  • ACE/tests/Multicast_Interfaces_Test.cpp (1 hunks)
  • ACE/tests/OS_Test.cpp (1 hunks)
  • ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp (1 hunks)
  • ACE/tests/Recursive_Condition_Test.cpp (2 hunks)
  • ACE/tests/SOCK_Send_Recv_Test_IPV6.cpp (1 hunks)
  • ACE/tests/STL_algorithm_Test_T.cpp (1 hunks)
  • ACE/tests/Sendfile_Test.cpp (0 hunks)
  • ACE/tests/Thread_Pool_Test.cpp (2 hunks)
  • ACE/tests/randomize.h (1 hunks)
💤 Files with no reviewable changes (1)
  • ACE/tests/Sendfile_Test.cpp
🧰 Additional context used
🧠 Learnings (4)
ACE/tests/Multicast_Interfaces_Test.cpp (3)

Learnt from: jwillemsen
PR: #870
File: ACE/ace/UNIX_Addr.inl:39-39
Timestamp: 2025-02-11T10:00:08.023Z
Learning: In ACE_UNIX_Addr's equality operator, the comparison length should be sizeof(sun_path) - 1 to exclude the null terminator, not i. For Linux abstract paths, i is used to skip the first character (i=1) when both paths are empty, but the -1 is still needed to handle the null terminator correctly.

Learnt from: jwillemsen
PR: #870
File: ACE/ace/UNIX_Addr.inl:39-39
Timestamp: 2025-02-11T10:00:08.023Z
Learning: In ACE_UNIX_Addr's equality operator, the comparison length should be sizeof(sun_path) - 1 to exclude the null terminator. For Linux abstract paths, while i=1 is used to skip the first character, using i instead of -1 in the length calculation would be incorrect as it would either include the null terminator (for regular paths) or miss the last valid character (for abstract paths).

Learnt from: likema
PR: #870
File: ACE/ace/UNIX_Addr.cpp:0-0
Timestamp: 2025-02-07T16:15:05.367Z
Learning: The ACE_UNIX_Addr class in ACE/ace/UNIX_Addr.cpp supports abstract paths in Linux, where paths starting with '@' are treated specially by having their first character replaced with a null terminator in the sun_path field.

ACE/tests/SOCK_Send_Recv_Test_IPV6.cpp (4)

Learnt from: jwillemsen
PR: #870
File: ACE/ace/UNIX_Addr.inl:39-39
Timestamp: 2025-02-11T10:00:08.023Z
Learning: In ACE_UNIX_Addr's equality operator, the comparison length should be sizeof(sun_path) - 1 to exclude the null terminator, not i. For Linux abstract paths, i is used to skip the first character (i=1) when both paths are empty, but the -1 is still needed to handle the null terminator correctly.

Learnt from: jwillemsen
PR: #870
File: ACE/ace/UNIX_Addr.inl:39-39
Timestamp: 2025-02-11T10:00:08.023Z
Learning: In ACE_UNIX_Addr's equality operator, the comparison length should be sizeof(sun_path) - 1 to exclude the null terminator. For Linux abstract paths, while i=1 is used to skip the first character, using i instead of -1 in the length calculation would be incorrect as it would either include the null terminator (for regular paths) or miss the last valid character (for abstract paths).

Learnt from: likema
PR: #870
File: ACE/ace/UNIX_Addr.cpp:0-0
Timestamp: 2025-02-07T16:15:05.367Z
Learning: The ACE_UNIX_Addr class in ACE/ace/UNIX_Addr.cpp supports abstract paths in Linux, where paths starting with '@' are treated specially by having their first character replaced with a null terminator in the sun_path field.

Learnt from: likema
PR: #870
File: ACE/ace/UNIX_Addr.cpp:0-0
Timestamp: 2025-02-07T17:43:40.156Z
Learning: In ACE_UNIX_Addr::addr_to_string, when handling abstract paths on Linux (paths starting with '@'), the function returns -1 if the output buffer length is 1, as it needs at least 2 characters to store the '@' prefix and a null terminator.

ACE/tests/MM_Shared_Memory_Test.cpp (1)

Learnt from: likema
PR: #870
File: ACE/ace/UNIX_Addr.cpp:0-0
Timestamp: 2025-02-07T17:43:40.156Z
Learning: In ACE_UNIX_Addr::addr_to_string, when handling abstract paths on Linux (paths starting with '@'), the function returns -1 if the output buffer length is 1, as it needs at least 2 characters to store the '@' prefix and a null terminator.

ACE/tests/OS_Test.cpp (2)

Learnt from: likema
PR: #870
File: ACE/ace/UNIX_Addr.cpp:0-0
Timestamp: 2025-02-07T17:43:40.156Z
Learning: In ACE_UNIX_Addr::addr_to_string, when handling abstract paths on Linux (paths starting with '@'), the function returns -1 if the output buffer length is 1, as it needs at least 2 characters to store the '@' prefix and a null terminator.

Learnt from: jwillemsen
PR: #870
File: ACE/ace/UNIX_Addr.inl:39-39
Timestamp: 2025-02-11T10:00:08.023Z
Learning: In ACE_UNIX_Addr's equality operator, the comparison length should be sizeof(sun_path) - 1 to exclude the null terminator, not i. For Linux abstract paths, i is used to skip the first character (i=1) when both paths are empty, but the -1 is still needed to handle the null terminator correctly.

🔇 Additional comments (11)
ACE/tests/STL_algorithm_Test_T.cpp (1)

17-17: LGTM! Explicit default copy constructor improves clarity.

Adding the explicit default copy constructor is a good practice that enhances code clarity and ensures consistent behavior across different compilers, including Android NDK's Clang.

ACE/tests/Compiler_Features_16_Test.cpp (2)

26-26: Fix namespace closing syntax.

Correcting the namespace closing from }; to } fixes a syntax issue that could cause compiler warnings or errors.


28-28: Improved function signature formatting.

The reformatted function signature enhances readability by placing it on a single line with consistent spacing.

ACE/tests/OS_Test.cpp (1)

1211-1211: Fix return value to properly report test failures.

Returning retval instead of always returning 0 ensures that the accumulated error count is properly propagated to the caller, allowing test failures to be correctly detected.

ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp (1)

378-378: Simplified struct design by removing std::function inheritance.

Removing the inheritance from std::function<void(reactor_factory_type)> simplifies the design while maintaining the same functionality through the operator() overload. This change improves compiler compatibility and reduces template complexity.

ACE/tests/randomize.h (1)

58-58: Improve numerical precision consistency.

Changing from 1.0f to 1.0 ensures the division operation uses double precision consistently, matching the double const coefficient_ member type and avoiding potential mixed-precision arithmetic warnings.

ACE/tests/Multicast_Interfaces_Test.cpp (1)

108-109: LGTM! Proper handling of unused parameter.

The addition of the #else block with ACE_UNUSED_ARG(names) correctly suppresses unused parameter warnings on platforms that don't support either Windows-specific APIs or getifaddrs. This aligns well with the PR objective of avoiding warnings with Android NDK's Clang.

ACE/tests/Thread_Pool_Test.cpp (2)

208-208: Good refactoring for code clarity.

Replacing the for loop with while (true) makes the infinite loop intent more explicit and removes the unused loop increment variable. This is cleaner and may help avoid compiler warnings about unused variables.


295-295: Consistent improvement with the previous change.

Same beneficial refactoring as in test_queue_deactivation_shutdown() - the while (true) construct is more explicit about the infinite loop intent and removes the unused loop increment variable.

ACE/tests/SOCK_Send_Recv_Test_IPV6.cpp (1)

35-35: Proper conditional compilation for IPv6-specific code.

Adding the #if defined (ACE_HAS_IPV6) guard around the test constants and client function is appropriate since they're only used in IPv6-specific tests. This prevents compilation issues on platforms without IPv6 support and aligns with the existing conditional compilation pattern in the file.

ACE/tests/MM_Shared_Memory_Test.cpp (1)

64-67: Good conditional compilation for mktemp-dependent code.

Moving the static variables inside the #ifndef ACE_DISABLE_MKTEMP guard is appropriate since they're only used in the shared memory test logic that depends on mktemp functionality. This prevents unused variable warnings when ACE_DISABLE_MKTEMP is defined and aligns with the existing conditional compilation in run_main().

Also applies to: 198-198

Comment thread ACE/tests/Recursive_Condition_Test.cpp
@mitza-oci mitza-oci merged commit 18aa516 into DOCGroup:master Jul 25, 2025
37 checks passed
@mitza-oci mitza-oci deleted the ace-android-tests branch July 25, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants