From: Chris Date: Thu, 10 Mar 2011 11:05:37 +0000 (+0000) Subject: LU-121 Fixup yaml.sh and test-framework.sh so that it only ever uses the first X-Git-Tag: 2.0.66.0~8 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c2751b31e55518d1791cd5b87adc842f4fbbee83;ds=sidebyside LU-121 Fixup yaml.sh and test-framework.sh so that it only ever uses the first part of the host name for log files. 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 consitantly. 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 [Thanks Andreas] 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. Change-Id: Ied9a2117cd1b68e048bbc2bf1bffe782485c6150 Signed-off-by: Chris Gearing Reviewed-on: http://review.whamcloud.com/312 Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: Yu Jian --- diff --git a/lustre/tests/auster b/lustre/tests/auster index a59c6f4..bde5313 100755 --- a/lustre/tests/auster +++ b/lustre/tests/auster @@ -222,7 +222,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 diff --git a/lustre/tests/functions.sh b/lustre/tests/functions.sh index 56529b6..19b3cc6 100644 --- a/lustre/tests/functions.sh +++ b/lustre/tests/functions.sh @@ -241,3 +241,12 @@ 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) +} + diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 40912c3..a28f1f6 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -3205,9 +3205,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 echo log_sub_test_begin test_${1} @@ -3226,6 +3228,8 @@ run_one_logged() { $FAIL_ON_ERROR && exit $RC fi + umask $SAVE_UMASK + return 0 } @@ -4067,14 +4071,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_nodesv $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 [ ! -f $LOGDIR/shared ]; then do_nodes $list rsync -az "${prefix}.*.${suffix}" $HOSTNAME:$LOGDIR fi @@ -4433,7 +4437,7 @@ check_logdir() { # Not found. Create local logdir mkdir -p $dir else - touch $dir/node.$(hostname).yml + touch $dir/node.$(hostname -s).yml fi return 0 } @@ -4441,7 +4445,7 @@ check_logdir() { check_write_access() { local dir=$1 for node in $(nodes_list); do - if [ ! -f "$dir/node.${node}.yml" ]; then + if [ ! -f "$dir/node.$(short_hostname ${node}).yml" ]; then # Logdir not accessible/writable from this node. return 1 fi @@ -4453,6 +4457,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 @@ -4467,6 +4474,8 @@ init_logging() { yml_nodes_file $LOGDIR >> $YAML_LOG yml_results_file >> $YAML_LOG + + umask $SAVE_UMASK } log_test() { @@ -4593,4 +4602,3 @@ is_sanity_benchmark() { min_ost_size () { $LCTL get_param -n osc.*.kbytesavail | sort -n | head -n1 } - diff --git a/lustre/tests/yaml.sh b/lustre/tests/yaml.sh index f5803e2..13f69bf 100644 --- a/lustre/tests/yaml.sh +++ b/lustre/tests/yaml.sh @@ -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 <> $logdir/node.$host.yml done 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