From 155ba82a13bcf47e77ed586540664d0261147730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=E1=B4=8F=C9=B4=C9=A2=20Jie?= Date: Thu, 26 Oct 2017 04:28:28 -0500 Subject: [PATCH] Test cases for nodeset error handling (#4114) * Test cases for nodeset --- xCAT-test/autotest/testcase/nodeset/cases1 | 54 +++++ .../autotest/testcase/nodeset/functions.sh | 195 ++++++++++++++++++ .../nodeset/nodeset_nonexistent_osimage_grub2 | 60 ++++++ .../nodeset_nonexistent_osimage_petitboot | 70 +++++++ .../nodeset/nodeset_nonexistent_osimage_xnba | 60 ++++++ .../testcase/nodeset/nodeset_osimage_grub2 | 44 ++++ .../nodeset/nodeset_osimage_petitboot | 51 +++++ .../testcase/nodeset/nodeset_osimage_xnba | 51 +++++ .../testcase/nodeset/nodeset_shell_grub2 | 39 ++++ .../testcase/nodeset/nodeset_shell_petitboot | 46 +++++ .../testcase/nodeset/nodeset_shell_xnba | 46 +++++ 11 files changed, 716 insertions(+) create mode 100644 xCAT-test/autotest/testcase/nodeset/cases1 create mode 100644 xCAT-test/autotest/testcase/nodeset/functions.sh create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_grub2 create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_petitboot create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_xnba create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_osimage_grub2 create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_osimage_petitboot create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_osimage_xnba create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_shell_grub2 create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_shell_petitboot create mode 100755 xCAT-test/autotest/testcase/nodeset/nodeset_shell_xnba diff --git a/xCAT-test/autotest/testcase/nodeset/cases1 b/xCAT-test/autotest/testcase/nodeset/cases1 new file mode 100644 index 000000000..bcf8f6343 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/cases1 @@ -0,0 +1,54 @@ +start:nodeset_shell_grub2 +description: Verify if `nodeset shell` perform well when part of nodes in a node range have problem. Use grub2 OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_shell_grub2 +check:rc==0 +end + +start:nodeset_shell_petitboot +description: Verify if `nodeset shell` perform well when part of nodes in a node range have problem. Use petitboot OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_shell_petitboot +check:rc==0 +end + +start:nodeset_shell_xnba +description: Verify if `nodeset shell` perform well when part of nodes in a node range have problem. Use xnba OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_shell_xnba +check:rc==0 +end + +start:nodeset_osimage_grub2 +description: Verify if `nodeset osimage` perform well when part of nodes in a node range have problem. Use grub2 OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_osimage_grub2 +check:rc==0 +end + +start:nodeset_osimage_petitboot +description: Verify if `nodeset osimage` perform well when part of nodes in a node range have problem. Use petitboot OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_osimage_petitboot +check:rc==0 +end + +start:nodeset_osimage_xnba +description: Verify if `nodeset osimage` perform well when part of nodes in a node range have problem. Use xnba OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_osimage_xnba +check:rc==0 +end + +start:nodeset_nonexistent_osimage_grub2 +description: Verify if `nodeset osimage` perform well when part of nodes in a node range have nonexistent osimage defined in its profile. Use grub2 OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_nonexistent_osimage_grub2 +check:rc==0 +end + +start:nodeset_nonexistent_osimage_petitboot +description: Verify if `nodeset osimage` perform well when part of nodes in a node range have nonexistent osimage defined in its profile. Use petitboot OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_nonexistent_osimage_petitboot +check:rc==0 +end + +start:nodeset_nonexistent_osimage_xnba +description: Verify if `nodeset osimage` perform well when part of nodes in a node range have nonexistent osimage defined in its profile. Use xnba OS loader +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/nodeset/nodeset_nonexistent_osimage_xnba +check:rc==0 +end + diff --git a/xCAT-test/autotest/testcase/nodeset/functions.sh b/xCAT-test/autotest/testcase/nodeset/functions.sh new file mode 100644 index 000000000..5476a9411 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/functions.sh @@ -0,0 +1,195 @@ +#!/bin/bash + +# +# warn_if_bad Put out warning message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Incoming $1 is returned unless it is 0 +# +function warn_if_bad() +{ + local -i rc="$1" + local script="${0##*/}" + + # Ignore if no problems + [ "${rc}" -eq "0" ] && return 0 + + # Broken + shift + echo "${script}: $@" >&2 + return "${rc}" +} + +# +# exit_if_bad Put out error message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Exits with 1 unless $1 is 0 +# +function exit_if_bad() +{ + warn_if_bad "$@" || exit 1 + return 0 +} + +# +# internal_setup Script setup +# +# Returns 0 on success. +# Exits (not returns) with 1 on failure. +# +function internal_setup() +{ + shopt -s extglob + + # Trap exit for internal_cleanup function. + trap "internal_cleanup" EXIT + + umask 0077 + + TMP_DIR="$(mktemp -d "/tmp/${0##*/}.XXXXXXXX" 2>/dev/null)" + [ -d "${TMP_DIR}" ] + exit_if_bad "$?" "Make temporary directory failed." + + custom_setup +} + +# +# internal_cleanup Script cleanup (reached via trap 0) +# +# Destory any temporarily facility created by internal_setup. +# +function internal_cleanup() +{ + custom_cleanup + + [ -d "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" +} + +# +# custom_setup +# +function custom_setup() +{ + : +} + +# +# custom_cleanup +# +function custom_cleanup() +{ + : +} + +internal_setup + +function make_bogus_grub2_nodes() +{ + local i + # grub2 + for i in {001..005} + do + mkdef -t node -o tz${i} \ + arch=ppc64 cons=hmc groups=lpar mgt=hmc \ + netboot=grub2 \ + ip=10.99.1.$((10#${i})) \ + mac=e6:d4:d2:3a:ad:0$((10#${i})) \ + profile=compute os=rhels7.99 + done +} + +function make_bogus_petitboot_nodes() +{ + local i + # petitboot + for i in {001..005} + do + mkdef -t node -o tz${i} \ + arch=ppc64le cons=bmc groups=ipmi mgt=ipmi \ + netboot=petitboot \ + ip=10.99.1.$((10#${i})) \ + mac=e6:d4:d2:3a:ad:0$((10#${i})) \ + profile=compute os=rhels7.99 + done +} + +function make_bogus_xnba_nodes() +{ + local i + # xnba + for i in {001..005} + do + mkdef -t node -o tz${i} \ + arch=x86_64 cons=kvm groups=kvm mgt=kvm \ + netboot=xnba \ + ip=10.99.1.$((10#${i})) \ + mac=e6:d4:d2:3a:ad:0$((10#${i})) \ + profile=compute os=rhels7.99 + done +} + +function destory_bogus_nodes() +{ + rmdef -t node tz001+4 +} + +umask 0022 + +function make_bogus_ppc64le_osimage() +{ + mkdef "rhels7.99-ppc64le-install-compute" \ + -u profile=compute provmethod=install \ + osvers=rhels7.99 osarch=ppc64le + mkdir -p /install/rhels7.99/ppc64le/ppc/ppc64le + echo blah >/install/rhels7.99/ppc64le/ppc/ppc64le/vmlinuz + echo blah >/install/rhels7.99/ppc64le/ppc/ppc64le/initrd.img +} + +function make_bogus_ppc64_osimage() +{ + mkdef "rhels7.99-ppc64-install-compute" \ + -u profile=compute provmethod=install \ + osvers=rhels7.99 osarch=ppc64 + mkdir -p /install/rhels7.99/ppc64/ppc/ppc64 + echo blah >/install/rhels7.99/ppc64/ppc/ppc64/vmlinuz + echo blah >/install/rhels7.99/ppc64/ppc/ppc64/initrd.img +} + +#function make_bogus_ppc64_osimage() +#{ +# mkdef "rhels6.99-ppc64-install-compute" \ +# -u profile=compute provmethod=install \ +# osvers=rhels6.99 osarch=ppc64 +# mkdir -p /install/rhels6.99/ppc64/ppc/{chrp,ppc64} +# echo blah >/install/rhels6.99/ppc64/ppc/ppc64/vmlinuz +# echo blah >/install/rhels6.99/ppc64/ppc/ppc64/initrd.img +# echo blah >/install/rhels6.99/ppc64/ppc/chrp/yaboot +#} + +function make_bogus_x64_osimage() +{ + mkdef "rhels6.99-x86_64-install-compute" \ + -u profile=compute provmethod=install \ + osvers=rhels6.99 osarch=x86_64 + mkdir -p /install/rhels6.99/x86_64/images/pxeboot + echo blah >/install/rhels6.99/x86_64/images/pxeboot/vmlinuz + echo blah >/install/rhels6.99/x86_64/images/pxeboot/initrd.img +} + +function destory_bogus_osimages() +{ + local o + for o in \ + rhels7.99-ppc64le-install-compute \ + rhels7.99-ppc64-install-compute \ + rhels6.99-ppc64-install-compute \ + rhels6.99-x86_64-install-compute + do + rmdef -t osimage ${o} + done +} diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_grub2 b/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_grub2 new file mode 100755 index 000000000..dc77e6b6b --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_grub2 @@ -0,0 +1,60 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_ppc64_osimage +make_bogus_grub2_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 osimage=rhels7.99-ppc64-install-compute +exit_if_bad "$?" "nodeset command exit with non-zero" + +# Make sure all other nodes are good +for node in tz{001..005} +do + [ -f "/tftpboot/boot/grub2/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/boot/grub2/${node}" +done + +nodeset tz003 osimage=nonexistent-osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'annot find the OS image' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +nodeset tz001+4 offline + +chdef tz003 provmethod=nonexistent-osimage +exit_if_bad "$?" "chdef command exit with non-zero" + +nodeset tz001+4 osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz003: .*annot find the OS image' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz002 tz004 tz005 +do + [ -f "/tftpboot/boot/grub2/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/boot/grub2/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_petitboot b/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_petitboot new file mode 100755 index 000000000..7014245e7 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_petitboot @@ -0,0 +1,70 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_ppc64le_osimage +make_bogus_petitboot_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 osimage=rhels7.99-ppc64le-install-compute +exit_if_bad "$?" "nodeset command exit with non-zero" + +# Make sure all nodes are good +for node in tz{001..005} +do + [ -f "/tftpboot/petitboot/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/petitboot/${node}" +done + +nodeset tz003 osimage=nonexistent-osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'annot find the OS image' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +nodeset tz001+4 offline + +chdef tz003 provmethod=nonexistent-osimage +exit_if_bad "$?" "chdef command exit with non-zero" + +nodeset tz001+4 osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz003: .*annot find the OS image' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +nodeset tz001+4 offline + +chdef tz003 provmethod=nonexistent-osimage +exit_if_bad "$?" "chdef command exit with non-zero" + +nodeset tz001+4 osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +# Make sure all other nodes are good +for node in tz001 tz002 tz004 tz005 +do + [ -f "/tftpboot/petitboot/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/petitboot/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_xnba b/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_xnba new file mode 100755 index 000000000..a6597211a --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_nonexistent_osimage_xnba @@ -0,0 +1,60 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_x64_osimage +make_bogus_xnba_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 osimage=rhels6.99-x86_64-install-compute +exit_if_bad "$?" "nodeset command exit with non-zero" + +# Make sure all nodes are good +for node in tz{001..005} +do + [ -f "/tftpboot/xcat/xnba/nodes/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/xcat/xnba/nodes/${node}" +done + +nodeset tz003 osimage=nonexistent-osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'annot find the OS image' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +nodeset tz001+4 offline + +chdef tz003 provmethod=nonexistent-osimage +exit_if_bad "$?" "chdef command exit with non-zero" + +nodeset tz001+4 osimage \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz003: .*annot find the OS image' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz002 tz004 tz005 +do + [ -f "/tftpboot/xcat/xnba/nodes/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/xcat/xnba/nodes/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_grub2 b/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_grub2 new file mode 100755 index 000000000..ca97080ba --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_grub2 @@ -0,0 +1,44 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_ppc64_osimage +make_bogus_grub2_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +chdef tz002 mac= +chdef tz003 arch= + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 osimage=rhels7.99-ppc64-install-compute \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +# Check $? != 0 +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz002: .*o MAC address' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +#grep 'tz003: .*o archictecture defined' "${NODESET_STDERR}" +#exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz004 tz005 +do + [ -f "/tftpboot/boot/grub2/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/boot/grub2/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_petitboot b/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_petitboot new file mode 100755 index 000000000..969e66548 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_petitboot @@ -0,0 +1,51 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_ppc64le_osimage +make_bogus_petitboot_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +chdef tz001+4 serialport=0 serialspeed=115200 +exit_if_bad "$?" "chdef command failed" + +chdef tz002 mac= +chdef tz003 arch= +chdef tz004 serialspeed= + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 osimage=rhels7.99-ppc64le-install-compute \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +# Check $? != 0 +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz002: .*o MAC address' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +#grep 'tz003: .*o archictecture defined' "${NODESET_STDERR}" +#exit_if_bad "$?" "nodeset command error message checking failed" + +grep 'tz004: .*o serialspeed' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz005 +do + [ -f "/tftpboot/petitboot/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/petitboot/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_xnba b/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_xnba new file mode 100755 index 000000000..01215a919 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_osimage_xnba @@ -0,0 +1,51 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_x64_osimage +make_bogus_xnba_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +chdef tz001+4 serialport=0 serialspeed=115200 +exit_if_bad "$?" "chdef command failed" + +chdef tz002 mac= +chdef tz003 arch= +chdef tz004 serialspeed= + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 osimage=rhels6.99-x86_64-install-compute \ + > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +# Check $? != 0 +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz002: .*o MAC address' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +#grep 'tz003: .*o archictecture defined' "${NODESET_STDERR}" +#exit_if_bad "$?" "nodeset command error message checking failed" + +grep 'tz004: .*o serialspeed' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz005 +do + [ -f "/tftpboot/xcat/xnba/nodes/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/xcat/xnba/nodes/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_shell_grub2 b/xCAT-test/autotest/testcase/nodeset/nodeset_shell_grub2 new file mode 100755 index 000000000..29349ddd9 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_shell_grub2 @@ -0,0 +1,39 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_ppc64_osimage +make_bogus_grub2_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +chdef tz003 arch= + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 shell > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +# Check $? != 0 +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz003: .*o archictecture defined' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz002 tz004 tz005 +do + [ -f "/tftpboot/boot/grub2/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/boot/grub2/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_shell_petitboot b/xCAT-test/autotest/testcase/nodeset/nodeset_shell_petitboot new file mode 100755 index 000000000..99f947ba0 --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_shell_petitboot @@ -0,0 +1,46 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_ppc64le_osimage +make_bogus_petitboot_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +chdef tz001+4 serialport=0 serialspeed=115200 +exit_if_bad "$?" "chdef command failed" + +chdef tz003 arch= +chdef tz004 serialspeed= + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 shell > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +# Check $? != 0 +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz003: .*o archictecture defined' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +grep 'tz004: .*o serialspeed' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz002 tz005 +do + [ -f "/tftpboot/petitboot/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/petitboot/${node}" +done + +nodeset tz001+4 offline + +exit 0 diff --git a/xCAT-test/autotest/testcase/nodeset/nodeset_shell_xnba b/xCAT-test/autotest/testcase/nodeset/nodeset_shell_xnba new file mode 100755 index 000000000..70253ac6e --- /dev/null +++ b/xCAT-test/autotest/testcase/nodeset/nodeset_shell_xnba @@ -0,0 +1,46 @@ +#!/bin/bash + +BASE_DIR="${0%/*}" + +! source "${BASE_DIR}/functions.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/functions.sh\" not found" >&2 && exit 1 + +make_bogus_x64_osimage +make_bogus_xnba_nodes + +function custom_cleanup() +{ + destory_bogus_nodes + destory_bogus_osimages +} + +chdef tz001+4 serialport=0 serialspeed=115200 +exit_if_bad "$?" "chdef command failed" + +chdef tz003 arch= +chdef tz004 serialspeed= + +NODESET_STDOUT="${TMP_DIR}/nodeset.out" +NODESET_STDERR="${TMP_DIR}/nodeset.err" + +nodeset tz001+4 shell > >(tee "${NODESET_STDOUT}") 2> >(tee "${NODESET_STDERR}") +# Check $? != 0 +[ "$?" -ne "0" ] +exit_if_bad "$?" "nodeset command should exit with non-zero" + +grep 'tz003: .*o archictecture defined' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +grep 'tz004: .*o serialspeed' "${NODESET_STDERR}" +exit_if_bad "$?" "nodeset command error message checking failed" + +# Make sure all other nodes are good +for node in tz001 tz002 tz005 +do + [ -f "/tftpboot/xcat/xnba/nodes/${node}" ] + exit_if_bad "$?" "file not found /tftpboot/xcat/xnba/nodes/${node}" +done + +nodeset tz001+4 offline + +exit 0