Skip to content
Snippets Groups Projects
Commit ac574622 authored by Moe Jette's avatar Moe Jette
Browse files

test specifying different --workdir for the program and make sure

the stdout/err files get created there rather than the submit 
directory.
parent d2d014bb
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ source ./globals
set test_id "17.5"
set file_in "test$test_id.input"
set file_script "test$test_id.bash"
set file_out "test$test_id.output"
set file_err "test$test_id.error"
set file_out_j "test$test_id.j.%j.output"
......@@ -46,13 +47,66 @@ print_header $test_id
# Delete left-over stdin/out/err files
# Build stdin file
#
exec $bin_rm -f $file_in $file_out $file_err
exec $bin_rm -f $file_in $file_script $file_out $file_err
make_bash_script $file_in "
$bin_id
$bin_sleep aaa
exit 0
"
set cwd "[$bin_pwd]"
make_bash_script $file_script "
cd /tmp
$sbatch -N1 --workdir=$cwd --output=$file_out --error=$file_err -t1 $cwd/$file_in
exit 0
"
#
# Spawn a shell via sbatch that submits from a different directory and uses stdout/err
# and confirm their contents
#
set job_id 0
spawn $file_script
expect {
-re "Submitted batch job ($number)" {
set job_id $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: sbatch not responding\n"
set exit_code 1
exp_continue
}
eof {
wait
}
}
if { $job_id == 0 } {
send_user "\nFAILURE: failed to submit job\n"
exit 1
}
#
# Wait for job to complete
#
if {[wait_for_job $job_id "DONE"] != 0} {
send_user "\nFAILURE: waiting for job to complete\n"
set exit_code 1
}
#
# Check for desired output
#
if {[wait_for_file $file_out] != 0} {
send_user "\nFAILURE: Missing stdout\n"
set exit_code 1
}
if {[wait_for_file $file_err] != 0} {
send_user "\nFAILURE: Missing stderr\n"
set exit_code 1
}
exec $bin_rm -f $file_script $file_out $file_err
#
# Spawn a shell via sbatch that uses stdout/err and confirm their contents
#
......@@ -227,7 +281,7 @@ if { [file exists $file_err2] } {
}
if {$exit_code == 0} {
exec $bin_rm -f $file_in $file_out $file_err
exec $bin_rm -f $file_in $file_script $file_out $file_err
send_user "\nSUCCESS\n"
}
exit $exit_code
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment