TESTS="count count_per_node exclusive"

simulate_cmds="sbatch rm" # Simulate rm in order not to get job script deleted
read -r -d '' simulator_output <<'EOF'
rargs="/sbatch .*/"
output="Submitted batch job 1"

rargs="/rm .*/"
output=""
EOF

read -r -d '' general_arc_test_configuration <<EOF
[lrms]
slurm_bin_path=@PWD@/bin
EOF

function test_count() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/true")
 (count = 6)
EOF

cat "${SRCDIR}/count-test-count.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl

function test_post_check() {
  return 0
}
}

function test_count_per_node() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/true")
 (count = 6)
 (countpernode = 2)
EOF

cat "${SRCDIR}/count-test-count_per_node.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}

function test_exclusive() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/true")
 (count = 6)
 (exclusiveexecution = "yes")
EOF

cat "${SRCDIR}/count-test-exclusive.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}
