diff mbox

[U-Boot,v2,06/16] trace: Improve the trace test number recognition

Message ID 1456330497-15242-7-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Feb. 24, 2016, 4:14 p.m. UTC
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>
---

Changes in v2: None

 test/trace/test-trace.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Glass Feb. 26, 2016, 5:13 p.m. UTC | #1
On 24 February 2016 at 09:14, Simon Glass <sjg@chromium.org> wrote:
> 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>
> ---
>
> Changes in v2: None
>
>  test/trace/test-trace.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/test/trace/test-trace.sh b/test/trace/test-trace.sh
index 3e8651e..746793c 100755
--- a/test/trace/test-trace.sh
+++ b/test/trace/test-trace.sh
@@ -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}"