Skip to content

Commit 8dded1a

Browse files
committed
testsuite: test correctness of shell rankinfo object
Problem: There is no test that ensures the job shell rankinfo object as returned by flux_shell_get_rank_info(3) contains the correct values for broker rank and number of tasks for multiple job shell ranks. Leverage the rc scripts and add a test to t2603-job-shell-initrc.t for this purpose. Increase the number of brokers in the test to allow for testing with mulitple job shells in a single job.
1 parent 66f4685 commit 8dded1a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

t/t2603-job-shell-initrc.t

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_description='Test flux-shell initrc.lua implementation'
44

55
. `dirname $0`/sharness.sh
66

7-
test_under_flux 1
7+
test_under_flux 4
88

99
FLUX_SHELL="${FLUX_BUILD_DIR}/src/shell/flux-shell"
1010

@@ -280,4 +280,25 @@ test_expect_success 'flux-shell: initrc: shell.die function works' '
280280
> ${name}.log 2>&1 &&
281281
grep "FATAL: test: shell.die" ${name}.log
282282
'
283+
test_expect_success MULTICORE 'flux-shell: initrc: shell.rankinfo reports broker_rank' '
284+
name=shell.rankinfo.broker_rank &&
285+
cat >${name}.lua <<-EOF &&
286+
ri0 = shell.get_rankinfo(0)
287+
ri1 = shell.get_rankinfo(1)
288+
if ri0.broker_rank ~= 1 or ri1.broker_rank ~= 3 then
289+
shell.log ("rankinfo(0).broker_rank = "
290+
..shell.get_rankinfo(0).broker_rank)
291+
shell.log ("rankinfo(1).broker_rank = "
292+
..shell.get_rankinfo(1).broker_rank)
293+
shell.die ("rankinfo.broker_rank incorrect!")
294+
end
295+
if ri0.ntasks ~= 2 or ri1.ntasks ~= 1 then
296+
shell.die ("got ri[0].ntasks = "..ri0.ntasks
297+
.." ri[1].ntasks = "..ri1.ntasks)
298+
end
299+
EOF
300+
flux run -N2 -n3 --requires=rank:1,3 \
301+
-o verbose -o initrc=${name}.lua true
302+
'
303+
flux job info $(flux job last) R
283304
test_done

0 commit comments

Comments
 (0)