1
0
mirror of https://github.com/ceph/ceph synced 2024-12-26 05:25:09 +00:00
ceph/qa/workunits/rados/test.sh
Kefu Chai 787f6ac699 qa/workunits/rados/test.sh: print test name when it fails
we have

2017-02-04T16:15:46.090 INFO:tasks.workunit.client.0.mira032.stdout:error in 22088
2017-02-04T16:15:46.092 INFO:tasks.workunit.client.0.mira032.stderr:bash: line 1: 22092 Alarm clock             ceph_test_rados_api_aio 2>&1
2017-02-04T16:15:46.096 INFO:tasks.workunit.client.0.mira032.stderr:     22093 Done                    | tee ceph_test_rados_api_aio.log
2017-02-04T16:15:46.099 INFO:tasks.workunit.client.0.mira032.stderr:     22094 Done                    | sed "s/^/                  api_aio: /"
2017-02-04T16:15:46.102 INFO:tasks.workunit.client.0.mira032.stderr:+

if a unittest in rados/test.sh fails in teuthology.log, but it would
be desirable to have the failed test name in the line of "error in
22088".

Signed-off-by: Kefu Chai <kchai@redhat.com>
2017-02-10 23:54:29 +08:00

51 lines
917 B
Bash
Executable File

#!/bin/bash -ex
parallel=1
[ "$1" = "--serial" ] && parallel=0
color=""
[ -t 1 ] && color="--gtest_color=yes"
function cleanup() {
pkill -P $$ || true
}
trap cleanup EXIT ERR HUP INT QUIT
declare -A pids
for f in \
api_aio api_io api_list api_lock api_misc \
api_tier api_pool api_snapshots api_stat api_watch_notify api_cmd \
api_c_write_operations \
api_c_read_operations \
list_parallel \
open_pools_parallel \
delete_pools_parallel \
watch_notify
do
if [ $parallel -eq 1 ]; then
r=`printf '%25s' $f`
bash -o pipefail -exc "ceph_test_rados_$f $color 2>&1 | tee ceph_test_rados_$f.log | sed \"s/^/$r: /\"" &
pid=$!
echo "test $f on pid $pid"
pids[$f]=$pid
else
ceph_test_rados_$f
fi
done
ret=0
if [ $parallel -eq 1 ]; then
for t in "${!pids[@]}"
do
pid=${pids[$t]}
if ! wait $pid
then
echo "error in $t ($pid)"
ret=1
fi
done
fi
exit $ret