From: Simon Glass <simon.glass@canonical.com> The sandbox filesystem's host save command does not truncate existing files. If a previous test run created a larger trace file, the extra data remains when a smaller trace is written, causing proftool to fail with "Cannot read trace file" when it tries to read past the actual data. Fix this by removing any existing trace file before saving. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- test/py/tests/test_trace.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py index fcdcbe2c6db..0bddf408833 100644 --- a/test/py/tests/test_trace.py +++ b/test/py/tests/test_trace.py @@ -65,6 +65,8 @@ def collect_trace(ubman): out = ubman.run_command(f'trace calls {addr:x} {size:x}') print(out) fname = os.path.join(TMPDIR, 'trace') + if os.path.exists(fname): + os.unlink(fname) out = ubman.run_command( 'host save hostfs - %x %s ${profoffset}' % (addr, fname)) return fname, int(dm_f_time[0]) -- 2.43.0