1 # Copyright (c) 2013 The Chromium OS Authors.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License as
5 # published by the Free Software Foundation; either version 2 of
6 # the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 # Simple test script for tracing with sandbox
25 echo "Test failed: $1"
26 if [ -n ${tmp} ]; then
34 OPTS="O=${OUTPUT_DIR} ${TRACE_OPT}"
35 NUM_CPUS=$(grep -c processor /proc/cpuinfo)
36 make ${OPTS} sandbox_config
37 make ${OPTS} -s -j${NUM_CPUS}
42 ./${OUTPUT_DIR}/u-boot <<END
60 # Expect sha256 to run 3 times, so we see the string 6 times
61 if [ $(grep -c sha256 ${tmp}) -ne 6 ]; then
65 # 4 sets of results (output of 'trace stats')
66 if [ $(grep -c "traced function calls" ${tmp}) -ne 4 ]; then
67 fail "trace output error"
70 # Check trace counts. We expect to see an increase in the number of
71 # traced function calls between each 'trace stats' command, except
72 # between calls 2 and 3, where tracing is paused.
73 # This code gets the sign of the difference between each number and
75 counts="$(tr -d , <${tmp} | awk '/traced function calls/ { diff = $1 - upto; upto = $1; printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
77 if [ "${counts}" != "1 1 0 1 " ]; then
78 fail "trace collection error: ${counts}"
82 echo "Simple trace test / sanity check using sandbox"