1 # Copyright (c) 2013 The Chromium OS Authors.
3 # SPDX-License-Identifier: GPL-2.0+
6 # Simple test script for tracing with sandbox
10 BASE="$(dirname $0)/.."
15 ./${OUTPUT_DIR}/u-boot <<END
33 # Expect sha256 to run 3 times, so we see the string 6 times
34 if [ $(grep -c sha256 ${tmp}) -ne 6 ]; then
38 # 4 sets of results (output of 'trace stats')
39 if [ $(grep -c "traced function calls" ${tmp}) -ne 4 ]; then
40 fail "trace output error"
43 # Check trace counts. We expect to see an increase in the number of
44 # traced function calls between each 'trace stats' command, except
45 # between calls 2 and 3, where tracing is paused.
46 # This code gets the sign of the difference between each number and
48 counts="$(tr -d ',\r' <${tmp} | awk \
49 '/traced function calls/ { diff = $1 - upto; upto = $1; \
50 printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
52 if [ "${counts}" != "1 1 0 1 " ]; then
53 fail "trace collection error: ${counts}"
57 echo "Simple trace test / sanity check using sandbox"
60 build_uboot "${TRACE_OPT}"