Skip to content

Commit

Permalink
add ; to list of shell escaped chars in sub_test.py (#26071)
Browse files Browse the repository at this point in the history
This adds the semicolon character to the list of special escaped
characters in two functions we use for preparing test command strings in
`sub_test.py`.

It was needed to accommodate HPO testing where the `execopts` expect to
pass a `;` as the delimiter between arguments for the `hpo-example.chpl`
blog article. I found that when `start_test` was used the program was
not seeing any arguments after the first `;` in the `argsString`
argument. Manually escaping the character did not work, but adding the
`;` to the list of escaped characters in these `ShellEscape` and
`ShellEscapeCommand` did.

TESTING:

- [x] paratest `[Summary: #Successes = 17653 | #Failures = 0 | #Futures
= 0]`
- [x] paratest w/gasnet `[Summary: #Successes = 17835 | #Failures = 0 |
#Futures = 0]`

[reviewed by @jabraham17 - thanks!]
  • Loading branch information
arezaii authored Oct 15, 2024
2 parents ce165a3 + 0715575 commit d8eed2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/test/sub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ def LauncherTimeoutArgs(seconds):

# Escape all special characters
def ShellEscape(arg):
return re.sub(r'([\\!@#$%^&*()?\'"|<>[\]{} ])', r'\\\1', arg)
return re.sub(r'([\\!@#$%^&*()?;\'"|<>[\]{} ])', r'\\\1', arg)

# Escape all special characters but leave spaces alone
def ShellEscapeCommand(arg):
return re.sub(r'([\\!@#$%^&*()?\'"|<>[\]{}])', r'\\\1', arg)
return re.sub(r'([\\!@#$%^&*()?;\'"|<>[\]{}])', r'\\\1', arg)


# Grabs the start and end of the output and replaces non-printable chars with ~
Expand Down Expand Up @@ -812,7 +812,7 @@ def get_util_dir():
def get_config_dir(util_dir):
return os.path.join(util_dir, 'config')

def main():
def main():
# Start of sub_test proper
#
global utildir, chpl_base, chpl_home, machine, envCompopts, platform
Expand Down

0 comments on commit d8eed2d

Please sign in to comment.