From b092f93f757720f7e70d2f90088e16c1f5ca7040 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Tue, 5 Nov 2013 14:53:06 -0800 Subject: [PATCH] Add test for scontrol show hostnames --- testsuite/expect/Makefile.am | 1 + testsuite/expect/Makefile.in | 1 + testsuite/expect/README | 1 + testsuite/expect/test2.20 | 111 +++++++++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100755 testsuite/expect/test2.20 diff --git a/testsuite/expect/Makefile.am b/testsuite/expect/Makefile.am index 550c81fe8d1..21b7d9f9094 100644 --- a/testsuite/expect/Makefile.am +++ b/testsuite/expect/Makefile.am @@ -139,6 +139,7 @@ EXTRA_DIST = \ test2.17 \ test2.18 \ test2.19 \ + test2.20 \ test3.1 \ test3.2 \ test3.3 \ diff --git a/testsuite/expect/Makefile.in b/testsuite/expect/Makefile.in index a4540320244..42ebd702907 100644 --- a/testsuite/expect/Makefile.in +++ b/testsuite/expect/Makefile.in @@ -519,6 +519,7 @@ EXTRA_DIST = \ test2.17 \ test2.18 \ test2.19 \ + test2.20 \ test3.1 \ test3.2 \ test3.3 \ diff --git a/testsuite/expect/README b/testsuite/expect/README index a46fea93577..9503bb29b2c 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -235,6 +235,7 @@ test2.16 Validate scontrol displays and updates Allow/Deny accounts. test2.17 Validate scontrol displays and updates Allow/Deny Qos. test2.18 Validate that Allow/Deny accounts are enforced. test2.19 Validate that Allow/Deny Qos are enforced. +test2.20 Validate scontrol show hostnames. test3.# Testing of scontrol options (best run as SlurmUser or root). diff --git a/testsuite/expect/test2.20 b/testsuite/expect/test2.20 new file mode 100755 index 00000000000..e2d62347088 --- /dev/null +++ b/testsuite/expect/test2.20 @@ -0,0 +1,111 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Validate scontrol show hostnames. +# +# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR +# "FAILURE: ..." otherwise with an explanation of the failure, OR +# anything else indicates a failure mode that must be investigated. +############################################################################ +# Copyright (C) 2013 SchedMD LLC +# Written by Morris Jette +# +# This file is part of SLURM, a resource management program. +# For details, see <http://slurm.schedmd.com/>. +# Please also read the included file: DISCLAIMER. +# +# SLURM is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with SLURM; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +############################################################################ +source ./globals + +set test_id "2.20" +set exit_code 0 + +print_header $test_id + +# +# test single bracket hostnames +# +set matches 0 +spawn $scontrol show hostnames rack\[0-3\] +expect { + -re "rack0" { + incr matches + exp_continue + } + -re "rack1" { + incr matches + exp_continue + } + -re "rack2" { + incr matches + exp_continue + } + -re "rack3" { + incr matches + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$matches != 4} { + send_user "\nFAILURE: show hostnames failure ($matches != 4)\n" + set exit_code 1 +} + +# +# test double bracket hostnames +# +set matches 0 +spawn $scontrol show hostnames rack\[0-1\]_blade\[0-1\] +expect { + -re "rack0_blade0" { + incr matches + exp_continue + } + -re "rack0_blade1" { + incr matches + exp_continue + } + -re "rack1_blade0" { + incr matches + exp_continue + } + -re "rack1_blade1" { + incr matches + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$matches != 4} { + send_user "\nFAILURE: show hostnames failure ($matches != 4)\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code -- GitLab