Skip to content

Commit

Permalink
t2000-wreck.t: add test for cpu-affinity
Browse files Browse the repository at this point in the history
Add checks for cpu-affinity set by wreck exec system, via
either global lwj.options or local job `-o cpu-affinity` option.
  • Loading branch information
grondo committed May 29, 2018
1 parent a406e49 commit 41b908a
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion t/t2000-wreck.t
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,38 @@ test_expect_success 'wreckrun: job with more nodes than tasks fails' '
test "$(flux kvs get --json ${LWJ}.state)" = "failed"
'
cpus_allowed=${SHARNESS_TEST_SRCDIR}/scripts/cpus-allowed.lua
test "$($cpus_allowed count)" = "0" || test_set_prereq MULTICORE
if test "$($cpus_allowed count)" = "0"; then
test_set_prereq MULTICORE
# Note: Normalize format of cpu0 thread siblings using cpus-allowed script
# so that comparison of output works in MULTICORE tests below
cpu0_thread_siblings=$(cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list)
cpu0_thread_siblings=$($cpus_allowed intersect ${cpu0_thread_siblings})
fi
test_expect_success MULTICORE 'wreckrun: cpu-affinity job option works' '
flux wreckrun -o cpu-affinity -n1 $cpus_allowed > cpu-affinity.out &&
cat <<-EOF >cpu-affinity.expected &&
${cpu0_thread_siblings}
EOF
test_cmp cpu-affinity.expected cpu-affinity.out
'
test_expect_success MULTICORE 'wreckrun: global cpu-affinity job option works' '
flux kvs put --json lwj.options="{ \"cpu-affinity\": 1 }" &&
test_when_finished "flux kvs unlink lwj.options" &&
flux wreckrun -n1 $cpus_allowed > global-affinity.out &&
cat <<-EOF >global-affinity.expected &&
${cpu0_thread_siblings}
EOF
test_cmp global-affinity.expected global-affinity.out
'
test_expect_success MULTICORE 'wreckrun: local cpu-affinity option overriedes global' '
flux kvs put --json lwj.options="{ \"cpu-affinity\": 1 }" &&
test_when_finished "flux kvs unlink lwj.options" &&
flux wreckrun -n1 -o cpu-affinity=0 $cpus_allowed > no-affinity.out &&
cat <<-EOF >no-affinity.expected &&
$($cpus_allowed)
EOF
test_cmp no-affinity.expected no-affinity.out
'

test_expect_success 'wreckrun: top level environment' '
flux kvs put --json lwj.environ="{ \"TEST_ENV_VAR\": \"foo\" }" &&
Expand Down

0 comments on commit 41b908a

Please sign in to comment.