Skip to content
Snippets Groups Projects
Commit f6263c67 authored by Moe Jette's avatar Moe Jette
Browse files

relocate_to_slurm_trunk

parent cf74315a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Testing of hidden partitions.
#
# 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) 2002 The Regents of the University of California.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Moe Jette <jette1@llnl.gov>
# UCRL-CODE-2002-040.
#
# This file is part of SLURM, a resource management program.
# For details, see <http://www.llnl.gov/linux/slurm/>.
#
# 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.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
############################################################################
source ./globals
set test_id "3.6"
set authorized 1
set exit_code 0
set part_name "QA_TEST"
print_header $test_id
#
# Confirm that no hidden partition is seen by default
#
spawn $scontrol show part
expect {
-re "Hidden=YES" {
send_user "\nFAILURE: scontrol hidden partition seen\n"
set exit_code 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
#
# Check if any hidden partitions exist
#
set found 0
spawn $scontrol -a show part
expect {
-re "Hidden=YES" {
set found 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
if {$found == 1} {
if {$exit_code == 0} {
send_user "\nSUCCESS\n"
}
exit $exit_code
}
#
# We only reach this point if a hidden partition must be
# created to test this feature, which only super users can do
#
# Confirm the partition name does not already exist
#
set found -1
spawn $scontrol -a show part $part_name
expect {
-re "not found" {
send_user "This error was expected, no worries\n"
set found 0
exp_continue
}
-re "PartitionName" {
set found 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
if {$found == -1} {
send_user "\nFAILURE: scontrol output format error\n"
exit 1
}
if {$found == 1} {
send_user "\nFAILURE: partition $part_name already exists\n"
exit 1
}
#
# Create a new partition
#
spawn $scontrol update PartitionName=$part_name Hidden=YES
expect {
-re "slurm_update error: ($alpha_numeric) ($alpha_numeric)" {
set access_err 0
set err_msg1 $expect_out(1,string)
set err_msg2 $expect_out(2,string)
if {[string compare $err_msg1 "Invalid"] == 0} {
set access_err 1
}
if {[string compare $err_msg2 "user"] == 0} {
set access_err 1
}
if {$access_err == 1} {
send_user "\nWARNING: user not authorized to create partition\n"
exit $exit_code
} else {
set authorized 0
}
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
#
# Confirm the partition now exists
#
set found -1
set hidden 0
spawn $scontrol -a show part $part_name
expect {
-re "not found" {
set found 0
exp_continue
}
-re "PartitionName" {
set found 1
exp_continue
}
-re "Hidden=YES" {
set hidden 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
if {$found != 1} {
send_user "\nFAILURE: partition not created\n"
exit 1
}
if {$hidden == 0} {
send_user "\nFAILURE: partition not hidden\n"
set exit_code 1
}
#
# Confirm partition is hidden by default
#
spawn $scontrol show part $part_name
expect {
-re "PartitionName" {
send_user "\nFAILURE: partition not hidden\n"
set exit_code 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
#
# Now delete the partition
#
spawn $scontrol delete PartitionName=$part_name
expect {
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
#
# Confirm the partition is now gone
#
set found -1
spawn $scontrol -a show part $part_name
expect {
-re "not found" {
send_user "This error was expected, no worries\n"
set found 0
exp_continue
}
-re "PartitionName" {
set found 1
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
if {$found != 0} {
send_user "\nFAILURE: partition not deleted\n"
exit 1
}
if {$exit_code == 0} {
send_user "\nSUCCESS\n"
}
exit $exit_code
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment