diff options
author | Ricardo Martincoski <ricardo.martincoski@gmail.com> | 2017-06-28 23:45:44 -0300 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-07-01 16:05:14 +0200 |
commit | 77b4b948fc0309a1cf3eef55f44bec260319e5f8 (patch) | |
tree | 3964fca5f9fb3e2c158f30516ff9041b035dee9f /support/testing/infra/emulator.py | |
parent | e664c5f71c9614b991b13225809772eaea4a3dc5 (diff) | |
download | buildroot-77b4b948fc0309a1cf3eef55f44bec260319e5f8.tar.gz buildroot-77b4b948fc0309a1cf3eef55f44bec260319e5f8.zip |
support/testing: use pexpect.sendline directly
When using pexpect there is no need for a helper function. Just use
sendline() directly everywhere.
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/testing/infra/emulator.py')
-rw-r--r-- | support/testing/infra/emulator.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py index 55110db401..e488d8ac6c 100644 --- a/support/testing/infra/emulator.py +++ b/support/testing/infra/emulator.py @@ -80,9 +80,6 @@ class Emulator(object): # works as expected. return data.replace("\r\r", "\r") - def __write(self, wstr): - self.qemu.send(wstr) - # Wait for the login prompt to appear, and then login as root with # the provided password, or no password if not specified. def login(self, password=None): @@ -91,10 +88,10 @@ class Emulator(object): self.logfile.write("==> System does not boot") raise SystemError("System does not boot") - self.__write("root\n") + self.qemu.sendline("root") if password: self.__read_until("Password:") - self.__write(password + "\n") + self.qemu.sendline(password) self.__read_until("# ") if "# " not in self.log: raise SystemError("Cannot login") @@ -103,12 +100,12 @@ class Emulator(object): # Run the given 'cmd' on the target # return a tuple (output, exit_code) def run(self, cmd): - self.__write(cmd + "\n") + self.qemu.sendline(cmd) output = self.__read_until("# ") output = output.strip().splitlines() output = output[1:len(output)-1] - self.__write("echo $?\n") + self.qemu.sendline("echo $?") exit_code = self.__read_until("# ") exit_code = exit_code.strip().splitlines()[1] exit_code = int(exit_code) |