File: test32.4

package info (click to toggle)
slurm-wlm 22.05.8-4%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 48,492 kB
  • sloc: ansic: 475,246; exp: 69,020; sh: 8,862; javascript: 6,528; python: 6,444; makefile: 4,185; perl: 4,069; pascal: 131
file content (124 lines) | stat: -rwxr-xr-x 3,431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env expect
############################################################################
# Purpose: Test of Slurm functionality
#          Validates that sgather copies specified files from compute nodes.
############################################################################
# Copyright (C) 2011-2013 SchedMD LLC
# Written by Nathan Yee <nyee32@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 job_id        0
set hostname      ""
set file_in       "$test_dir/input"
set file_out      "$test_dir/output"
set sgather_tmp   "/tmp/$test_name"
set sgather_out   "{test_name}_sgather.out"

if {[file executable $sgather] == 0} {
	skip "$sgather does not exist"
}

if {[get_config_param "FrontendName"] ne "MISSING"} {
	skip "This test is incompatible with front-end systems"
}
if {[get_config_param "MULTIPLE_SLURMD"] eq "Yes"} {
	skip "This test is incompatible with multiple slurmd systems"
}
if {[get_config_param "SlurmdUser"] ne "root(0)"} {
	skip "This test is incompatible with SlurmdUser != root"
}

proc cleanup {} {
	global job_id

	cancel_job $job_id
}

# Set env PATH to slurm dir
set env(PATH) $slurm_dir/bin:$env(PATH)

make_bash_script $file_in "
env | grep SLURM_NNODES
$bin_rm -f ${sgather_out}\*
$srun $bin_cp -f $sgather $sgather_tmp
$sgather $sgather_tmp $sgather_out
sum $sgather ${sgather_out}\*
$bin_rm -f ${sgather_out}\*
$srun ls -l $sgather_tmp
$srun $bin_rm -f $sgather_tmp
exit 0
"

spawn $sbatch -N1-4 -o $file_out -t1 $file_in
expect {
	-re "Submitted batch job ($number)" {
		set job_id $expect_out(1,string)
		exp_continue
	}
	timeout {
		fail "sbatch is not responding"
	}
	eof {
		wait
	}
}
if {$job_id == 0} {
	fail "Batch job was not submitted"
}

wait_for_job -fail $job_id "DONE"
wait_for_file -fail $file_out

set number_1 -1
set number_2 -1
set file_cnt  0
set rm_cnt    0
set node_cnt 99
spawn $bin_cat $file_out
expect {
	-re "SLURM_NNODES=($number)" {
		set node_cnt $expect_out(1,string)
		exp_continue
	}
	-re "\n($number) *($number) " {
		if {$number_1 == $expect_out(1,string) && $number_2 == $expect_out(2,string)} {
			incr file_cnt
		} else {
			set number_1 $expect_out(1,string)
			set number_2 $expect_out(2,string)
		}
		exp_continue
	}
	-re "No such file or directory" {
		incr rm_cnt
		exp_continue
	}
	eof {
		wait
	}
}
if {$file_cnt != $node_cnt} {
	fail "Failed to gather files from all allocated nodes ($file_cnt != $node_cnt)"
}
if {$rm_cnt != $node_cnt} {
	fail "Failed to remove gathered files from all allocated nodes ($rm_cnt != $node_cnt)"
}