Whamcloud - gitweb
LU-121 test: Change framework to only use the short hostname. 1.8.8-wc1 v1_8_8_WC1 v1_8_8_WC1_RC3
authorchris <chris@whamcloud.com>
Mon, 7 May 2012 12:34:49 +0000 (08:34 -0400)
committerJohann Lombardi <johann@whamcloud.com>
Wed, 23 May 2012 11:57:52 +0000 (07:57 -0400)
This means stripping of everything off the name after and including
the first.

This change is only designed to make the .yml files consistent. The
log files will append the fully qualified name and appear to do this
consistantly.

We can create a jira to make the log and yml files consistant, but
the reality is that the yml files have a short life and are only
used to send to Maloo.

This change will allow automated posting of results and automated
testing to begin.

1. Carries out the above using hostname -s
2. Adds in a quick change so that LUSTRE_BUILD in yaml.sh can be a
reference to the source rather than just the lustre version string
which is recorded and written to the yaml anyway as LUSTER_VERSION

Additionally a couple of other changes sneaked in.

1. Allows the review information to be applied to the yaml output
file by way of exporting the variable CODE_REVIEW_YAML to be a yaml
description for maloo

2. The addition of a couple of fixes to make the permissions for yaml
files be allow-all. This permissions are bracketed and so do not
change any other parts of the code.

Signed-off-by: Chris Gearing <chris@whamcloud.com>
Change-Id: I4b2431030afd206bc83490f5c81fd04e57937aad
Reviewed-on: http://review.whamcloud.com/2663
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/tests/auster
lustre/tests/functions.sh
lustre/tests/run_IOR.sh
lustre/tests/run_dbench.sh
lustre/tests/run_dd.sh
lustre/tests/run_iozone.sh
lustre/tests/run_tar.sh
lustre/tests/test-framework.sh
lustre/tests/yaml.sh

