diff --git a/contribs/perlapi/libslurm-perl/Makefile.PL.in b/contribs/perlapi/libslurm-perl/Makefile.PL.in index 0a8985101ce1c73047fbbe18b6b194c76f95059d..3b7c60ea31a200faa5ff30b1a2d35cdce1db351d 100644 --- a/contribs/perlapi/libslurm-perl/Makefile.PL.in +++ b/contribs/perlapi/libslurm-perl/Makefile.PL.in @@ -77,8 +77,8 @@ DESTDIR_BUG # AIX has problems with not always having the correct # flags so we have to add some :) my $os = lc(`uname`); -my $other_ld_flags = ""; -$other_ld_flags = "-brtl -G -bnoentry -bgcbypass:1000 -bexpfull" +my $other_ld_flags = "-Wl,-rpath,@top_builddir@/src/api/.libs -Wl,-rpath,@prefix@/lib"; +$other_ld_flags = " -brtl -G -bnoentry -bgcbypass:1000 -bexpfull" if $os =~ "aix"; WriteMakefile( diff --git a/contribs/torque/qstat.pl b/contribs/torque/qstat.pl index 5a8ae0fd736fdf751b9afe442903934a56af854f..8b53967f459f2aee79dcfab77abec66f320f98ac 100755 --- a/contribs/torque/qstat.pl +++ b/contribs/torque/qstat.pl @@ -343,7 +343,7 @@ sub job_time_used if (($job->{'job_state'} == JOB_RUNNING) || ($job->{'end_time'} == 0)) { - $end_time = localtime; + $end_time = time; } else { $end_time = $job->{'end_time'}; } diff --git a/testsuite/expect/README b/testsuite/expect/README index a06b7ddfe2c9d4f517454db425166544b9f07c4e..e9bc15eb00f45d248be5dcbc68e317c4fc481f88 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -480,3 +480,11 @@ test19.5 strigger --set (job options) test19.6 strigger --clear and --get (with filtering) test19.7 strigger --set --idle + +test20.# Testing of PBS commands and Perl APIs. +================================================= +test20.1 qsub command tests +test20.2 qstat command tests +test20.3 qdel command tests +test20.4 pbsnodes command tests + diff --git a/testsuite/expect/globals b/testsuite/expect/globals index e0a8e95fba00f436bcf30e9d4a248e859679850d..69824c600d40bd33eab328362867a3e7e91db176 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -67,6 +67,11 @@ cset squeue "${slurm_dir}/bin/squeue" cset srun "${slurm_dir}/bin/srun" cset strigger "${slurm_dir}/bin/strigger" +cset pbsnodes "${slurm_dir}/bin/pbsnodes" +cset qdel "${slurm_dir}/bin/qdel" +cset qstat "${slurm_dir}/bin/qstat" +cset qsub "${slurm_dir}/bin/qsub" + # If length of string partition is zero, use output of function # default_partition, otherwise use the partition explicitly # named in your globals.local file (or below) for poe commands diff --git a/testsuite/expect/test20.1 b/testsuite/expect/test20.1 new file mode 100755 index 0000000000000000000000000000000000000000..70d7f1e6da4aa0672bf9035f94234b54eb83036a --- /dev/null +++ b/testsuite/expect/test20.1 @@ -0,0 +1,115 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# qsub command tests +# +# 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) 2007 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-226842. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "20.1" +set exit_code 0 +set file_err "test$test_id.error" +set file_in "test$test_id.input" +set file_out "test$test_id.output" + +print_header $test_id + +if {[file executable $qsub] == 0} { + send_user "\nWARNING: $qsub not found\n" + exit 0 +} + +set job_id 0 +exec rm -f $file_out $file_err +make_bash_script $file_in "$bin_echo HELLO; $bin_cat /dummy_file" +spawn $qsub -e $file_err -o $file_out $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: qsub not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: qsub failed to submit job\n" + exit 1 +} + +if {[wait_for_file $file_out] != 0} { + send_user "\nFAILURE: qsub output file not found\n" + catch {exec $qdel $job_id} + exit 1 +} +set matches 0 +spawn $bin_cat $file_out +expect { + -re "HELLO" { + incr matches + exp_continue + } + eof { + wait + } +} +if {$matches != 1} { + send_user "\nFAILURE: unexpected qsub output file contents\n" + set exit_code 1 +} + +if {[wait_for_file $file_err] != 0} { + send_user "\nFAILURE: qsub error file not found\n" + catch {exec $qdel $job_id} + exit 1 +} +set matches 0 +spawn $bin_cat $file_err +expect { + -re "No such file" { + incr matches + exp_continue + } + eof { + wait + } +} +if {$matches != 1} { + send_user "\nFAILURE: unexpected qsub error file contents\n" + set exit_code 1 +} + +if {$exit_code == 0} { + exec $bin_rm -f $file_in $file_out $file_err + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test20.2 b/testsuite/expect/test20.2 new file mode 100755 index 0000000000000000000000000000000000000000..9caca3a3a95f484cf24827bd2b9a0c9987479635 --- /dev/null +++ b/testsuite/expect/test20.2 @@ -0,0 +1,101 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# qstat command tests +# +# 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) 2007 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-226842. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "20.2" +set exit_code 0 +set file_in "test$test_id.input" +set file_out "test$test_id.output" +set job_name "test$test_id" + +print_header $test_id + +if {[file executable $qsub] == 0} { + send_user "\nWARNING: $qsub does not exists\n" + exit 0 +} +if {[file executable $qstat] == 0} { + send_user "\nWARNING: $qstat does not exists\n" + exit 0 +} +if {[file executable $qdel] == 0} { + send_user "\nWARNING: $qdel does not exists\n" + exit 0 +} + +set job_id 0 +make_bash_script $file_in "sleep 60" +spawn $qsub -o $file_out -N $job_name $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: qsub not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: qsub failed to submit job\n" + exit 1 +} + +set matches 0 +spawn $qstat $job_id +expect { + -re "$job_name" { + incr matches + exp_continue + } + timeout { + send_user "\nFAILURE: qstat not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$matches != 1} { + send_user "\nFAILURE: qstat failed to report job\n" + set exit_code 1 +} +catch {exec $qdel $job_id} + +if {$exit_code == 0} { + exec $bin_rm -f $file_in $file_out + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test20.3 b/testsuite/expect/test20.3 new file mode 100755 index 0000000000000000000000000000000000000000..e564f6f5ce157c5247359a754a43857bb674b2bf --- /dev/null +++ b/testsuite/expect/test20.3 @@ -0,0 +1,112 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# qdel command tests +# +# 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) 2007 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-226842. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "20.3" +set exit_code 0 +set file_in "test$test_id.input" +set file_out "test$test_id.output" + +print_header $test_id + +if {[file executable $qsub] == 0} { + send_user "\nWARNING: $qsub does not exists\n" + exit 0 +} +if {[file executable $qdel] == 0} { + send_user "\nWARNING: $qdel does not exists\n" + exit 0 +} + +set job_id 0 +make_bash_script $file_in "sleep 60" +spawn $qsub -o $file_out $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: qsub not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: qsub failed to submit job\n" + exit 1 +} + +spawn $qdel $job_id +expect { + -re "Invalid job id" { + send_user "\nFAILURE: qdel failed to delete job\n" + set exit_code 1 + exp_continue + } + timeout { + send_user "\nFAILURE: qdel not responding\n" + set exit_code 1 + } + eof { + wait + } +} + +set matches 0 +spawn $qdel $job_id +expect { + -re "already completing or completed" { + send_user "\nThis error was expected, no worries\n" + incr matches + exp_continue + } + timeout { + send_user "\nFAILURE: qdel not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$matches != 1} { + send_user "\nFAILURE: No error on attempt to cancel terminated job\n" + set exit_code 1 +} + +if {$exit_code == 0} { + exec $bin_rm -f $file_in $file_out + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test20.4 b/testsuite/expect/test20.4 new file mode 100755 index 0000000000000000000000000000000000000000..35917f0afd38d46437121ba6b6b88e6bc42bb451 --- /dev/null +++ b/testsuite/expect/test20.4 @@ -0,0 +1,72 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# pbsnodes command tests +# +# 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) 2007 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-226842. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "20.4" +set exit_code 0 + +print_header $test_id + +if {[file executable $pbsnodes] == 0} { + send_user "\nWARNING: $pbsnodes does not exists\n" + exit 0 +} + +set match_state 0 +set match_pcpus 0 +spawn $pbsnodes +expect { + -re "state" { + incr match_state + exp_continue + } + -re "pcpus" { + incr match_pcpus + exp_continue + } + timeout { + send_user "\nFAILURE: pbsnodes not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {($match_state == 0) || ($match_pcpus == 0)} { + send_user "\nFAILURE: pbsnodes output failure\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code