Skip to content

Commit

Permalink
test: Test correctness under different prune filters
Browse files Browse the repository at this point in the history
  • Loading branch information
dongahn committed Dec 18, 2018
1 parent 344ff2a commit 4b55339
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ TESTS = \
t3008-resource-cancel.t \
t3009-resource-minmax.t \
t3010-resource-power.t \
t3011-resource-filt.t \
t4001-match-allocate.t \
t4002-match-reserve.t \
t4003-cancel-info.t \
Expand Down
98 changes: 98 additions & 0 deletions t/t3011-resource-filt.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/sh

test_description='Test Scheduling with various prune filter configurations'

. $(dirname $0)/sharness.sh

cmd_dir="${SHARNESS_TEST_SRCDIR}/data/resource/commands/basics"
exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/basics"
grugs="${SHARNESS_TEST_SRCDIR}/data/resource/grugs/tiny.graphml"
query="../../resource/utilities/resource-query"

#
# Selection Policy -- High ID first (-P high)
# The resource vertex with higher ID is preferred among its kind
# (e.g., node1 is preferred over node0 if available)
#

cmds003="${cmd_dir}/cmds03.in"
test003_desc="allocate_orelse_reserve 10 jobspecs works with default filter"
test_expect_success "${test003_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 &&
${query} -G ${grugs} -S CA -P high -t 003.R.out < cmds003 &&
test_cmp 003.R.out ${exp_dir}/003.R.out
'

cmds003="${cmd_dir}/cmds03.in"
test003_desc="allocate_orelse_reserve 10 jobspecs works with no additional filter"
test_expect_success "${test003_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 &&
${query} -G ${grugs} -S CA -P high --prune-filters="" -t 003.R.out < cmds003 &&
test_cmp 003.R.out ${exp_dir}/003.R.out
'

cmds003="${cmd_dir}/cmds03.in"
test003_desc="allocate_orelse_reserve 10 jobspecs works with ALL:core"
test_expect_success "${test003_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 &&
${query} -G ${grugs} -S CA -P high --prune-filters="ALL:core" -t 003.R.out < cmds003 &&
test_cmp 003.R.out ${exp_dir}/003.R.out
'

cmds003="${cmd_dir}/cmds03.in"
test003_desc="allocate_orelse_reserve 10 jobspecs works with ALL:core,ALL:gpu"
test_expect_success "${test003_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 &&
${query} -G ${grugs} -S CA -P high --prune-filters="ALL:core,ALL:gpu" -t 003.R.out < cmds003 &&
test_cmp 003.R.out ${exp_dir}/003.R.out
'

cmds003="${cmd_dir}/cmds03.in"
test003_desc="allocate_orelse_reserve 10 jobspecs works with ALL:core,ALL:gpu,ALL:memory"
test_expect_success "${test003_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 &&
${query} -G ${grugs} -S CA -P high --prune-filters="ALL:core,ALL:gpu" -t 003.R.out < cmds003 &&
test_cmp 003.R.out ${exp_dir}/003.R.out
'

cmds005="${cmd_dir}/cmds05.in"
test005_desc="match allocate_orelse_reserve 100 jobspecs instead (pol=hi)"
test_expect_success "${test005_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 &&
${query} -G ${grugs} -S CA -P high -t 005.R.out < cmds005 &&
test_cmp 005.R.out ${exp_dir}/005.R.out
'

cmds005="${cmd_dir}/cmds05.in"
test005_desc="match allocate_orelse_reserve 100 jobspecs with no additional filter"
test_expect_success "${test005_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 &&
${query} -G ${grugs} -S CA -P high --prune-filters="" -t 005.R.out < cmds005 &&
test_cmp 005.R.out ${exp_dir}/005.R.out
'

cmds005="${cmd_dir}/cmds05.in"
test005_desc="match allocate_orelse_reserve 100 jobspecs with ALL:core"
test_expect_success "${test005_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 &&
${query} -G ${grugs} -S CA -P high --prune-filters="ALL:core" -t 005.R.out < cmds005 &&
test_cmp 005.R.out ${exp_dir}/005.R.out
'

cmds005="${cmd_dir}/cmds05.in"
test005_desc="match allocate_orelse_reserve 100 jobspecs with ALL:core,ALL:gpu"
test_expect_success "${test005_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 &&
${query} -G ${grugs} -S CA -P high --prune-filters="ALL:core,ALL:gpu" -t 005.R.out < cmds005 &&
test_cmp 005.R.out ${exp_dir}/005.R.out
'

cmds005="${cmd_dir}/cmds05.in"
test005_desc="match allocate_orelse_reserve 100 jobspecs with ALL:core,ALL:gpu,ALL:memory"
test_expect_success "${test005_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 &&
${query} -G ${grugs} -S CA -P high --prune-filters="ALL:core,ALL:gpu,ALL:memory" -t 005.R.out < cmds005 &&
test_cmp 005.R.out ${exp_dir}/005.R.out
'

test_done

0 comments on commit 4b55339

Please sign in to comment.