Skip to content

Commit

Permalink
testsuite: add golang sharness tests
Browse files Browse the repository at this point in the history
Problem: the Fluxion sharness tests need to test the
Golang bindings.

Add a basic sharness test and expected outputs.
  • Loading branch information
milroy authored and vsoch committed Sep 15, 2023
1 parent ba15fc2 commit c20401f
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 1 deletion.
3 changes: 2 additions & 1 deletion t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ TESTS = \
t6001-match-formats.t \
t6002-graph-hwloc.t \
t7000-shell-datastaging.t \
t8001-util-ion-R.t
t8001-util-ion-R.t \
t9001-golang-basic.t

check_SCRIPTS = $(TESTS)

Expand Down
54 changes: 54 additions & 0 deletions t/data/resource/expected/golang/001.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Errors so far:
Jobspec:
version: 9999
resources:
- type: cluster
count: 1
with:
- type: rack
count: 1
with:
- type: node
count: 1
with:
- type: slot
count: 1
label: default
with:
- type: socket
count: 1
with:
- type: core
count: 1
# a comment
attributes:
system:
duration: 3600
tasks:
- command: [ "app" ]
slot: default
count:
per_slot: 1



----Match Allocate output---
jobid: 1
reserved: false
allocated: {"graph": {"nodes": [{"id": "79", "metadata": {"type": "core", "basename": "core", "name": "core35", "id": 35, "uniq_id": 79, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core35"}}}, {"id": "7", "metadata": {"type": "socket", "basename": "socket", "name": "socket1", "id": 1, "uniq_id": 7, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1"}}}, {"id": "3", "metadata": {"type": "node", "basename": "node", "name": "node1", "id": 1, "uniq_id": 3, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1"}}}, {"id": "1", "metadata": {"type": "rack", "basename": "rack", "name": "rack0", "id": 0, "uniq_id": 1, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0"}}}, {"id": "0", "metadata": {"type": "cluster", "basename": "tiny", "name": "tiny0", "id": 0, "uniq_id": 0, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0"}}}], "edges": [{"source": "7", "target": "79", "metadata": {"name": {"containment": "contains"}}}, {"source": "3", "target": "7", "metadata": {"name": {"containment": "contains"}}}, {"source": "1", "target": "3", "metadata": {"name": {"containment": "contains"}}}, {"source": "0", "target": "1", "metadata": {"name": {"containment": "contains"}}}]}}

at: 0
error: 0
Errors so far:


----Match Allocate output---
jobid: 2
reserved: false
allocated: {"graph": {"nodes": [{"id": "43", "metadata": {"type": "core", "basename": "core", "name": "core35", "id": 35, "uniq_id": 43, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core35"}}}, {"id": "5", "metadata": {"type": "socket", "basename": "socket", "name": "socket1", "id": 1, "uniq_id": 5, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1"}}}, {"id": "2", "metadata": {"type": "node", "basename": "node", "name": "node0", "id": 0, "uniq_id": 2, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0"}}}, {"id": "1", "metadata": {"type": "rack", "basename": "rack", "name": "rack0", "id": 0, "uniq_id": 1, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0"}}}, {"id": "0", "metadata": {"type": "cluster", "basename": "tiny", "name": "tiny0", "id": 0, "uniq_id": 0, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0"}}}], "edges": [{"source": "5", "target": "43", "metadata": {"name": {"containment": "contains"}}}, {"source": "2", "target": "5", "metadata": {"name": {"containment": "contains"}}}, {"source": "1", "target": "2", "metadata": {"name": {"containment": "contains"}}}, {"source": "0", "target": "1", "metadata": {"name": {"containment": "contains"}}}]}}

at: 0
error: 0
Cancel output: 0
Info output jobid 1: false, 0, 0.000000, CANCELED, 0
Info output jobid 2: false, 0, 0.000000, 0
51 changes: 51 additions & 0 deletions t/data/resource/expected/golang/002.R.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Errors so far:
Jobspec:
version: 9999
resources:
- type: slot
count: 2
label: default
with:
- type: node
count: 1
with:
- type: socket
count: 2
with:
- type: core
count: 5
- type: gpu
count: 1
- type: memory
count: 6

# a comment
attributes:
system:
duration: 3600
tasks:
- command: [ "app" ]
slot: default
count:
per_slot: 1


----Match Allocate output---
jobid: 1
reserved: false
allocated: {"graph": {"nodes": [{"id": "21", "metadata": {"type": "core", "basename": "core", "name": "core13", "id": 13, "uniq_id": 21, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core13"}}}, {"id": "22", "metadata": {"type": "core", "basename": "core", "name": "core14", "id": 14, "uniq_id": 22, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core14"}}}, {"id": "23", "metadata": {"type": "core", "basename": "core", "name": "core15", "id": 15, "uniq_id": 23, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core15"}}}, {"id": "24", "metadata": {"type": "core", "basename": "core", "name": "core16", "id": 16, "uniq_id": 24, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core16"}}}, {"id": "25", "metadata": {"type": "core", "basename": "core", "name": "core17", "id": 17, "uniq_id": 25, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/core17"}}}, {"id": "80", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu0", "id": 0, "uniq_id": 80, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0/gpu0"}}}, {"id": "85", "metadata": {"type": "memory", "basename": "memory", "name": "memory1", "id": 1, "uniq_id": 85, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket0/memory1"}}}, {"id": "86", "metadata": {"type": "memory", "basename": "memory", "name": "memory2", "id": 2, "uniq_id": 86, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket0/memory2"}}}, {"id": "87", "metadata": {"type": "memory", "basename": "memory", "name": "memory3", "id": 3, "uniq_id": 87, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket0/memory3"}}}, {"id": "4", "metadata": {"type": "socket", "basename": "socket", "name": "socket0", "id": 0, "uniq_id": 4, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket0"}}}, {"id": "39", "metadata": {"type": "core", "basename": "core", "name": "core31", "id": 31, "uniq_id": 39, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core31"}}}, {"id": "40", "metadata": {"type": "core", "basename": "core", "name": "core32", "id": 32, "uniq_id": 40, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core32"}}}, {"id": "41", "metadata": {"type": "core", "basename": "core", "name": "core33", "id": 33, "uniq_id": 41, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core33"}}}, {"id": "42", "metadata": {"type": "core", "basename": "core", "name": "core34", "id": 34, "uniq_id": 42, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core34"}}}, {"id": "43", "metadata": {"type": "core", "basename": "core", "name": "core35", "id": 35, "uniq_id": 43, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/core35"}}}, {"id": "81", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu1", "id": 1, "uniq_id": 81, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1/gpu1"}}}, {"id": "89", "metadata": {"type": "memory", "basename": "memory", "name": "memory5", "id": 5, "uniq_id": 89, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket1/memory5"}}}, {"id": "90", "metadata": {"type": "memory", "basename": "memory", "name": "memory6", "id": 6, "uniq_id": 90, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket1/memory6"}}}, {"id": "91", "metadata": {"type": "memory", "basename": "memory", "name": "memory7", "id": 7, "uniq_id": 91, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node0/socket1/memory7"}}}, {"id": "5", "metadata": {"type": "socket", "basename": "socket", "name": "socket1", "id": 1, "uniq_id": 5, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0/socket1"}}}, {"id": "2", "metadata": {"type": "node", "basename": "node", "name": "node0", "id": 0, "uniq_id": 2, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node0"}}}, {"id": "57", "metadata": {"type": "core", "basename": "core", "name": "core13", "id": 13, "uniq_id": 57, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core13"}}}, {"id": "58", "metadata": {"type": "core", "basename": "core", "name": "core14", "id": 14, "uniq_id": 58, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core14"}}}, {"id": "59", "metadata": {"type": "core", "basename": "core", "name": "core15", "id": 15, "uniq_id": 59, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core15"}}}, {"id": "60", "metadata": {"type": "core", "basename": "core", "name": "core16", "id": 16, "uniq_id": 60, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core16"}}}, {"id": "61", "metadata": {"type": "core", "basename": "core", "name": "core17", "id": 17, "uniq_id": 61, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/core17"}}}, {"id": "82", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu0", "id": 0, "uniq_id": 82, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0/gpu0"}}}, {"id": "93", "metadata": {"type": "memory", "basename": "memory", "name": "memory1", "id": 1, "uniq_id": 93, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket0/memory1"}}}, {"id": "94", "metadata": {"type": "memory", "basename": "memory", "name": "memory2", "id": 2, "uniq_id": 94, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket0/memory2"}}}, {"id": "95", "metadata": {"type": "memory", "basename": "memory", "name": "memory3", "id": 3, "uniq_id": 95, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket0/memory3"}}}, {"id": "6", "metadata": {"type": "socket", "basename": "socket", "name": "socket0", "id": 0, "uniq_id": 6, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket0"}}}, {"id": "75", "metadata": {"type": "core", "basename": "core", "name": "core31", "id": 31, "uniq_id": 75, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core31"}}}, {"id": "76", "metadata": {"type": "core", "basename": "core", "name": "core32", "id": 32, "uniq_id": 76, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core32"}}}, {"id": "77", "metadata": {"type": "core", "basename": "core", "name": "core33", "id": 33, "uniq_id": 77, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core33"}}}, {"id": "78", "metadata": {"type": "core", "basename": "core", "name": "core34", "id": 34, "uniq_id": 78, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core34"}}}, {"id": "79", "metadata": {"type": "core", "basename": "core", "name": "core35", "id": 35, "uniq_id": 79, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/core35"}}}, {"id": "83", "metadata": {"type": "gpu", "basename": "gpu", "name": "gpu1", "id": 1, "uniq_id": 83, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1/gpu1"}}}, {"id": "97", "metadata": {"type": "memory", "basename": "memory", "name": "memory5", "id": 5, "uniq_id": 97, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket1/memory5"}}}, {"id": "98", "metadata": {"type": "memory", "basename": "memory", "name": "memory6", "id": 6, "uniq_id": 98, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket1/memory6"}}}, {"id": "99", "metadata": {"type": "memory", "basename": "memory", "name": "memory7", "id": 7, "uniq_id": 99, "rank": -1, "exclusive": true, "unit": "", "size": 2, "paths": {"containment": "/tiny0/rack0/node1/socket1/memory7"}}}, {"id": "7", "metadata": {"type": "socket", "basename": "socket", "name": "socket1", "id": 1, "uniq_id": 7, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1/socket1"}}}, {"id": "3", "metadata": {"type": "node", "basename": "node", "name": "node1", "id": 1, "uniq_id": 3, "rank": -1, "exclusive": true, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0/node1"}}}, {"id": "1", "metadata": {"type": "rack", "basename": "rack", "name": "rack0", "id": 0, "uniq_id": 1, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0/rack0"}}}, {"id": "0", "metadata": {"type": "cluster", "basename": "tiny", "name": "tiny0", "id": 0, "uniq_id": 0, "rank": -1, "exclusive": false, "unit": "", "size": 1, "paths": {"containment": "/tiny0"}}}], "edges": [{"source": "4", "target": "21", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "22", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "23", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "24", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "25", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "80", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "85", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "86", "metadata": {"name": {"containment": "contains"}}}, {"source": "4", "target": "87", "metadata": {"name": {"containment": "contains"}}}, {"source": "2", "target": "4", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "39", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "40", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "41", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "42", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "43", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "81", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "89", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "90", "metadata": {"name": {"containment": "contains"}}}, {"source": "5", "target": "91", "metadata": {"name": {"containment": "contains"}}}, {"source": "2", "target": "5", "metadata": {"name": {"containment": "contains"}}}, {"source": "1", "target": "2", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "57", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "58", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "59", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "60", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "61", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "82", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "93", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "94", "metadata": {"name": {"containment": "contains"}}}, {"source": "6", "target": "95", "metadata": {"name": {"containment": "contains"}}}, {"source": "3", "target": "6", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "75", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "76", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "77", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "78", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "79", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "83", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "97", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "98", "metadata": {"name": {"containment": "contains"}}}, {"source": "7", "target": "99", "metadata": {"name": {"containment": "contains"}}}, {"source": "3", "target": "7", "metadata": {"name": {"containment": "contains"}}}, {"source": "1", "target": "3", "metadata": {"name": {"containment": "contains"}}}, {"source": "0", "target": "1", "metadata": {"name": {"containment": "contains"}}}]}}

at: 0
error: 0
Errors so far:


----Match Allocate output---
jobid: 2
reserved: false
allocated:
at: 0
error: 0
Cancel output: 0
Info output jobid 1: false, 0, 0.000000, CANCELED, 0
Info output jobid 2: false, 0, 0.000000, 0
35 changes: 35 additions & 0 deletions t/t9001-golang-basic.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

test_description='Test Golang Bindings On Tiny Machine Configuration'

. $(dirname $0)/sharness.sh

if test -z "$WITH_GO"; then
skip_all='skipping Golang tests since WITH_GO not set'
test_done
fi

if ! which go >/dev/null; then
skip_all='skipping Golang tests since no go executable found'
test_done
fi

exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/golang"
jgf="${SHARNESS_TEST_SRCDIR}/data/resource/jgfs/tiny.json"
jobspec1="${SHARNESS_TEST_SRCDIR}/data/resource/jobspecs/basics/test001.yaml"
jobspec2="${SHARNESS_TEST_SRCDIR}/data/resource/jobspecs/basics/test003.yaml"
main="../../resource/reapi/bindings/go/src/test/main"

test001_desc="match allocate 1 slot: 1 socket: 1 core (pol=default)"
test_expect_success "${test001_desc}" '
${main} --jgf=${jgf} --jobspec=${jobspec1} > 001.R.out &&
test_cmp 001.R.out ${exp_dir}/001.R.out
'

test002_desc="match allocate 2 slots: 2 sockets: 5 cores 1 gpu 6 memory"
test_expect_success "${test002_desc}" '
${main} --jgf=${jgf} --jobspec=${jobspec2} > 002.R.out &&
test_cmp 002.R.out ${exp_dir}/002.R.out
'

test_done

0 comments on commit c20401f

Please sign in to comment.