Skip to content

Commit

Permalink
tests: add tests for remove subgraph
Browse files Browse the repository at this point in the history
problem: the reemove subgrapgh feature added new code that
needs to be tested as a part of automated ci

add tests for this new feature
  • Loading branch information
zekemorton committed Aug 1, 2023
1 parent f474106 commit e66b611
Show file tree
Hide file tree
Showing 8 changed files with 333 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 @@ -82,6 +82,7 @@ TESTS = \
t3031-resource-minmax2.t \
t3033-resource-nodex.t \
t3034-resource-pconstraints.t \
t3035-resource-remove.t \
t3300-system-dontblock.t \
t3301-system-latestart.t \
t4000-match-params.t \
Expand Down
3 changes: 3 additions & 0 deletions t/data/resource/commands/remove/cmds01.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
remove /tiny0/rack0/node1/socket1
find status=up
quit
8 changes: 8 additions & 0 deletions t/data/resource/commands/remove/cmds02.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
remove /tiny0/rack0/node1/socket1/core30
remove /tiny0/rack0/node1/socket1/core31
remove /tiny0/rack0/node1/socket1/core32
remove /tiny0/rack0/node1/socket1/core33
remove /tiny0/rack0/node1/socket1/core34
remove /tiny0/rack0/node1/socket1/core35
find status=up
quit
3 changes: 3 additions & 0 deletions t/data/resource/commands/remove/cmds03.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
remove /does/not/exist
find status=up
quit
79 changes: 79 additions & 0 deletions t/data/resource/expected/remove/001.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---------------core0[1:x]
---------------core1[1:x]
---------------core2[1:x]
---------------core3[1:x]
---------------core4[1:x]
---------------core5[1:x]
---------------core6[1:x]
---------------core7[1:x]
---------------core8[1:x]
---------------core9[1:x]
---------------core10[1:x]
---------------core11[1:x]
---------------core12[1:x]
---------------core13[1:x]
---------------core14[1:x]
---------------core15[1:x]
---------------core16[1:x]
---------------core17[1:x]
---------------gpu0[1:x]
---------------memory0[2:x]
---------------memory1[2:x]
---------------memory2[2:x]
---------------memory3[2:x]
------------socket0[1:x]
---------------core18[1:x]
---------------core19[1:x]
---------------core20[1:x]
---------------core21[1:x]
---------------core22[1:x]
---------------core23[1:x]
---------------core24[1:x]
---------------core25[1:x]
---------------core26[1:x]
---------------core27[1:x]
---------------core28[1:x]
---------------core29[1:x]
---------------core30[1:x]
---------------core31[1:x]
---------------core32[1:x]
---------------core33[1:x]
---------------core34[1:x]
---------------core35[1:x]
---------------gpu1[1:x]
---------------memory4[2:x]
---------------memory5[2:x]
---------------memory6[2:x]
---------------memory7[2:x]
------------socket1[1:x]
---------node0[1:x]
---------------core0[1:x]
---------------core1[1:x]
---------------core2[1:x]
---------------core3[1:x]
---------------core4[1:x]
---------------core5[1:x]
---------------core6[1:x]
---------------core7[1:x]
---------------core8[1:x]
---------------core9[1:x]
---------------core10[1:x]
---------------core11[1:x]
---------------core12[1:x]
---------------core13[1:x]
---------------core14[1:x]
---------------core15[1:x]
---------------core16[1:x]
---------------core17[1:x]
---------------gpu0[1:x]
---------------memory0[2:x]
---------------memory1[2:x]
---------------memory2[2:x]
---------------memory3[2:x]
------------socket0[1:x]
---------node1[1:x]
------rack0[1:x]
---tiny0[1:x]
INFO: =============================
INFO: EXPRESSION="status=up"
INFO: =============================
97 changes: 97 additions & 0 deletions t/data/resource/expected/remove/002.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---------------core0[1:x]
---------------core1[1:x]
---------------core2[1:x]
---------------core3[1:x]
---------------core4[1:x]
---------------core5[1:x]
---------------core6[1:x]
---------------core7[1:x]
---------------core8[1:x]
---------------core9[1:x]
---------------core10[1:x]
---------------core11[1:x]
---------------core12[1:x]
---------------core13[1:x]
---------------core14[1:x]
---------------core15[1:x]
---------------core16[1:x]
---------------core17[1:x]
---------------gpu0[1:x]
---------------memory0[2:x]
---------------memory1[2:x]
---------------memory2[2:x]
---------------memory3[2:x]
------------socket0[1:x]
---------------core18[1:x]
---------------core19[1:x]
---------------core20[1:x]
---------------core21[1:x]
---------------core22[1:x]
---------------core23[1:x]
---------------core24[1:x]
---------------core25[1:x]
---------------core26[1:x]
---------------core27[1:x]
---------------core28[1:x]
---------------core29[1:x]
---------------core30[1:x]
---------------core31[1:x]
---------------core32[1:x]
---------------core33[1:x]
---------------core34[1:x]
---------------core35[1:x]
---------------gpu1[1:x]
---------------memory4[2:x]
---------------memory5[2:x]
---------------memory6[2:x]
---------------memory7[2:x]
------------socket1[1:x]
---------node0[1:x]
---------------core0[1:x]
---------------core1[1:x]
---------------core2[1:x]
---------------core3[1:x]
---------------core4[1:x]
---------------core5[1:x]
---------------core6[1:x]
---------------core7[1:x]
---------------core8[1:x]
---------------core9[1:x]
---------------core10[1:x]
---------------core11[1:x]
---------------core12[1:x]
---------------core13[1:x]
---------------core14[1:x]
---------------core15[1:x]
---------------core16[1:x]
---------------core17[1:x]
---------------gpu0[1:x]
---------------memory0[2:x]
---------------memory1[2:x]
---------------memory2[2:x]
---------------memory3[2:x]
------------socket0[1:x]
---------------core18[1:x]
---------------core19[1:x]
---------------core20[1:x]
---------------core21[1:x]
---------------core22[1:x]
---------------core23[1:x]
---------------core24[1:x]
---------------core25[1:x]
---------------core26[1:x]
---------------core27[1:x]
---------------core28[1:x]
---------------core29[1:x]
---------------gpu1[1:x]
---------------memory4[2:x]
---------------memory5[2:x]
---------------memory6[2:x]
---------------memory7[2:x]
------------socket1[1:x]
---------node1[1:x]
------rack0[1:x]
---tiny0[1:x]
INFO: =============================
INFO: EXPRESSION="status=up"
INFO: =============================
103 changes: 103 additions & 0 deletions t/data/resource/expected/remove/003.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---------------core0[1:x]
---------------core1[1:x]
---------------core2[1:x]
---------------core3[1:x]
---------------core4[1:x]
---------------core5[1:x]
---------------core6[1:x]
---------------core7[1:x]
---------------core8[1:x]
---------------core9[1:x]
---------------core10[1:x]
---------------core11[1:x]
---------------core12[1:x]
---------------core13[1:x]
---------------core14[1:x]
---------------core15[1:x]
---------------core16[1:x]
---------------core17[1:x]
---------------gpu0[1:x]
---------------memory0[2:x]
---------------memory1[2:x]
---------------memory2[2:x]
---------------memory3[2:x]
------------socket0[1:x]
---------------core18[1:x]
---------------core19[1:x]
---------------core20[1:x]
---------------core21[1:x]
---------------core22[1:x]
---------------core23[1:x]
---------------core24[1:x]
---------------core25[1:x]
---------------core26[1:x]
---------------core27[1:x]
---------------core28[1:x]
---------------core29[1:x]
---------------core30[1:x]
---------------core31[1:x]
---------------core32[1:x]
---------------core33[1:x]
---------------core34[1:x]
---------------core35[1:x]
---------------gpu1[1:x]
---------------memory4[2:x]
---------------memory5[2:x]
---------------memory6[2:x]
---------------memory7[2:x]
------------socket1[1:x]
---------node0[1:x]
---------------core0[1:x]
---------------core1[1:x]
---------------core2[1:x]
---------------core3[1:x]
---------------core4[1:x]
---------------core5[1:x]
---------------core6[1:x]
---------------core7[1:x]
---------------core8[1:x]
---------------core9[1:x]
---------------core10[1:x]
---------------core11[1:x]
---------------core12[1:x]
---------------core13[1:x]
---------------core14[1:x]
---------------core15[1:x]
---------------core16[1:x]
---------------core17[1:x]
---------------gpu0[1:x]
---------------memory0[2:x]
---------------memory1[2:x]
---------------memory2[2:x]
---------------memory3[2:x]
------------socket0[1:x]
---------------core18[1:x]
---------------core19[1:x]
---------------core20[1:x]
---------------core21[1:x]
---------------core22[1:x]
---------------core23[1:x]
---------------core24[1:x]
---------------core25[1:x]
---------------core26[1:x]
---------------core27[1:x]
---------------core28[1:x]
---------------core29[1:x]
---------------core30[1:x]
---------------core31[1:x]
---------------core32[1:x]
---------------core33[1:x]
---------------core34[1:x]
---------------core35[1:x]
---------------gpu1[1:x]
---------------memory4[2:x]
---------------memory5[2:x]
---------------memory6[2:x]
---------------memory7[2:x]
------------socket1[1:x]
---------node1[1:x]
------rack0[1:x]
---tiny0[1:x]
INFO: =============================
INFO: EXPRESSION="status=up"
INFO: =============================
39 changes: 39 additions & 0 deletions t/t3035-resource-remove.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

