diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt index 6bbedd349..06096be9e 100644 --- a/t/CMakeLists.txt +++ b/t/CMakeLists.txt @@ -63,6 +63,7 @@ set(ALL_TESTS t3033-resource-nodex.t t3034-resource-pconstraints.t t3035-resource-remove.t + t3036-rq2.t t3300-system-dontblock.t t3301-system-latestart.t t4000-match-params.t diff --git a/t/data/resource/commands/rq2/cmds01.in b/t/data/resource/commands/rq2/cmds01.in new file mode 100644 index 000000000..f744123e0 --- /dev/null +++ b/t/data/resource/commands/rq2/cmds01.in @@ -0,0 +1,6 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +quit diff --git a/t/data/resource/commands/rq2/cmds02.in b/t/data/resource/commands/rq2/cmds02.in new file mode 100644 index 000000000..d27ba2797 --- /dev/null +++ b/t/data/resource/commands/rq2/cmds02.in @@ -0,0 +1,7 @@ +match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate_orelse_reserve @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +quit diff --git a/t/data/resource/expected/rq2/001.R.out b/t/data/resource/expected/rq2/001.R.out new file mode 100644 index 000000000..ace32b6a8 --- /dev/null +++ b/t/data/resource/expected/rq2/001.R.out @@ -0,0 +1,44 @@ + ---------------core35[1:x] + ------------socket1[1:x] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core35[1:x] + ------------socket1[1:x] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=2 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core17[1:x] + ------------socket0[1:x] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=3 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core17[1:x] + ------------socket0[1:x] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=4 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=5 +INFO: ============================= diff --git a/t/data/resource/expected/rq2/002.R.out b/t/data/resource/expected/rq2/002.R.out new file mode 100644 index 000000000..2646cfd1e --- /dev/null +++ b/t/data/resource/expected/rq2/002.R.out @@ -0,0 +1,54 @@ + ---------------core35[1:x] + ------------socket1[1:x] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core35[1:x] + ------------socket1[1:x] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=2 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core17[1:x] + ------------socket0[1:x] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=3 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core17[1:x] + ------------socket0[1:x] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=4 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core35[1:x] + ------------socket1[1:x] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=5 +INFO: RESOURCES=RESERVED +INFO: SCHEDULED AT=3600 +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=6 +INFO: ============================= diff --git a/t/t3036-rq2.t b/t/t3036-rq2.t new file mode 100755 index 000000000..6db76035b --- /dev/null +++ b/t/t3036-rq2.t @@ -0,0 +1,32 @@ +#!/bin/sh + +test_description='Test resource graph remove subgraph' + +. $(dirname $0)/sharness.sh + +cmd_dir="${SHARNESS_TEST_SRCDIR}/data/resource/commands/rq2" +exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/rq2" +jgf="${SHARNESS_TEST_SRCDIR}/data/resource/jgfs/tiny.json" +query="../../resource/utilities/rq2" + +cmds001="${cmd_dir}/cmds01.in" +test001_desc="match allocate test" +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="match allocate_orelse_reserve test" +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 +' + + + +test_done