Whamcloud - gitweb
LU-14264 tests: make PARALLEL available to all suites
[fs/lustre-release.git] / lustre / tests / yaml.sh
index 7269cb8..bd08571 100644 (file)
@@ -57,6 +57,7 @@ yml_test_group() {
     TEST_GROUP=${TEST_GROUP:-"acc-sm-$(hostname -s)"}
     TEST_HOST=${TEST_HOST:-$(hostname -s)}
     TEST_USER=${TEST_USER:-$USER}
+    TEST_PROJECT=${TEST_PROJECT:-"LUSTRE"}
 
     # TestGroup information
     cat <<EOF
@@ -65,6 +66,7 @@ TestGroup:
     testhost: $TEST_HOST
     submission: $(date)
     user_name: $TEST_USER
+project: $TEST_PROJECT
 EOF
 }
 
@@ -73,14 +75,19 @@ yml_code_review() {
 }
 
 release() {
-       if [ -r /etc/lsb-release ]; then
-               dist=$(sed -ne '/^DISTRIB_ID/s/DISTRIB_ID=//p' /etc/lsb-release)
+       rhel_pat=".*release \([[:digit:]]\+\.[[:digit:]]\+\).*"
+
+       if [ -r /etc/centos-release ]; then
+               version=$(sed -n -e "s/${rhel_pat}/\1/p" /etc/centos-release)
+               dist="CentOS ${version}"
        elif [ -r /etc/redhat-release ]; then
-               dist=$(awk '/release/ { printf("%s %s %s", $1, $2, $3) }' \
-                       /etc/redhat-release)
-       elif [ -r /etc/*-release ]; then
-               dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null |
-                       sed -e 's/\/etc\///' -e 's/-release//' | head -n1)
+               version=$(sed -n -e "s/${rhel_pat}/\1/p" /etc/redhat-release)
+               dist="RHEL ${version}"
+       elif [ -r /etc/os-release ]; then
+               name=$(sed -n -e 's/"//g' -e 's/^NAME=//p' /etc/os-release)
+               version=$(sed -n -e 's/"//g' -e 's/^VERSION_ID=//p' \
+               /etc/os-release)
+               dist="${name} ${version}"
        else
                dist="UNKNOWN"
        fi
@@ -89,10 +96,10 @@ release() {
 }
 
 yml_build_info() {
-    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))
+       local TEST_DISTRO=$(release)
+       local LUSTRE_VERSION=$(lustre_build_version)
+       local LUSTRE_BUILD=${LUSTRE_BUILD_SOURCE:-$LUSTRE_VERSION}
+       local FILE_SYSTEM=$(node_fstypes $(hostname -s))
 
 cat <<EOF
     lbats_build_id: $LBATS_ID
@@ -100,10 +107,10 @@ cat <<EOF
     architecture: $(uname -m)
     os: $(uname -o)
     os_distribution: $TEST_DISTRO
-    lustre_version: $LUSTRE_VERSION
-    lustre_build: $LUSTRE_BUILD
-    lustre_branch: $LUSTRE_BRANCH
-    lustre_revision: $LUSTRE_REVISION
+    version: $LUSTRE_VERSION
+    build: $LUSTRE_BUILD
+    branch: $LUSTRE_BRANCH
+    revision: $LUSTRE_REVISION
     kernel_version: $(uname -r)
     file_system: ${FILE_SYSTEM:-"NA"}
 EOF