1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 10:50:51 +01:00

Merge pull request #200 from Sticklyman1936/gem5_fixes

Gem5 fixes
This commit is contained in:
marcbonnici 2017-11-08 10:28:20 +00:00 committed by GitHub
commit aca3d451f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,8 @@ else:
from pexpect import EOF, TIMEOUT, spawn from pexpect import EOF, TIMEOUT, spawn
from devlib.exception import HostError, TargetError, TimeoutError from devlib.exception import HostError, TargetError, TimeoutError
from devlib.utils.misc import which, strip_bash_colors, escape_single_quotes, check_output from devlib.utils.misc import which, strip_bash_colors, check_output
from devlib.utils.misc import escape_single_quotes, escape_double_quotes
from devlib.utils.types import boolean from devlib.utils.types import boolean
@ -605,7 +606,7 @@ class Gem5Connection(TelnetConnection):
try: try:
# Try and force a prompt to be shown # Try and force a prompt to be shown
self.conn.send('\n') self.conn.send('\n')
self.conn.expect([r'# ', self.conn.UNIQUE_PROMPT, r'\[PEXPECT\][\\\$\#]+ '], timeout=60) self.conn.expect([r'# ', r'\$ ', self.conn.UNIQUE_PROMPT, r'\[PEXPECT\][\\\$\#]+ '], timeout=60)
prompt_found = True prompt_found = True
except TIMEOUT: except TIMEOUT:
pass pass
@ -695,6 +696,9 @@ class Gem5Connection(TelnetConnection):
gem5_logger.debug("gem5_shell command: {}".format(command)) gem5_logger.debug("gem5_shell command: {}".format(command))
if as_root:
command = 'echo "{}" | su'.format(escape_double_quotes(command))
# Send the actual command # Send the actual command
self.conn.send("{}\n".format(command)) self.conn.send("{}\n".format(command))
@ -753,9 +757,9 @@ class Gem5Connection(TelnetConnection):
""" """
gem5_logger.info("Mounting VirtIO device in simulated system") gem5_logger.info("Mounting VirtIO device in simulated system")
self._gem5_shell('su -c "mkdir -p {}" root'.format(self.gem5_input_dir)) self._gem5_shell('mkdir -p {}'.format(self.gem5_input_dir), as_root=True)
mount_command = "mount -t 9p -o trans=virtio,version=9p2000.L,aname={} gem5 {}".format(self.gem5_interact_dir, self.gem5_input_dir) mount_command = "mount -t 9p -o trans=virtio,version=9p2000.L,aname={} gem5 {}".format(self.gem5_interact_dir, self.gem5_input_dir)
self._gem5_shell(mount_command) self._gem5_shell(mount_command, as_root=True)
def _move_to_temp_dir(self, source): def _move_to_temp_dir(self, source):
""" """