python: Flush the simulation stdout/stderr buffers

Occasionally gem5's stdout/stderr, when run within the TestLib
framework, will be shuffled. This is resolved by flushing the
stdout/stderr buffer before and after simulation.

In addition to this, the has been improved to remove
boilerplate gem5 code from the stdout comparison.

Change-Id: I04c8f9cee4475b8eab2f1ba9bb76bfa3cfcca6ec
Reviewed-by: Jason Lowe-Power <>
Reviewed-by: Andreas Sandberg <>
Maintainer: Jason Lowe-Power <>
Maintainer: Andreas Sandberg <>
Tested-by: kokoro <>
13 files changed