Revision 79e40ab1 tests/qemu-iotests/check

b/tests/qemu-iotests/check
78 78

  
79 79
    if $showme
80 80
    then
81
	:
81
        :
82 82
    elif $needwrap
83 83
    then
84
	if [ -f check.time -a -f $tmp.time ]
85
	then
86
	    cat check.time $tmp.time \
87
	    | $AWK_PROG '
88
	{ t[$1] = $2 }
89
END	{ if (NR > 0) {
90
	    for (i in t) print i " " t[i]
91
	  }
92
	}' \
93
	    | sort -n >$tmp.out
94
	    mv $tmp.out check.time
95
	fi
96

  
97
	if [ -f $tmp.expunged ]
98
	then
99
	    notrun=`wc -l <$tmp.expunged | sed -e 's/  *//g'`
100
	    try=`expr $try - $notrun`
101
	    list=`echo "$list" | sed -f $tmp.expunged`
102
	fi
103

  
104
	echo "" >>check.log
105
	date >>check.log
106
	echo $list | fmt | sed -e 's/^/    /' >>check.log
107
	$interrupt && echo "Interrupted!" >>check.log
108
        
109
	if [ ! -z "$notrun" ]
110
	then
111
	    echo "Not run:$notrun"
112
	    echo "Not run:$notrun" >>check.log
113
	fi
84
        if [ -f check.time -a -f $tmp.time ]
85
        then
86
            cat check.time $tmp.time \
87
            | $AWK_PROG '
88
        { t[$1] = $2 }
89
END        { if (NR > 0) {
90
            for (i in t) print i " " t[i]
91
          }
92
        }' \
93
            | sort -n >$tmp.out
94
            mv $tmp.out check.time
95
        fi
96

  
97
        if [ -f $tmp.expunged ]
98
        then
99
            notrun=`wc -l <$tmp.expunged | sed -e 's/  *//g'`
100
            try=`expr $try - $notrun`
101
            list=`echo "$list" | sed -f $tmp.expunged`
102
        fi
103

  
104
        echo "" >>check.log
105
        date >>check.log
106
        echo $list | fmt | sed -e 's/^/    /' >>check.log
107
        $interrupt && echo "Interrupted!" >>check.log
108

  
109
        if [ ! -z "$notrun" ]
110
        then
111
            echo "Not run:$notrun"
112
            echo "Not run:$notrun" >>check.log
113
        fi
114 114
        if [ ! -z "$n_bad" -a $n_bad != 0 ]
115
	then
116
	    echo "Failures:$bad"
117
	    echo "Failed $n_bad of $try tests"
118
	    echo "Failures:$bad" | fmt >>check.log
119
	    echo "Failed $n_bad of $try tests" >>check.log
120
	else
121
	    echo "Passed all $try tests"
122
	    echo "Passed all $try tests" >>check.log
123
	fi
124
	needwrap=false
115
        then
116
            echo "Failures:$bad"
117
            echo "Failed $n_bad of $try tests"
118
            echo "Failures:$bad" | fmt >>check.log
119
            echo "Failed $n_bad of $try tests" >>check.log
120
        else
121
            echo "Passed all $try tests"
122
            echo "Passed all $try tests" >>check.log
123
        fi
124
        needwrap=false
125 125
    fi
