From ad28bc3856847c7b96ead04ba2e99ca90ceace7a Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 4 Aug 2006 22:01:00 +0000 Subject: [PATCH] Fix some bad logic to handle srun --debug= option add tests for slaunch --debug and --verbose options --- testsuite/expect/README | 3 +- testsuite/expect/test1.10 | 33 ++++++------------ testsuite/expect/test18.6 | 71 +++++++++++++++++++++++++++++++++++++++ testsuite/expect/test18.7 | 68 +++++++++++++++++++++++++++++++++++++ 4 files changed, 151 insertions(+), 24 deletions(-) create mode 100755 testsuite/expect/test18.6 create mode 100755 testsuite/expect/test18.7 diff --git a/testsuite/expect/README b/testsuite/expect/README index b4b81e2637b..a0d6b058144 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -405,7 +405,6 @@ test17.TBD Test of partition specification on job submission (--partition **NOTE** The above tests for mutliple processor/partition systems only - test18.# Testing of slaunch options. ====================================== test18.1 Confirm slaunch usage option works (--usage option). @@ -417,4 +416,6 @@ test18.4 Confirm that a job executes with the proper task count (--nprocs test18.5 Confirm that slauch local stdin, stdout, and stderr options work (options --local-input, --local-output and --local-error respectively). +test18.6 Test of slaunch verbose mode (-v option). +test18.7 Test of srun/slurmd debug mode (--debug option). diff --git a/testsuite/expect/test1.10 b/testsuite/expect/test1.10 index 3419822be29..9a6d71b5697 100755 --- a/testsuite/expect/test1.10 +++ b/testsuite/expect/test1.10 @@ -1,6 +1,5 @@ #!/usr/bin/expect ############################################################################ -# # Purpose: Test of SLURM functionality # Test of srun/slurmd debug mode (-d option). # @@ -8,7 +7,7 @@ # "FAILURE: ..." otherwise with an explanation of the failure, OR # anything else indicates a failure mode that must be investigated. ############################################################################ -# Copyright (C) 2002 The Regents of the University of California. +# Copyright (C) 2002-2006 The Regents of the University of California. # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). # Written by Morris Jette <jette1@llnl.gov> # UCRL-CODE-217948. @@ -33,34 +32,22 @@ source ./globals set test_id "1.10" -set debug_level 0 +set debug_get 0 +set debug_set 4 set exit_code 0 print_header $test_id # # Submit a slurm job that will bogus executable -# Set debug level to 3 (above default value of 2, net is 5) +# Debug debug level is 2, value set with --debug has that offset # +set debug_offset [expr $debug_set - 2] set timeout $max_job_delay -spawn $srun -N1 -d3 -t1 /invalid_executable +spawn $srun -N1 -d$debug_offset -t1 /invalid_executable expect { - -re "debug3" { - if { $debug_level < 7 } { - set debug_level 7 - } - exp_continue - } - -re "debug2" { - if { $debug_level < 6 } { - set debug_level 6 - } - exp_continue - } - -re "debug " { - if { $debug_level < 5 } { - set debug_level 5 - } + -re "debug level = ($number)" { + set debug_get $expect_out(1,string) exp_continue } timeout { @@ -71,8 +58,8 @@ expect { } } -if {$debug_level != 5} { - send_user "\nFAILURE: Did not log at proper level ($debug_level)\n" +if {$debug_get != $debug_set} { + send_user "\nFAILURE: Did not log at proper level ($debug_get != $debug_set)\n" set exit_code 1 } if {$exit_code == 0} { diff --git a/testsuite/expect/test18.6 b/testsuite/expect/test18.6 new file mode 100755 index 00000000000..cd46251de45 --- /dev/null +++ b/testsuite/expect/test18.6 @@ -0,0 +1,71 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test of slaunch verbose mode (-v 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) 2002 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-217948. +# +# 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 "18.6" +set exit_code 0 +set verbosity 0 + +print_header $test_id + +# +# Submit a slurm job that will execute 'id' on 1 node and over task_cnt tasks +# +set timeout $max_job_delay +spawn $salloc -N1 -t1 $slaunch -vv $bin_hostname +expect { + -re "debug:" { + set verbosity 1 + exp_continue + } + -re "Unable to contact" { + send_user "\nFAILURE: slurm appears to be down\n" + exit 1 + } + timeout { + send_user "\nFAILURE: slurm not responding\n" + kill_salloc + set exit_code 1 + exp_continue + } + eof { + wait + } +} +if {$verbosity != 1} { + send_user "\nFAILURE: Did not report debug message verbosity on\n" + set exit_code 1 +} +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.7 b/testsuite/expect/test18.7 new file mode 100755 index 00000000000..0578cff48fa --- /dev/null +++ b/testsuite/expect/test18.7 @@ -0,0 +1,68 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test of slaunch debug mode (-d 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) 2002-2006 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-217948. +# +# 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 "18.7" +set debug_get 0 +set debug_set 4 +set exit_code 0 + +print_header $test_id + +# +# Submit a slurm job that will bogus executable +# Debug debug level is 2, value set with --debug has that offset +# +set debug_offset [expr $debug_set - 2] +set timeout $max_job_delay +spawn $salloc -N1 -t1 $slaunch -d$debug_offset /invalid_executable +expect { + -re "debug level = ($number)" { + set debug_get $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + kill_salloc + set exit_code 1 + exp_continue + } +} + +if {$debug_get != $debug_set} { + send_user "\nFAILURE: Did not log at proper level ($debug_get != $debug_set)\n" + set exit_code 1 +} +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code -- GitLab