mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-devtest
synced 2026-01-15 10:23:32 +01:00
os.Environment, os.Machine: Add --be-opts
--be-opts is a means to pass machine-backend-specific options to that backend. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
dccb75246a
commit
3c9c5f1769
2 changed files with 17 additions and 0 deletions
|
|
@ -5,6 +5,21 @@ from datetime import datetime
|
||||||
from .Connections import Connections
|
from .Connections import Connections
|
||||||
from jwutils import Options
|
from jwutils import Options
|
||||||
from jwutils.log import *
|
from jwutils.log import *
|
||||||
|
import shlex
|
||||||
|
|
||||||
|
def _parse_opts_str(s):
|
||||||
|
lexer = shlex.shlex(s, posix=True)
|
||||||
|
lexer.whitespace = ','
|
||||||
|
lexer.whitespace_split = True
|
||||||
|
ret = {}
|
||||||
|
for pair in lexer:
|
||||||
|
try:
|
||||||
|
t = pair.split('=', 1)
|
||||||
|
ret[t[0]] = t[1]
|
||||||
|
continue
|
||||||
|
except:
|
||||||
|
ret[pair] = True
|
||||||
|
return ret
|
||||||
|
|
||||||
class Environment:
|
class Environment:
|
||||||
|
|
||||||
|
|
@ -20,6 +35,7 @@ class Environment:
|
||||||
self.time_stamp = (datetime.now() if args.time_stamp is None else datetime.strptime(args.time_stamp, fmt)).strftime(fmt)
|
self.time_stamp = (datetime.now() if args.time_stamp is None else datetime.strptime(args.time_stamp, fmt)).strftime(fmt)
|
||||||
self.tag = args.tag
|
self.tag = args.tag
|
||||||
slog(INFO, "Tag = {}\n".format(self.tag))
|
slog(INFO, "Tag = {}\n".format(self.tag))
|
||||||
|
self.be_opts = _parse_opts_str(args.be_opts)
|
||||||
self.connections = Connections()
|
self.connections = Connections()
|
||||||
for spec in args.connection:
|
for spec in args.connection:
|
||||||
self.connections.append(spec)
|
self.connections.append(spec)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ class MachineCmd(jwutils.Cmd): # export
|
||||||
def add_parser(self, parsers):
|
def add_parser(self, parsers):
|
||||||
p = super().add_parser(parsers)
|
p = super().add_parser(parsers)
|
||||||
p.add_argument("-B", "--backend", help="Machine backend", default='qemu')
|
p.add_argument("-B", "--backend", help="Machine backend", default='qemu')
|
||||||
|
p.add_argument( "--be-opts", help="Machine backend options", default='')
|
||||||
p.add_argument("-P", "--platform", help="Target platform type", required=True)
|
p.add_argument("-P", "--platform", help="Target platform type", required=True)
|
||||||
p.add_argument("-C", "--connection", help="Connection specification of the form 'proto=console,phase=pre|up-shutdown'", action='append', default=[])
|
p.add_argument("-C", "--connection", help="Connection specification of the form 'proto=console,phase=pre|up-shutdown'", action='append', default=[])
|
||||||
p.add_argument("-T", "--test-case-path", help="Test case search path, directories separated by colons", required=True)
|
p.add_argument("-T", "--test-case-path", help="Test case search path, directories separated by colons", required=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue