]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
trace: Improve the trace test number recognition
authorSimon Glass <sjg@chromium.org>
Wed, 24 Feb 2016 16:14:47 +0000 (09:14 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 26 Feb 2016 15:53:10 +0000 (08:53 -0700)
The awk tool can be confused by return character (ASCII 13) in its input
since it thinks there is a separate field. These can appear if the terminal
is in raw mode, perhaps due to a previous U-Boot crash with sandbox. This
is very confusing. Remove these so that the trace test passes.

Signed-off-by: Simon Glass <sjg@chromium.org>
test/trace/test-trace.sh

index 3e8651ed60151b4aeea5541cf834d2b2868c184d..746793c83bc38a3ddb68c24d8613fa921a340804 100755 (executable)
@@ -45,7 +45,9 @@ check_results() {
        # between calls 2 and 3, where tracing is paused.
        # This code gets the sign of the difference between each number and
        # its predecessor.
-       counts="$(tr -d , <${tmp} | awk '/traced function calls/ { diff = $1 - upto; upto = $1; printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
+       counts="$(tr -d ',\r' <${tmp} | awk \
+               '/traced function calls/ { diff = $1 - upto; upto = $1; \
+               printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
 
        if [ "${counts}" != "1 1 0 1 " ]; then
                fail "trace collection error: ${counts}"