Skip to content
Snippets Groups Projects
Commit df16f642 authored by Chad Vizino's avatar Chad Vizino Committed by Brian Christiansen
Browse files

Add test case to confirm standalone srun is not ignoring --mem-per-cpu.

Bug 7277
parent fd2bd5e3
No related branches found
No related tags found
No related merge requests found
......@@ -133,6 +133,7 @@ EXTRA_DIST = \
test1.113 \
test1.114 \
test1.115 \
test1.116 \
test2.1 \
test2.2 \
test2.3 \
......
......@@ -541,6 +541,7 @@ EXTRA_DIST = \
test1.113 \
test1.114 \
test1.115 \
test1.116 \
test2.1 \
test2.2 \
test2.3 \
......
......@@ -221,6 +221,7 @@ test1.112 Test of --deadline and --begin option and time not changed
test1.113 Test of --use-min-nodes option.
test1.114 Test of srun --spread-job option.
test1.115 Test of srun not hanging on ignored stdin.
test1.116 Test of standalone srun not ignoring --mem-per-cpu
test2.# Testing of scontrol options (to be run as unprivileged user).
========================================================================
......
#!/usr/bin/env expect
############################################################################
# Purpose: Test of Slurm functionality
# Confirm that memory per cpu properly set on an srun job that
# does not have a preexisting allocation.
#
# 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) 2019 SchedMD LLC
# Written by Chad Vizino <chad@schedmd.com>
#
# This file is part of Slurm, a resource management program.
# For details, see <https://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 "1.116"
set timeout $max_job_delay
set job_id 0
set mem_spec "100M"
set job_min_memory_cpu 0
print_header $test_id
#
# submit srun job with a specific mem-per-cpu request
#
set srun_pid [spawn $srun --mem-per-cpu=$mem_spec $bin_bash -c "echo SLURM_JOB_ID=\$SLURM_JOB_ID"]
expect {
-re {SLURM_JOB_ID=([0-9]+)} {
set job_id $expect_out(1,string)
}
timeout {
send_user "\nFAILURE: srun not responding\n"
slow_kill $srun_pid
exit 1
}
eof {
wait
}
}
#
# check to make sure a job id was set
#
if {$job_id == 0} {
send_user "\nFAILURE: Did not get job id\n"
exit 1
}
#
# get job memory info
#
spawn $scontrol show job $job_id
expect {
-re {MinMemoryCPU=([0-9]+.?)} {
set job_min_memory_cpu $expect_out(1,string)
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
exit 1
}
eof {
wait
}
}
#
# check that the memory reported matches the requested value
#
if {[string compare $job_min_memory_cpu $mem_spec] != 0} {
send_user "\nFAILURE: job MinMemoryCPU $job_min_memory_cpu != $mem_spec\n"
exit 1
}
print_success $test_id
exit 0
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