Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
c8a43fe5
Commit
c8a43fe5
authored
10 years ago
by
Morris Jette
Browse files
Options
Downloads
Patches
Plain Diff
Add checks for srun and sbatch --export options
parent
0826fe98
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
testsuite/expect/test1.28
+80
-5
80 additions, 5 deletions
testsuite/expect/test1.28
testsuite/expect/test17.14
+180
-2
180 additions, 2 deletions
testsuite/expect/test17.14
with
260 additions
and
7 deletions
testsuite/expect/test1.28
+
80
−
5
View file @
c8a43fe5
...
@@ -38,16 +38,40 @@ set test_env_val 123
...
@@ -38,16 +38,40 @@ set test_env_val 123
set exit_code 0
set exit_code 0
set matches 0
set matches 0
global env
set env($test_env_name) $test_env_val
print_header $test_id
print_header $test_id
#
#
# Spawn a job via srun to print environment variables
# Spawn a job via srun to print environment variables
#
#
set timeout $max_job_delay
set timeout $max_job_delay
set srun_pid [spawn $srun -N1 --export=$test_env_name=$test_env_val -t1 $bin_env]
expect {
-re "$test_env_name=($number)" {
if {$expect_out(1,string) == $test_env_val} {
incr matches
}
exp_continue
}
timeout {
send_user "\nFAILURE: srun not responding\n"
slow_kill $srun_pid
set exit_code 1
}
eof {
wait
}
}
if {$matches != 1} {
send_user "\nFAILURE: Environment variables not propagated ($matches != 1)\n"
exit 1
}
#
# Spawn a job via srun to print environment variables
#
global env
set env($test_env_name) $test_env_val
set env($test_env_name) $test_env_val
set matches 0
set srun_pid [spawn $srun -N1 -t1 $bin_env]
set srun_pid [spawn $srun -N1 -t1 $bin_env]
expect {
expect {
-re "$test_env_name=($number)" {
-re "$test_env_name=($number)" {
...
@@ -65,10 +89,61 @@ expect {
...
@@ -65,10 +89,61 @@ expect {
wait
wait
}
}
}
}
if {$matches != 1} {
send_user "\nFAILURE: Environment variables not propagated ($matches != 1)\n"
exit 1
}
#
# Spawn a job via srun to print environment variables with --export=ALL
#
set matches 0
set srun_pid [spawn $srun -N1 -t1 --export=ALL $bin_env]
expect {
-re "$test_env_name=($number)" {
if {$expect_out(1,string) == $test_env_val} {
incr matches
}
exp_continue
}
timeout {
send_user "\nFAILURE: srun not responding\n"
slow_kill $srun_pid
set exit_code 1
}
eof {
wait
}
}
if {$matches != 1} {
if {$matches != 1} {
send_user "\nFAILURE: Environment variables not propagated\n"
send_user "\nFAILURE: Environment variables not propagated ($matches != 1)\n"
set exit_code 1
exit 1
}
#
# Spawn a job via srun to print environment variables with --export=NONE
#
set matches 0
set srun_pid [spawn $srun -N1 -t1 --export=NONE $bin_env]
expect {
-re "$test_env_name=($number)" {
if {$expect_out(1,string) == $test_env_val} {
incr matches
}
exp_continue
}
timeout {
send_user "\nFAILURE: srun not responding\n"
slow_kill $srun_pid
set exit_code 1
}
eof {
wait
}
}
if {$matches != 0} {
send_user "\nFAILURE: Environment variables not propagated ($matches != 0)\n"
exit 1
}
}
if {$exit_code == 0} {
if {$exit_code == 0} {
...
...
This diff is collapsed.
Click to expand it.
testsuite/expect/test17.14
+
180
−
2
View file @
c8a43fe5
...
@@ -39,7 +39,6 @@ set exit_code 0
...
@@ -39,7 +39,6 @@ set exit_code 0
set file_in "test$test_id.input"
set file_in "test$test_id.input"
set file_out "test$test_id.output"
set file_out "test$test_id.output"
set job_id 0
set job_id 0
set matches 0
global env
global env
set env($test_env_name) $test_env_val
set env($test_env_name) $test_env_val
...
@@ -58,6 +57,68 @@ make_bash_script $file_in "
...
@@ -58,6 +57,68 @@ make_bash_script $file_in "
#
#
# Spawn a job via sbatch to print environment variables
# Spawn a job via sbatch to print environment variables
#
#
set matches 0
spawn $sbatch -N1 -t1 --export=$test_env_name=$test_env_val --output=$file_out $file_in
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: sbatch not responding\n"
set exit_code 1
exp_continue
}
eof {
wait
}
}
if { $job_id == 0 } {
send_user "\nFAILURE: failed to submit job\n"
exit 1
}
#
# Wait for job to complete
#
if {[wait_for_job $job_id "DONE"] != 0} {
send_user "\nFAILURE: waiting for job to complete\n"
cancel_job $job_id
set exit_code 1
}
#
# Check for desired output
#
if {[wait_for_file $file_out] != 0} {
send_user "\nFAILURE: Output file $file_out is missing\n"
exit 1
}
spawn $bin_cat $file_out
expect {
-re "$test_env_name=($number)" {
if {$expect_out(1,string) == $test_env_val} {
incr matches
} else {
send_user "\nNO MATCHX${expect_out(1,string)}X${test_env_val}X\n"
}
exp_continue
}
eof {
wait
}
}
# Match to "SLURM_EXPORT_ENV=TEST_ENV_17.14=123" and "TEST_ENV_17.14=123"
if {$matches != 2} {
send_user "\nFAILURE: Environment variables not propagated from command line ($matches != 2)\n"
exit 1
}
#
# Spawn a job via sbatch to print environment variables
#
exec $bin_rm -f $file_out
set matches 0
set env($test_env_name) $test_env_val
set env($test_env_name) $test_env_val
spawn $sbatch -N1 -t1 --output=$file_out $file_in
spawn $sbatch -N1 -t1 --output=$file_out $file_in
expect {
expect {
...
@@ -107,12 +168,129 @@ expect {
...
@@ -107,12 +168,129 @@ expect {
wait
wait
}
}
}
}
if {$matches != 1} {
send_user "\nFAILURE: Environment variables not propagated ($matches != 1)\n"
exit 1
}
#
# Spawn a job via sbatch to print environment variables with --export=ALL
#
exec $bin_rm -f $file_out
set matches 0
set env($test_env_name) $test_env_val
spawn $sbatch -N1 -t1 --export=ALL --output=$file_out $file_in
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: sbatch not responding\n"
set exit_code 1
exp_continue
}
eof {
wait
}
}
if { $job_id == 0 } {
send_user "\nFAILURE: failed to submit job\n"
exit 1
}
#
# Wait for job to complete
#
if {[wait_for_job $job_id "DONE"] != 0} {
send_user "\nFAILURE: waiting for job to complete\n"
cancel_job $job_id
set exit_code 1
}
#
# Check for desired output
#
if {[wait_for_file $file_out] != 0} {
send_user "\nFAILURE: Output file $file_out is missing\n"
exit 1
}
spawn $bin_cat $file_out
expect {
-re "$test_env_name=($number)" {
if {$expect_out(1,string) == $test_env_val} {
incr matches
}
exp_continue
}
eof {
wait
}
}
if {$matches != 1} {
if {$matches != 1} {
send_user "\nFAILURE: Environment variables not propagated\n"
send_user "\nFAILURE: Environment variables not propagated ($matches != 1)\n"
exit 1
}
#
# Spawn a job via sbatch to print environment variables with --export=NONE
#
exec $bin_rm -f $file_out
set matches 0
set env($test_env_name) $test_env_val
spawn $sbatch -N1 -t1 --export=NONE --output=$file_out $file_in
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: sbatch not responding\n"
set exit_code 1
exp_continue
}
eof {
wait
}
}
if { $job_id == 0 } {
send_user "\nFAILURE: failed to submit job\n"
exit 1
}
#
# Wait for job to complete
#
if {[wait_for_job $job_id "DONE"] != 0} {
send_user "\nFAILURE: waiting for job to complete\n"
cancel_job $job_id
set exit_code 1
set exit_code 1
}
}
#
# Check for desired output
#
if {[wait_for_file $file_out] != 0} {
send_user "\nFAILURE: Output file $file_out is missing\n"
exit 1
}
spawn $bin_cat $file_out
expect {
-re "$test_env_name=($number)" {
if {$expect_out(1,string) == $test_env_val} {
incr matches
}
exp_continue
}
eof {
wait
}
}
if {$matches != 0} {
send_user "\nFAILURE: Environment variables were propagated ($matches != 0)\n"
exit 1
}
if {$exit_code == 0} {
if {$exit_code == 0} {
exec $bin_rm -f $file_in $file_out
exec $bin_rm -f $file_in $file_out
send_user "\nSUCCESS\n"
send_user "\nSUCCESS\n"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment