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
() {
44 RUNLTTV
=~
/devel
/lttv
/runlttv
46 if [ ! -x "$RUNLTTV" ]; then
47 echo "$0: $RUNLTTV not executable. Edit \$RUNLTTV to point to your lttv source directory." >/dev
/stderr
51 while getopts ":n:N:" options
; do
53 n
) expected_count
=$OPTARG;;
55 *) echo "Invalid option to trace_matches"
59 shift $
(($OPTIND - 1))
62 if [ -z "$pattern" ]; then
63 error
"no pattern specified"
69 error
"no trace directory specified"
72 traces
=$
(find "$2" -mindepth 1 -maxdepth 1 -type d
)
74 cnt
=$
($RUNLTTV -m text
"$traces" |
grep "$pattern" |
wc -l)
75 if [ -z "$expected_count" ]; then
76 if [ "$cnt" -eq "0" ]; then
77 fail
"Did not find at least one instance of $name in trace"
80 pass
"Found at least one instance of $name in trace."
84 if [ "$cnt" -ne "$expected_count" ]; then
85 fail
"Found $cnt instances of $name in trace, expected $expected_count"
88 pass
"Found $cnt instances of $name in trace."
This page took 0.032926 seconds and 5 git commands to generate.