From e66b61167227013cdc4870e90afa6eaa98aa1ffc Mon Sep 17 00:00:00 2001 From: Zeke Morton Date: Mon, 31 Jul 2023 17:41:44 -0700 Subject: [PATCH] tests: add tests for remove subgraph 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 --- t/Makefile.am | 1 + t/data/resource/commands/remove/cmds01.in | 3 + t/data/resource/commands/remove/cmds02.in | 8 ++ t/data/resource/commands/remove/cmds03.in | 3 + t/data/resource/expected/remove/001.R.out | 79 +++++++++++++++++ t/data/resource/expected/remove/002.R.out | 97 ++++++++++++++++++++ t/data/resource/expected/remove/003.R.out | 103 ++++++++++++++++++++++ t/t3035-resource-remove.t | 39 ++++++++ 8 files changed, 333 insertions(+) create mode 100644 t/data/resource/commands/remove/cmds01.in create mode 100644 t/data/resource/commands/remove/cmds02.in create mode 100644 t/data/resource/commands/remove/cmds03.in create mode 100644 t/data/resource/expected/remove/001.R.out create mode 100644 t/data/resource/expected/remove/002.R.out create mode 100644 t/data/resource/expected/remove/003.R.out create mode 100755 t/t3035-resource-remove.t diff --git a/t/Makefile.am b/t/Makefile.am index 5262d064f..3cf192922 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -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 \ diff --git a/t/data/resource/commands/remove/cmds01.in b/t/data/resource/commands/remove/cmds01.in new file mode 100644 index 000000000..a8e47fefc --- /dev/null +++ b/t/data/resource/commands/remove/cmds01.in @@ -0,0 +1,3 @@ +remove /tiny0/rack0/node1/socket1 +find status=up +quit diff --git a/t/data/resource/commands/remove/cmds02.in b/t/data/resource/commands/remove/cmds02.in new file mode 100644 index 000000000..9f182ba1c --- /dev/null +++ b/t/data/resource/commands/remove/cmds02.in @@ -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 diff --git a/t/data/resource/commands/remove/cmds03.in b/t/data/resource/commands/remove/cmds03.in new file mode 100644 index 000000000..99527a757 --- /dev/null +++ b/t/data/resource/commands/remove/cmds03.in @@ -0,0 +1,3 @@ +remove /does/not/exist +find status=up +quit diff --git a/t/data/resource/expected/remove/001.R.out b/t/data/resource/expected/remove/001.R.out new file mode 100644 index 000000000..54d2c2cc2 --- /dev/null +++ b/t/data/resource/expected/remove/001.R.out @@ -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: ============================= diff --git a/t/data/resource/expected/remove/002.R.out b/t/data/resource/expected/remove/002.R.out new file mode 100644 index 000000000..c50d2a94c --- /dev/null +++ b/t/data/resource/expected/remove/002.R.out @@ -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: ============================= diff --git a/t/data/resource/expected/remove/003.R.out b/t/data/resource/expected/remove/003.R.out new file mode 100644 index 000000000..192cccfd1 --- /dev/null +++ b/t/data/resource/expected/remove/003.R.out @@ -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: ============================= diff --git a/t/t3035-resource-remove.t b/t/t3035-resource-remove.t new file mode 100755 index 000000000..92d091cd3 --- /dev/null +++ b/t/t3035-resource-remove.t @@ -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