TESTS="basic with_arguments"

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

cp ${SRCDIR}/basic-script.sh expected_lrms_job_script.tmpl

function test_post_check() {
  # Check diag file
  diagfilename="controldir/job.basic.diag"
  if test ! -f ${diagfilename}; then
    echo "Post check failed: Diag file (${diagfilename}) is missing."
    return 1
  fi
  
  . ${diagfilename}
  if test "x${Processors}" != "x1"; then
    echo "Post check failed: In diag file: Processors was expected to be \"1\", but it was \"${Processors}\"."
    return 1
  fi
  
  return 0
}
}

# TODO: Use more sophisticated arguments.
function test_with_arguments() {
read -r -d '' job_description_input <<'EOF'
&(executable = "/bin/echo")
 (arguments = "Hello World")
EOF

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