126 126

  
127 127
    rm -f /tmp/*.out /tmp/*.err /tmp/*.time
......
185 185

  
186 186
    if $showme
187 187
    then
188
	echo
189
	continue
190
    elif [ -f expunged ] && $expunge && egrep "^$seq([ 	]|\$)" expunged >/dev/null
188
        echo
189
        continue
190
    elif [ -f expunged ] && $expunge && egrep "^$seq([         ]|\$)" expunged >/dev/null
191 191
    then
192
	echo " - expunged"
193
	rm -f $seq.out.bad
194
	echo "/^$seq\$/d" >>$tmp.expunged
192
        echo " - expunged"
193
        rm -f $seq.out.bad
194
        echo "/^$seq\$/d" >>$tmp.expunged
195 195
    elif [ ! -f $seq ]
196 196
    then
197
	echo " - no such test?"
198
	echo "/^$seq\$/d" >>$tmp.expunged
197
        echo " - no such test?"
198
        echo "/^$seq\$/d" >>$tmp.expunged
199 199
    else
200
	# really going to try and run this one
201
	#
202
	rm -f $seq.out.bad
203
	lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
204
	if [ "X$lasttime" != X ]; then
205
		echo -n " ${lasttime}s ..."
206
	else
207
		echo -n "	"	# prettier output with timestamps.
208
	fi
209
	rm -f core $seq.notrun
210

  
211
	# for hangcheck ...
212
	echo "$seq" >/tmp/check.sts
213

  
214
	start=`_wallclock`
215
	$timestamp && echo -n "	["`date "+%T"`"]"
216
	[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
217
	MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
218
		./$seq >$tmp.out 2>&1
219
	sts=$?
220
	$timestamp && _timestamp
221
	stop=`_wallclock`
222

  
223
	if [ -f core ]
224
	then
225
	    echo -n " [dumped core]"
226
	    mv core $seq.core
227
	    err=true
228
	fi
229

  
230
	if [ -f $seq.notrun ]
231
	then
232
	    $timestamp || echo -n " [not run] "
233
	    $timestamp && echo " [not run]" && echo -n "	$seq -- "
234
	    cat $seq.notrun
235
	    notrun="$notrun $seq"
236
	else
237
	    if [ $sts -ne 0 ]
238
	    then
239
		echo -n " [failed, exit status $sts]"
240
		err=true
241
	    fi
242
	    if [ ! -f $seq.out ]
243
	    then
244
		echo " - no qualified output"
245
		err=true
246
	    else
247
		if diff -w $seq.out $tmp.out >/dev/null 2>&1
248
		then
249
		    echo ""
250
		    if $err
251
		    then
252
			:
253
		    else
254
			echo "$seq `expr $stop - $start`" >>$tmp.time
255
		    fi
256
		else
257
		    echo " - output mismatch (see $seq.out.bad)"
258
		    mv $tmp.out $seq.out.bad
259
		    $diff -w $seq.out $seq.out.bad
260
		    err=true
261
		fi
262
	    fi
263
	fi
200
        # really going to try and run this one
201
        #
202
        rm -f $seq.out.bad
203
        lasttime=`sed -n -e "/^$seq /s/.* //p" <check.time`
204
        if [ "X$lasttime" != X ]; then
205
                echo -n " ${lasttime}s ..."
206
        else
207
                echo -n "        "        # prettier output with timestamps.
208
        fi
209
        rm -f core $seq.notrun
210

  
211
        # for hangcheck ...
212
        echo "$seq" >/tmp/check.sts
213

  
214
        start=`_wallclock`
215
        $timestamp && echo -n "        ["`date "+%T"`"]"
216
        [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
217
        MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
218
                ./$seq >$tmp.out 2>&1
219
        sts=$?
220
        $timestamp && _timestamp
221
        stop=`_wallclock`
222

  
223
        if [ -f core ]
224
        then
225
            echo -n " [dumped core]"
226
            mv core $seq.core
227
            err=true
228
        fi
229

  
230
        if [ -f $seq.notrun ]
231
        then
232
            $timestamp || echo -n " [not run] "
233
            $timestamp && echo " [not run]" && echo -n "        $seq -- "
234
            cat $seq.notrun
235
            notrun="$notrun $seq"
236
        else
237
            if [ $sts -ne 0 ]
238
            then
239
                echo -n " [failed, exit status $sts]"
240
                err=true
241
            fi
242
            if [ ! -f $seq.out ]
243
            then
244
                echo " - no qualified output"
245
                err=true
246
            else
247
                if diff -w $seq.out $tmp.out >/dev/null 2>&1
248
                then
249
                    echo ""
250
                    if $err
251
                    then
252
                        :
253
                    else
254
                        echo "$seq `expr $stop - $start`" >>$tmp.time
255
                    fi
256
                else
257
                    echo " - output mismatch (see $seq.out.bad)"
258
                    mv $tmp.out $seq.out.bad
259
                    $diff -w $seq.out $seq.out.bad
260
                    err=true
261
                fi
262
            fi
263
        fi
264 264

  
265 265
    fi
266 266

  
......
268 268
    #
269 269
    if $err
270 270
    then
271
	bad="$bad $seq"
272
	n_bad=`expr $n_bad + 1`
273
	quick=false
271
        bad="$bad $seq"
272
        n_bad=`expr $n_bad + 1`
273
        quick=false
274 274
    fi
275 275
    [ -f $seq.notrun ] || try=`expr $try + 1`
276
    
276

  
277 277
    seq="after_$seq"
278 278
done
279 279

  

Also available in: Unified diff