test_description='Test resource graph remove subgraph'

. $(dirname $0)/sharness.sh

cmd_dir="${SHARNESS_TEST_SRCDIR}/data/resource/commands/remove"
exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/remove"
jgf="${SHARNESS_TEST_SRCDIR}/data/resource/jgfs/tiny.json"
query="../../resource/utilities/resource-query"

cmds001="${cmd_dir}/cmds01.in"
test001_desc="remove a single socket"
test_expect_success "${test001_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds001} > cmds001 &&
${query} -L ${jgf} -f jgf -t 001.R.out \
< cmds001 &&
test_cmp 001.R.out ${exp_dir}/001.R.out
'

cmds002="${cmd_dir}/cmds02.in"
test002_desc="remove several cpus"
test_expect_success "${test002_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds002} > cmds002 &&
${query} -L ${jgf} -f jgf -t 002.R.out \
< cmds002 &&
test_cmp 002.R.out ${exp_dir}/002.R.out
'

cmds003="${cmd_dir}/cmds03.in"
test003_desc="remove non existent node"
test_expect_success "${test003_desc}" '
sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 &&
${query} -L ${jgf} -f jgf -t 003.R.out \
< cmds003 &&
test_cmp 003.R.out ${exp_dir}/003.R.out
'

test_done

0 comments on commit e66b611

Please sign in to comment.