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

runtests.py: parse the command line with shelx #317

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions BM/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess
import argparse
import os
import shlex
from avocado.core.job import Job
from avocado.core.nrunner.runnable import Runnable
from avocado.core.suite import TestSuite
Expand Down Expand Up @@ -67,13 +68,20 @@ def create_runnables_from_file(ftests):
# Handle empty lines and comments.
if not line.strip() or line.startswith('#'):
continue

# Split command line parameters.
parts = line.strip().split()
# Create a Runnable object.
runnable = Runnable("exec-test", parts[0], *parts[1:])
parts = parse_cmd_str(line.strip())
runnable = Runnable("exec-test", *parts)
tests.append(runnable)

return tests

def parse_cmd_str(cmd):
lexer = shlex.shlex(cmd, posix=True)
lexer.whitespace_split = True
lexer.whitespace = ' '
return list(lexer)

def main():
# Get the absolute directory of the tests file.
tests_abs = os.path.abspath(args.tests)
Expand Down
Loading