]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rados/test.sh: print test name when it fails 13264/head
authorKefu Chai <kchai@redhat.com>
Sun, 5 Feb 2017 15:11:13 +0000 (23:11 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 10 Feb 2017 15:54:29 +0000 (23:54 +0800)
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>
qa/workunits/rados/test.sh

index 3b2d8cf96f07ec0808b7d7418ae97a966b647c3a..33bdd8ed0b16f38f780e63eba7c05e2fee06adea 100755 (executable)
@@ -11,7 +11,8 @@ function cleanup() {
 }
 trap cleanup EXIT ERR HUP INT QUIT
 
-pids=""
+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 \
@@ -27,7 +28,7 @@ do
        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="$pids $pid"
+       pids[$f]=$pid
     else
        ceph_test_rados_$f
     fi
@@ -35,11 +36,12 @@ done
 
 ret=0
 if [ $parallel -eq 1 ]; then
-for p in $pids
+for t in "${!pids[@]}"
 do
-  if ! wait $p
+  pid=${pids[$t]}
+  if ! wait $pid
   then
-    echo "error in $p"
+    echo "error in $t ($pid)"
     ret=1
   fi
 done