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

relocate_to_slurm_trunk

parent ec9d3215
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Validate scontrol create, delete, and update for 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 Morris 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.5"
set authorized 1
set exit_code 0
set part_name "QA_TEST"
print_header $test_id
#
# 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
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 allow 0
set found -1
spawn $scontrol show part $part_name
expect {
-re "not found" {
set found 0
exp_continue
}
-re "PartitionName" {
set found 1
exp_continue
}
-re "AllowGroups=ALL" {
set allow 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 {$allow != 1} {
send_user "\nFAILURE: partition groups value incorrect\n"
set exit_code 1
}
#
# Now set group to mine
#
spawn $bin_id -gn
expect {
-re "($alpha_numeric)" {
set my_group $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: id not responding\n"
set exit_code 1
}
eof {
wait
}
}
spawn $scontrol update PartitionName=$part_name AllowGroups=$my_group
expect {
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
set found 0
spawn $scontrol show part $part_name
expect {
-re "AllowGroups=$my_group" {
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: partition group not reset\n"
set exit_code 1
}
#
# Now reset AllowGroups to ALL
#
spawn $scontrol update PartitionName=$part_name AllowGroups=ALL
expect {
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
}
eof {
wait
}
}
set found 0
spawn $scontrol show part $part_name
expect {
-re "AllowGroups=ALL" {
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: partition group not reset\n"
set exit_code 1
}
#
# 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 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