Whamcloud - gitweb
LU-358 tests: Add the branch and commit-id to the yml.
[fs/lustre-release.git] / lustre / tests / yaml.sh
index f5803e2..a883085 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
+# vim:shiftwidth=4:softtabstop=4:tabstop=4:
 
 #
 # Shell routines for logging results to a yaml file.
@@ -17,10 +17,10 @@ yml_nodes_file() {
     export logdir=$1
 
     if [ -f $logdir/shared ]; then
-        do_rpc_nodes $(comma_list $(nodes_list)) \
-            "yml_node >> $logdir/node.\\\$(hostname).yml"
+        do_rpc_nodes $(comma_list $(all_nodes)) \
+            "yml_node >> $logdir/node.\\\$(hostname -s).yml"
     else
-        do_rpc_nodes $(comma_list $(nodes_list)) yml_node | split_output
+        do_rpc_nodes $(comma_list $(all_nodes)) yml_node | split_output
     fi
     yml_entities
 }
@@ -31,13 +31,15 @@ yml_results_file() {
     #TestGroup
     yml_test_group
 
+    #CodeReview
+    yml_code_review
+
     # Tests
     printf "Tests:\n"
 }
 
 # Called on the node for which we the info is needed.
 yml_node() {
-    local node=$(hostname)
     logdir=$1
 
     printf "Build:\n"
@@ -52,8 +54,8 @@ yml_node() {
 }
 
 yml_test_group() {
-    TEST_GROUP=${TEST_GROUP:-"acc-sm-$(hostname)"}
-    TEST_HOST=${TEST_HOST:-$(hostname)}
+    TEST_GROUP=${TEST_GROUP:-"acc-sm-$(hostname -s)"}
+    TEST_HOST=${TEST_HOST:-$(hostname -s)}
     TEST_USER=${TEST_USER:-$USER}
 
     # TestGroup information
@@ -63,10 +65,13 @@ TestGroup:
     testhost: $TEST_HOST
     submission: $(date)
     user_name: $TEST_USER
-
 EOF
 }
 
+yml_code_review() {
+    echo -e $CODE_REVIEW_YAML
+}
+
 release() {
    if [ -r /etc/lsb-release ]; then
       dist=$(grep 'DISTRIB_ID' /etc/lsb-release | sed 's/DISTRIB_ID=//' | head -1)
@@ -83,9 +88,10 @@ release() {
 }
 
 yml_build_info() {
-    TEST_DISTRO=$(release)
-    LUSTRE_VERSION=$(lctl lustre_build_version | awk '/Lustre version:/ {print $3}')
-    LUSTRE_BUILD=$(sed 's/-.*//' <<<$LUSTRE_VERSION)
+    local TEST_DISTRO=$(release)
+    local LUSTRE_VERSION=$(lctl lustre_build_version | awk '/Lustre version:/ {print $3}')
+    local LUSTRE_BUILD=${LUSTRE_BUILD_SOURCE:-$(sed 's/-.*//' <<<$LUSTRE_VERSION)}
+    local FILE_SYSTEM=$(node_fstypes $(hostname -s))
 
 cat <<EOF
     lbats_build_id: $LBATS_ID
@@ -95,7 +101,10 @@ cat <<EOF
     os_distribution: $TEST_DISTRO
     lustre_version: $LUSTRE_VERSION
     lustre_build: $LUSTRE_BUILD
+    lustre_branch: $LUSTRE_BRANCH
+    lustre_revision: $LUSTRE_REVISION
     kernel_version: $(uname -r)
+    file_system: ${FILE_SYSTEM:-"NA"}
 EOF
 }
 
@@ -103,7 +112,7 @@ yml_node_info()
 {
     mem=$(awk '/MemTotal:/ {print $2 " " $3}' /proc/meminfo)
 cat <<EOF
-    node_name: $(hostname)
+    node_name: $(hostname -s)
     mem_size: $mem
     architecture: $(uname -m)
     networks:
@@ -122,22 +131,43 @@ EOF
 }
 
 yml_entities() {
-    local host
-    for num in $(seq $MDSCOUNT); do
-        host=$(facet_active_host mds$num)
-        yml_entity "MDS $num" $host >> $logdir/node.$host.yml
-    done
-
-    for num in $(seq $OSTCOUNT); do
-        host=$(facet_active_host ost$num)
-        yml_entity "OST $num" $host >> $logdir/node.$host.yml
-    done
-
-    i=1
-    for host in ${CLIENTS//,/ }; do
-        yml_entity "Client $i" $host >> $logdir/node.$host.yml
-        i=$((i+1))
-    done
+       local host
+       local f_host
+       local i
+
+       if ! combined_mgs_mds; then
+               host=$(short_hostname $(facet_active_host mgs))
+               f_host=$(short_hostname $(facet_passive_host mgs))
+
+               yml_entity "MGS" $host >> $logdir/node.$host.yml
+               [[ -n $f_host ]] &&
+                       yml_entity "MGS" $f_host >> $logdir/node.$f_host.yml
+       fi
+
+       for i in $(seq $MDSCOUNT); do
+               host=$(short_hostname $(facet_active_host mds$i))
+               f_host=$(short_hostname $(facet_passive_host mds$i))
+
+               yml_entity "MDS $i" $host >> $logdir/node.$host.yml
+               [[ -n $f_host ]] &&
+                       yml_entity "MDS $i" $f_host >> $logdir/node.$f_host.yml
+       done
+
+       for i in $(seq $OSTCOUNT); do
+               host=$(short_hostname $(facet_active_host ost$i))
+               f_host=$(short_hostname $(facet_passive_host ost$i))
+
+               yml_entity "OST $i" $host >> $logdir/node.$host.yml
+               [[ -n $f_host ]] &&
+                       yml_entity "OST $i" $f_host >> $logdir/node.$f_host.yml
+       done
+
+       i=1
+       for host in ${CLIENTS//,/ }; do
+               host=$(short_hostname $host)
+               yml_entity "Client $i" $host >> $logdir/node.$host.yml
+               i=$((i+1))
+       done
 }
 
 yml_log_test() {