1 # Copyright (c) 2013 The Chromium OS Authors.
3 # SPDX-License-Identifier: GPL-2.0+
6 # Simple test script for tracing with sandbox
12 echo "Test failed: $1"
13 if [ -n ${tmp} ]; then
21 OPTS="O=${OUTPUT_DIR} ${TRACE_OPT}"
22 NUM_CPUS=$(grep -c processor /proc/cpuinfo)
23 make ${OPTS} sandbox_config
24 make ${OPTS} -s -j${NUM_CPUS}
29 ./${OUTPUT_DIR}/u-boot <<END
47 # Expect sha256 to run 3 times, so we see the string 6 times
48 if [ $(grep -c sha256 ${tmp}) -ne 6 ]; then
52 # 4 sets of results (output of 'trace stats')
53 if [ $(grep -c "traced function calls" ${tmp}) -ne 4 ]; then
54 fail "trace output error"
57 # Check trace counts. We expect to see an increase in the number of
58 # traced function calls between each 'trace stats' command, except
59 # between calls 2 and 3, where tracing is paused.
60 # This code gets the sign of the difference between each number and
62 counts="$(tr -d , <${tmp} | awk '/traced function calls/ { diff = $1 - upto; upto = $1; printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
64 if [ "${counts}" != "1 1 0 1 " ]; then
65 fail "trace collection error: ${counts}"
69 echo "Simple trace test / sanity check using sandbox"