#!/usr/bin/env expect ############################################################################ # Purpose: Test of Slurm functionality # Test for the qalter --man option # # Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR # "FAILURE: ..." otherwise with an explanation of the failure, OR # anything else indicates a failure mode that must be investigated. ############################################################################ # Copyright (C) 2013 SchedMD LLC # Written by Nathan Yee # # This file is part of Slurm, a resource management program. # For details, see . # Please also read the included file: DISCLAIMER. # # Slurm is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # Slurm is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with Slurm; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ############################################################################ source ./globals set test_id "20.9" set file_in "test$test_id.input" set file_out "test$test_id.output" set exit_code 0 print_header $test_id if {[file executable $qalter] == 0} { send_user "\nWARNING: $qalter does not exist\n" exit 0 } if {[file executable $bin_perldoc] == 0} { send_user "\nWARNING: $bin_perldoc does not exist\n" exit 0 } # If perl-doc isn't installed there is sometimes a useless perldoc script # waiting for you telling you it isn't installed. So we need to check for that. log_user 0 spawn $bin_perldoc expect { -re "You need to install the perl-doc" { send_user "\nWARNING: $bin_perldoc not installed\n" exit 0 } eof { wait } } log_user 1 exec $bin_rm -f $file_in $file_out make_bash_script $file_in "$qalter --man >$file_out" exec ./$file_in set matches 0 spawn $bin_cat $file_out expect { -re "alter a job name" { incr matches exp_continue } eof { wait } } if {$matches != 1} { send_user "\nFAILURE: qalter did not return the man pages ($matches != 1)\n" set exit_code 1 } if {$exit_code == 0} { exec $bin_rm -f $file_in $file_out send_user "\nSUCCESS\n" } exit $exit_code