3 # Copyright 2010 Ericsson AB
5 # This file is part of LTTng-UST.
7 # LTTng-UST is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # LTTng-UST is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with LTTng-UST. If not, see <http://www.gnu.org/licenses/>.
20 function starttest
() {
22 echo "------------------------------------"
23 echo "Starting test: $1"
24 echo "------------------------------------"
27 function check_trace_logs
() {
30 for f
in $
(ls $1/*.log
); do
31 NLINES
=$
(egrep "Warning|Error" $f |
wc -l)
32 if [ "$NLINES" -ne "0" ]; then
33 fail
"Errors/warnings found in $f"
37 pass
"$f was consistent"
42 function trace_matches
() {
45 if [ ! -x "$RUNLTTV" ]; then
46 echo "$0: $RUNLTTV not executable. Edit \$RUNLTTV to point to your lttv source directory." >/dev
/stderr
50 while getopts ":n:N:" options
; do
52 n
) expected_count
=$OPTARG;;
54 *) echo "Invalid option to trace_matches"
58 shift $
(($OPTIND - 1))
61 if [ -z "$pattern" ]; then
62 error
"no pattern specified"
68 error
"no trace directory specified"
71 traces
=$
(find "$2" -mindepth 1 -maxdepth 1 -type d
)
73 cnt
=$
($RUNLTTV -m text
"$traces" |
grep "$pattern" |
wc -l)
74 if [ -z "$expected_count" ]; then
75 if [ "$cnt" -eq "0" ]; then
76 fail
"Did not find at least one instance of $name in trace"
79 pass
"Found at least one instance of $name in trace."
83 if [ "$cnt" -ne "$expected_count" ]; then
84 fail
"Found $cnt instances of $name in trace, expected $expected_count"
87 pass
"Found $cnt instances of $name in trace."
This page took 0.034109 seconds and 4 git commands to generate.