diff options
author | Simon Glass <sjg@chromium.org> | 2016-07-04 11:58:39 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-07-14 20:40:24 -0600 |
commit | ebec58fbcb6da7404b535b9d860546d9baef55c2 (patch) | |
tree | 2c178319877eeb1e1b7d0aed67baeecf49bafec0 /test/py/u_boot_spawn.py | |
parent | c7f636f59d7d506b89d7fc52aa6509329e9ded1b (diff) | |
download | u-boot-ebec58fbcb6da7404b535b9d860546d9baef55c2.tar.gz u-boot-ebec58fbcb6da7404b535b9d860546d9baef55c2.tar.bz2 u-boot-ebec58fbcb6da7404b535b9d860546d9baef55c2.zip |
test/py: Provide a way to get early console output
Some tests want to check the console output from SPL or U-Boot proper.
Provide a means to do this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/py/u_boot_spawn.py')
-rw-r--r-- | test/py/u_boot_spawn.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index d15517389e..3a0fbfad90 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -18,6 +18,9 @@ class Timeout(Exception): class Spawn(object): """Represents the stdio of a freshly created sub-process. Commands may be sent to the process, and responses waited for. + + Members: + output: accumulated output from expect() """ def __init__(self, args, cwd=None): @@ -34,6 +37,7 @@ class Spawn(object): self.waited = False self.buf = '' + self.output = '' self.logfile_read = None self.before = '' self.after = '' @@ -154,6 +158,7 @@ class Spawn(object): posafter = earliest_m.end() self.before = self.buf[:pos] self.after = self.buf[pos:posafter] + self.output += self.buf[:posafter] self.buf = self.buf[posafter:] return earliest_pi tnow_s = time.time() @@ -198,3 +203,11 @@ class Spawn(object): if not self.isalive(): break time.sleep(0.1) + + def get_expect_output(self): + """Return the output read by expect() + + Returns: + The output processed by expect(), as a string. + """ + return self.output |