index a69362b..3c51842 100755 (executable)
@@ -213,7 +213,7 @@ run_suite_logged() {
     fi
 
     echo "run_suite $suite_name $suite_script"
-    local log_name=${suite_name}.suite_log.$(hostname).log
+    local log_name=${suite_name}.suite_log.$(hostname -s).log
     if $verbose; then
        run_suite $suite_name $suite_script 2>&1 |tee  $LOGDIR/$log_name
     else
index 75a63e9..b5a96b7 100644 (file)
@@ -100,6 +100,15 @@ lst_setup_all () {
     do_rpc_nodes $list lst_setup
 }
 
+###
+# short_hostname
+#
+# Passed a single argument, strips everything off following and includes the first period.
+# client-20.lab.whamcloud.com becomes client-20
+short_hostname() {
+  echo $(sed 's/\..*//' <<< $1)
+}
+
 print_opts () {
     local var
 
index 92942b1..9f8f816 100755 (executable)
@@ -6,7 +6,7 @@ TESTLOG_PREFIX=${TESTLOG_PREFIX:-$TMP/recovery-mds-scale}
 TESTNAME=${TESTNAME:-""}
 [ -n "$TESTNAME" ] && TESTLOG_PREFIX=$TESTLOG_PREFIX.$TESTNAME
 
-LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname).log
+LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname -s).log
 DEBUGLOG=$(echo $LOG | sed 's/\(.*\)stdout/\1debug/')
 
 mkdir -p ${LOG%/*}
index 6a76eee..b6c2ac1 100755 (executable)
@@ -6,7 +6,7 @@ TESTLOG_PREFIX=${TESTLOG_PREFIX:-$TMP/recovery-mds-scale}
 TESTNAME=${TESTNAME:-""}
 [ -n "$TESTNAME" ] && TESTLOG_PREFIX=$TESTLOG_PREFIX.$TESTNAME
 
-LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname).log
+LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname -s).log
 DEBUGLOG=$(echo $LOG | sed 's/\(.*\)stdout/\1debug/')
 
 mkdir -p ${LOG%/*}
index 46635bf..36af6ae 100755 (executable)
@@ -6,7 +6,7 @@ TESTLOG_PREFIX=${TESTLOG_PREFIX:-$TMP/recovery-mds-scale}
 TESTNAME=${TESTNAME:-""}
 [ -n "$TESTNAME" ] && TESTLOG_PREFIX=$TESTLOG_PREFIX.$TESTNAME
 
-LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname).log
+LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname -s).log
 DEBUGLOG=$(echo $LOG | sed 's/\(.*\)stdout/\1debug/')
 
 mkdir -p ${LOG%/*}
index 9ca7594..642303c 100755 (executable)
@@ -6,7 +6,7 @@ TESTLOG_PREFIX=${TESTLOG_PREFIX:-$TMP/recovery-mds-scale}
 TESTNAME=${TESTNAME:-""}
 [ -n "$TESTNAME" ] && TESTLOG_PREFIX=$TESTLOG_PREFIX.$TESTNAME
 
-LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname).log
+LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname -s).log
 DEBUGLOG=$(echo $LOG | sed 's/\(.*\)stdout/\1debug/')
 
 mkdir -p ${LOG%/*}
index c37e557..f46b874 100755 (executable)
@@ -6,7 +6,7 @@ TESTLOG_PREFIX=${TESTLOG_PREFIX:-$TMP/recovery-mds-scale}
 TESTNAME=${TESTNAME:-""}
 [ -n "$TESTNAME" ] && TESTLOG_PREFIX=$TESTLOG_PREFIX.$TESTNAME
 
-LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname).log
+LOG=$TESTLOG_PREFIX.$(basename $0 .sh)_stdout.$(hostname -s).log
 DEBUGLOG=$(echo $LOG | sed 's/\(.*\)stdout/\1debug/')
 
 mkdir -p ${LOG%/*}
index 74629fd..f244a98 100644 (file)
@@ -138,7 +138,7 @@ init_test_env() {
     export LOGDIR=${LOGDIR:-${TMP}/test_logs/$(date +%s)}
     export TESTLOG_PREFIX=$LOGDIR/$TESTSUITE
 
-    export HOSTNAME=${HOSTNAME:-`hostname`}
+    export HOSTNAME=${HOSTNAME:-`hostname -s`}
     if ! echo $PATH | grep -q $LUSTRE/utils; then
         export PATH=$PATH:$LUSTRE/utils
     fi
@@ -1076,7 +1076,7 @@ start_vmstat() {
     [ -z "$nodes" -o -z "$pid_file" ] && return 0
 
     do_nodes $nodes \
-        "vmstat 1 > $TESTLOG_PREFIX.$TESTNAME.vmstat.\\\$(hostname).log \
+        "vmstat 1 > $TESTLOG_PREFIX.$TESTNAME.vmstat.\\\$(hostname -s).log \
         2>/dev/null </dev/null & echo \\\$! > $pid_file"
 }
 
@@ -2925,9 +2925,11 @@ run_one() {
 run_one_logged() {
     local BEFORE=`date +%s`
     local TEST_ERROR
-    local name=${TESTSUITE}.test_${1}.test_log.$(hostname).log
+    local name=${TESTSUITE}.test_${1}.test_log.$(hostname -s).log
     local test_log=$LOGDIR/$name
     rm -rf $LOGDIR/err
+    local SAVE_UMASK=`umask`
+    umask 0022
 
     log_sub_test_begin test_${1}
     (run_one $1 "$2") 2>&1 | tee $test_log
@@ -2945,6 +2947,8 @@ run_one_logged() {
         $FAIL_ON_ERROR && exit $RC
     fi
 
+    umask $SAVE_UMASK
+
     return 0
 }
 
@@ -3805,14 +3809,14 @@ gather_logs () {
 
     if [ "$CLIENTONLY" -o "$PDSH" == "no_dsh" ]; then
         echo "Dumping logs only on local client."
-        $LCTL dk > ${prefix}.debug_log.$(hostname).${suffix}
-        dmesg > ${prefix}.dmesg.$(hostname).${suffix}
+        $LCTL dk > ${prefix}.debug_log.$(hostname -s).${suffix}
+        dmesg > ${prefix}.dmesg.$(hostname -s).${suffix}
         return
     fi
 
     do_nodes --verbose $list \
-        "$LCTL dk > ${prefix}.debug_log.\\\$(hostname).${suffix};
-         dmesg > ${prefix}.dmesg.\\\$(hostname).${suffix}"
+        "$LCTL dk > ${prefix}.debug_log.\\\$(hostname -s).${suffix};
+         dmesg > ${prefix}.dmesg.\\\$(hostname -s).${suffix}"
     if $docp; then
         do_nodes $list rsync -az "${prefix}.*.${suffix}" $HOSTNAME:$LOGDIR
     fi
@@ -3957,7 +3961,7 @@ check_logdir() {
         # Not found. Create local logdir
         mkdir -p $dir
     else
-        touch $dir/check_file.$(hostname)
+        touch $dir/check_file.$(hostname -s)
     fi
     return 0
 }
@@ -3968,7 +3972,7 @@ check_write_access() {
     local file
 
     for node in $(nodes_list); do
-        file=$dir/check_file.$node
+        file=$dir/check_file.$(short_hostname $node)
         if [[ ! -f $file ]]; then
             # Logdir not accessible/writable from this node.
             return 1
@@ -3982,6 +3986,9 @@ init_logging() {
     if [[ -n $YAML_LOG ]]; then
         return
     fi
+    local SAVE_UMASK=`umask`
+    umask 0000
+
     export YAML_LOG=${LOGDIR}/results.yml
     mkdir -p $LOGDIR
     init_clients_lists
@@ -3998,6 +4005,8 @@ init_logging() {
 
     yml_nodes_file $LOGDIR >> $YAML_LOG
     yml_results_file >> $YAML_LOG
+
+    umask $SAVE_UMASK
 }
 
 log_test() {
index 781bc76..ce3141f 100644 (file)
@@ -18,7 +18,7 @@ yml_nodes_file() {
 
     if [ -f $logdir/shared ]; then
         do_rpc_nodes $(comma_list $(nodes_list)) \
-            "yml_node >> $logdir/node.\\\$(hostname).yml"
+            "yml_node >> $logdir/node.\\\$(hostname -s).yml"
     else
         do_rpc_nodes $(comma_list $(nodes_list)) yml_node | split_output
     fi
@@ -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)
@@ -85,7 +90,7 @@ release() {
 yml_build_info() {
     TEST_DISTRO=$(release)
     LUSTRE_VERSION=$(lctl lustre_build_version | awk '/Lustre version:/ {print $3}')
-    LUSTRE_BUILD=$(sed 's/-.*//' <<<$LUSTRE_VERSION)
+    LUSTRE_BUILD=${LUSTRE_BUILD_SOURCE:-$(sed 's/-.*//' <<<$LUSTRE_VERSION)}
 
 cat <<EOF
     lbats_build_id: $LBATS_ID
@@ -105,7 +110,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:
@@ -126,16 +131,17 @@ EOF
 yml_entities() {
     local host
 
-    host=$(facet_active_host mds)
+    host=$(short_hostname $(facet_active_host mds))
     yml_entity "MDS 1" $host >> $logdir/node.$host.yml
 
     for num in $(seq $OSTCOUNT); do
-        host=$(facet_active_host ost$num)
+        host=$(short_hostname $(facet_active_host ost$num))
         yml_entity "OST $num" $host >> $logdir/node.$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