|
| 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