TESTS="cputime walltime walltime_and_cputime walltime_count cputime_count "

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_cputime() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/true")
 (cputime = 1)
EOF

cat "${SRCDIR}/cpu-wall-time-test-cputime.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}

function test_walltime() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/true")
 (walltime = 1)
EOF

cat "${SRCDIR}/cpu-wall-time-test-walltime.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}

function test_walltime_and_cputime() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/true")
 (walltime = 5)
 (cputime = 1)
EOF

cat "${SRCDIR}/cpu-wall-time-test-walltime_and_cputime.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}

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

cat "${SRCDIR}/cpu-wall-time-test-walltime_count.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}

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

cat "${SRCDIR}/cpu-wall-time-test-cputime_count.patch" | patch -sf -p1 -d ${SRCDIR} -o ${testdir}/expected_lrms_job_script.tmpl
}
