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

[bazel + rust] Set the path to selenium-manager in tests based on the OS #15524

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

shs96c
Copy link
Member

@shs96c shs96c commented Mar 27, 2025

PR Type

Bug fix, Enhancement


Description

  • Adjusted CARGO_BIN_EXE_selenium-manager path for OS compatibility.

  • Used Bazel select to handle OS-specific paths.


Changes walkthrough 📝

Relevant files
Enhancement
BUILD.bazel
Adjust `selenium-manager` path based on OS in Bazel           

rust/tests/BUILD.bazel

  • Replaced hardcoded CARGO_BIN_EXE_selenium-manager path with
    OS-specific paths.
  • Used Bazel select to differentiate between Windows and default
    conditions.
  • +4/-3     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix Windows path escaping

    Use double backslashes for Windows paths to properly escape the backslash
    character in string literals. Single backslashes in strings are treated as
    escape characters.

    rust/tests/BUILD.bazel [16-19]

     rustc_env = select({
    -  "//common:windows": {"CARGO_BIN_EXE_selenium-manager": "rust\\selenium-manager"},
    +  "//common:windows": {"CARGO_BIN_EXE_selenium-manager": "rust\\\\selenium-manager"},
       "//conditions:default": {"CARGO_BIN_EXE_selenium-manager": "rust/selenium-manager"},
     }),
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    __

    Why: The suggestion correctly identifies a critical issue with Windows path escaping. In the existing code, a single backslash is used which would be interpreted as an escape character, potentially causing runtime errors. The improved code properly escapes the backslash by using four backslashes (which become two in the string literal).

    High
    • More

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant