Skip to content

Commit 610f962

Browse files
committed
testsuite: add t2316-resource-rediscover.t
Problem: There are no tests of the resource.rediscover configuration key. Add t2316-resource-rediscover.t for testing this option.
1 parent 9a1f6cf commit 610f962

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ TESTSCRIPTS = \
179179
t2313-resource-acquire.t \
180180
t2314-resource-monitor.t \
181181
t2315-resource-system.t \
182+
t2315-resource-rediscover.t \
182183
t2350-resource-list.t \
183184
t2351-resource-status-input.t \
184185
t2352-resource-cmd-config.t \

t/t2316-resource-rediscover.t

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
test_description='Test resource module forced rediscovery'
4+
5+
# Append --logfile option if FLUX_TESTS_LOGFILE is set in environment:
6+
test -n "$FLUX_TESTS_LOGFILE" && set -- "$@" --logfile
7+
. `dirname $0`/sharness.sh
8+
9+
if which hwloc-bind > /dev/null; then
10+
NCORES=$(hwloc-bind --get | hwloc-calc --number-of core | tail -n 1)
11+
test $NCORES = 1 || test_set_prereq MULTICORE
12+
fi
13+
14+
if ! test_have_prereq MULTICORE; then
15+
skip_all='skipping rediscovery testing without MULTICORE'
16+
test_done
17+
fi
18+
19+
test_under_flux 2
20+
21+
test_expect_success 'resource: resource.rediscover forces hwloc discovery' '
22+
NCORES=$(flux alloc -n1 -o cpu-affinity=off \
23+
flux resource list -no {ncores}) &&
24+
test $NCORES -eq 1 &&
25+
NCORES2=$(flux alloc -n1 -o cpu-affinity=off \
26+
--conf=resource.rediscover=true \
27+
flux resource list -no {ncores}) &&
28+
test_debug "echo got ncores=$NCORES2 with resource.rediscover" &&
29+
test $NCORES2 -gt $NCORES
30+
'
31+
test_expect_success 'resource: resource.rediscover works with multiple nodes' '
32+
NCORES=$(flux alloc -N2 -n2 -o cpu-affinity=off \
33+
flux resource list -no {ncores}) &&
34+
test $NCORES -eq 2 &&
35+
NCORES3=$(flux alloc -N2 -n2 -o cpu-affinity=off \
36+
--conf=resource.rediscover=true \
37+
flux resource list -no {ncores}) &&
38+
test_debug "echo got ncores=$NCORES3 with rediscover on 2 nodes" &&
39+
test $NCORES3 -gt $NCORES &&
40+
test $NCORES3 -eq $(($NCORES2*2))
41+
'
42+
test_done

0 commit comments

Comments
 (0)