Skip to content

Provide ltp_skip_test_file var for LTP, set can_install to False for Swap tools#4287

Merged
LiliDeng merged 6 commits intomainfrom
paxue/wsl_skip_ltp_file
Mar 6, 2026
Merged

Provide ltp_skip_test_file var for LTP, set can_install to False for Swap tools#4287
LiliDeng merged 6 commits intomainfrom
paxue/wsl_skip_ltp_file

Conversation

@paxue
Copy link
Collaborator

@paxue paxue commented Feb 19, 2026

Provide ltp_skip_test_file var for LTP to control the skipped tests
WSL won't work with traditional "ltp_skip_test" string because of the parsing '"'\n'"' issue.
Add can_install properties returning False to SwapOn, SwapOff, MkSwap, and SwapInfoBSD

@paxue paxue requested a review from LiliDeng as a code owner February 19, 2026 06:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for a new ltp_skip_test_file variable to the LTP test suite, allowing users to specify a file containing test names to skip. This is particularly useful for WSL environments where the traditional ltp_skip_test string variable has parsing issues with newline characters. The PR also includes unrelated changes to add can_install properties to swap-related tools and provides a WSL-specific skip file with 313 test names.

Changes:

  • Added ltp_skip_test_file variable support to enable file-based skip test configuration as an alternative to the string-based ltp_skip_test variable
  • Added can_install = False properties to SwapOn, SwapOff, MkSwap, and SwapInfoBSD tool classes
  • Created a WSL-specific skip file (wsl_ltp_skip_file.txt) containing 313 LTP tests to skip

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
lisa/tools/swap.py Adds can_install property returning False to swap utility tools (SwapOn, SwapOff, MkSwap, SwapInfoBSD)
lisa/microsoft/testsuites/ltp/wsl_ltp_skip_file.txt New file containing 313 LTP test names to skip for WSL environments
lisa/microsoft/testsuites/ltp/ltpsuite.py Extracts ltp_skip_test_file variable and passes it to the LTP run_test method
lisa/microsoft/testsuites/ltp/ltp.py Implements file copy logic to upload user-provided skip file to remote node when user_input_skip_file is provided
Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/ltp/ltp.py:111

  • The new user_input_skip_file parameter lacks documentation. Consider adding a docstring to the run_test method that explains all parameters, including this new one. The docstring should clarify that user_input_skip_file is a local file path that will be copied to the remote node and used as the skip file, and that it takes precedence over skip_tests.
    def run_test(
        self,
        test_result: TestResult,
        # empty ltp_tests will run LTP full test
        ltp_tests: List[str],
        skip_tests: List[str],
        log_path: str,
        user_input_skip_file: str = "",
        block_device: Optional[str] = None,
        temp_dir: str = "/tmp/",
        ltp_run_timeout: int = 12000,
    ) -> List[LtpResult]:

@LiliDeng
Copy link
Collaborator

@paxue what's the detailed issue? Can you elaborate a little bit? Thanks!

remove --- from debug info

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@paxue
Copy link
Collaborator Author

paxue commented Feb 23, 2026

@paxue what's the detailed issue? Can you elaborate a little bit? Thanks!

Hi, lili, there is a “Quoting Hell” error like the following sample:
'"echo \"fork13\nfork14\nvfork01\" > \"/opt/ltp/skipfile\""'

The root cause of this failure is nested escaping (commonly known as “Quoting Hell”).

When remotely invoke Windows wsl.exe over SSH, and then have WSL execute sh -c, our command string goes through three layers of parsing:

  1. Python layer – handles string escaping.
  2. Windows CMD/PowerShell layer – the default shell after SSH login, which parses double quotes.
  3. WSL Linux layer – sh -c parses quotes and \n again.

In our original command, the double quotes and newline characters after echo were truncated or misinterpreted during this multi-layer transmission process.

Solution:
Avoiding using skip test var in the WSL, but using skip test file instead.

Sample error link: https://msazure.visualstudio.com/LSG-linux/LSG-linux%20Team/_build/results?buildId=152954016&view=logs&j=95171610-00bb-5542-7037-0809d81e762f&t=06d4bbe5-8e6c-5426-ba44-a4a59a8cb6bb&l=16000

@paxue paxue changed the title Provide ltp_skip_test_file var for LTP Provide ltp_skip_test_file var for LTP, set can_install to False for Swap tools Feb 23, 2026
@LiliDeng
Copy link
Collaborator

@paxue what's the detailed issue? Can you elaborate a little bit? Thanks!

Hi, lili, there is a “Quoting Hell” error like the following sample: '"echo "fork13\nfork14\nvfork01" > "/opt/ltp/skipfile""'

The root cause of this failure is nested escaping (commonly known as “Quoting Hell”).

When remotely invoke Windows wsl.exe over SSH, and then have WSL execute sh -c, our command string goes through three layers of parsing:

  1. Python layer – handles string escaping.
  2. Windows CMD/PowerShell layer – the default shell after SSH login, which parses double quotes.
  3. WSL Linux layer – sh -c parses quotes and \n again.

In our original command, the double quotes and newline characters after echo were truncated or misinterpreted during this multi-layer transmission process.

Solution: Avoiding using skip test var in the WSL, but using skip test file instead.

Sample error link: https://msazure.visualstudio.com/LSG-linux/LSG-linux%20Team/_build/results?buildId=152954016&view=logs&j=95171610-00bb-5542-7037-0809d81e762f&t=06d4bbe5-8e6c-5426-ba44-a4a59a8cb6bb&l=16000

thanks for the explanation, could you please try this way

import base64

content = "\n".join(skip_tests)
encoded = base64.b64encode(content.encode()).decode()

self.node.execute(
    f"echo {encoded} | base64 -d > /opt/ltp/skipfile"
)

@paxue
Copy link
Collaborator Author

paxue commented Mar 3, 2026

@paxue what's the detailed issue? Can you elaborate a little bit? Thanks!

Hi, lili, there is a “Quoting Hell” error like the following sample: '"echo "fork13\nfork14\nvfork01" > "/opt/ltp/skipfile""'
The root cause of this failure is nested escaping (commonly known as “Quoting Hell”).
When remotely invoke Windows wsl.exe over SSH, and then have WSL execute sh -c, our command string goes through three layers of parsing:

  1. Python layer – handles string escaping.
  2. Windows CMD/PowerShell layer – the default shell after SSH login, which parses double quotes.
  3. WSL Linux layer – sh -c parses quotes and \n again.

In our original command, the double quotes and newline characters after echo were truncated or misinterpreted during this multi-layer transmission process.
Solution: Avoiding using skip test var in the WSL, but using skip test file instead.
Sample error link: https://msazure.visualstudio.com/LSG-linux/LSG-linux%20Team/_build/results?buildId=152954016&view=logs&j=95171610-00bb-5542-7037-0809d81e762f&t=06d4bbe5-8e6c-5426-ba44-a4a59a8cb6bb&l=16000

thanks for the explanation, could you please try this way

import base64

content = "\n".join(skip_tests)
encoded = base64.b64encode(content.encode()).decode()

self.node.execute(
    f"echo {encoded} | base64 -d > /opt/ltp/skipfile"
)

base64 method will work on short length of "skip_tests" string. For long string(4KB+) it will be out of input buffer. I will try another method

@LiliDeng LiliDeng merged commit 959f370 into main Mar 6, 2026
58 checks passed
@LiliDeng LiliDeng deleted the paxue/wsl_skip_ltp_file branch March 6, 2026 06:52
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.

3 participants