docs: tweak formatting in pmrep(1) archive folio example
[pcp.git] / qa / show-me
blob6891e21e0c063e7064238534217646337dcc88c8
1 #!/bin/sh
3 # Show me the QA tests that did not pass
5 # Copyright (c) 1997-2002 Silicon Graphics, Inc. All Rights Reserved.
8 # generic initialization
9 iam=show-me
10 . ./common.rc
12 HOST=`hostname`
13 QA_HOST=
14 QA_USER=
15 QA_DIR=
17 if which gdiff >/dev/null 2>&1
18 then
19 DIFF=gdiff
20 else
21 if which meld >/dev/null 2>&1
22 then
23 DIFF=meld
24 else
25 if which xxdiff >/dev/null 2>&1
26 then
27 DIFF=xxdiff
28 else
29 DIFF="diff -c"
34 tmp=/tmp/$$
35 trap "cd /; rm -rf $tmp; exit" 0 1 2 3 15
36 rm -rf $tmp
37 mkdir $tmp
39 not_me=false
40 local=true
41 keep=false
42 while getopts d:h:klu: c
44 case $c in
45 d) QA_DIR=$OPTARG
46 not_me=true
49 h) QA_HOST=$OPTARG
50 local=false
53 k) keep=true
56 l) DIFF="diff -c"
59 u) QA_USER=$OPTARG
60 not_me=true
63 \?) echo "Usage: show-me [-l] [-k] [-d dir] [-h host] [-u user] [test ...]"
64 exit 2;;
65 esac
66 done
67 shift `expr $OPTIND - 1`
69 if [ -z "$QA_DIR" ]
70 then
71 if [ -z "$QA_HOST" -o "$QA_HOST" = localhost -o "$QA_HOST" = "`hostname`" ]
72 then
73 if [ -z "$QA_USER" -o "$QA_USER" = "$LOGNAME" ]
74 then
75 # local and really me
76 QA_DIR_DEFAULT=`pwd`
77 else
78 QA_DIR_DEFAULT=`ssh $QA_USER@$QA_HOST "/bin/ls -d isms/pcp[1-9]*/qa" 2>/dev/null | grep '^isms/' | tail -1`
80 else
81 QA_DIR_DEFAULT=`ssh $QA_USER@$QA_HOST "/bin/ls -d isms/pcp[1-9]*/qa" 2>/dev/null | grep '^isms/' | tail -1`
83 if [ "$QA_DIR_DEFAULT" = "" ]
84 then
85 QA_DIR_DEFAULT=isms/pcp/qa
87 QA_DIR="$QA_DIR_DEFAULT"
90 if [ $# -eq -0 ]
91 then
92 if $local
93 then
94 list="`echo *.out.bad \
95 | tr ' ' '\012' \
96 | sed -e 's/\.out\.bad//' \
97 | LC_COLLATE=POSIX sort -n`"
98 if [ "$list" = '*' ]
99 then
100 echo "No failing tests!"
101 exit
103 set - `echo $list`
104 else
105 x=`ssh $QA_USER@$QA_HOST echo $QA_DIR/\[0-9]*.out.bad 2>$tmp.err`
106 if [ -z "$x" ]
107 then
108 if [ -s $tmp.err ]
109 then
110 echo "ssh failed?"
111 cat $tmp.err
112 else
113 echo "No failing tests!"
115 exit
117 set - `echo "$x" \
118 | tr ' ' '\012' \
119 | sed -e 's/.*\///' -e 's/.out.bad//' \
120 | LC_COLLATE=POSIX sort -n`
121 echo "Failing tests: $*"
125 unset ROOT TOOLROOT MAKEFLAGS
126 quick=true
127 check=false
128 . ./common
130 for id
132 case "$id"
134 [0-9])
135 id=00$id
137 [0-9][0-9])
138 id=0$id
140 esac
142 if [ "$QA_HOST" != $HOST ]
143 then
144 echo "Fetch files from $QA_USER@$QA_HOST:$QA_DIR ..."
145 rm -f $tmp/$id.out.bad $tmp/$id.out
146 scp $QA_USER@$QA_HOST:$QA_DIR/$id.out.bad $tmp
147 scp $QA_USER@$QA_HOST:$QA_DIR/$id.out $tmp
148 cd $tmp
149 elif $not_me
150 then
151 if [ -d $QA_DIR ]
152 then
153 cd $QA_DIR
154 else
155 echo "$id: No directory: $QA_DIR"
156 exit 1
159 $PCP_ECHO_PROG $PCP_ECHO_N "$id: ""$PCP_ECHO_C"
160 if [ ! -f $id.out ]
161 then
162 echo "Could not find $id.out in `pwd`"
163 elif [ ! -f $id.out.bad ]
164 then
165 echo "Could not find $id.out.bad in `pwd`"
166 else
167 echo
168 if [ "$DIFF" = xxdiff ]
169 then
170 $DIFF $id.out $id.out.bad >/dev/null 2>&1
171 else
172 $DIFF $id.out $id.out.bad
175 if $keep
176 then
177 if [ -f $here/$id.out.bad ]
178 then
179 if diff $here/$id.out.bad $id.out.bad >diff.tmp
180 then
181 # same
183 else
184 echo "Warning: overwriting $id.out.bad ... diffs"
185 cat diff.tmp
186 rm -f $here/$id.out.bad
187 mv $id.out.bad $here
189 else
190 mv $id.out.bad $here
193 cd $here
194 done