View | Details | Raw Unified | Return to ticket 886 | Differences between
and this patch

Collapse All | Expand All

(-)a/testsuite/expect/Makefile.am (+1 lines)
Lines 375-380 EXTRA_DIST = \ Link Here
375
	test17.32			\
375
	test17.32			\
376
	test17.33			\
376
	test17.33			\
377
	test17.34			\
377
	test17.34			\
378
	test17.37			\
378
	test19.1			\
379
	test19.1			\
379
	test19.2			\
380
	test19.2			\
380
	test19.3			\
381
	test19.3			\
(-)a/testsuite/expect/Makefile.in (+1 lines)
Lines 759-764 EXTRA_DIST = \ Link Here
759
	test17.32			\
759
	test17.32			\
760
	test17.33			\
760
	test17.33			\
761
	test17.34			\
761
	test17.34			\
762
	test17.37			\
762
	test19.1			\
763
	test19.1			\
763
	test19.2			\
764
	test19.2			\
764
	test19.3			\
765
	test19.3			\
(-)a/testsuite/expect/README (+1 lines)
Lines 544-549 test17.32 Test of --overcommit option. Link Here
544
test17.33  Test of --open-mode option.
544
test17.33  Test of --open-mode option.
545
test17.34  Test of --core-spec option.
545
test17.34  Test of --core-spec option.
546
test17.35  Test performance/timing of job submissions.
546
test17.35  Test performance/timing of job submissions.
547
test17.37  Validate that afternotok dependency is enforced.
547
548
548
549
549
test19.#   Testing of strigger options.
550
test19.#   Testing of strigger options.
(-)a/testsuite/expect/test17.37 (+141 lines)
Line 0 Link Here
1
#!/usr/bin/expect
2
############################################################################
3
# Purpose: Test of SLURM functionality
4
#          Validates that the afternotok dependency is enforced
5
#          when a job runs to completion
6
#
7
#
8
# Output:  "TEST: #.#" followed by "SUCCESS" if test was successful, OR
9
#          "FAILURE: ..." otherwise with an explanation of the failure, OR
10
#          anything else indicates a failure mode that must be investigated.
11
############################################################################
12
# Copyright (C) 2014 SchedMD LLC
13
# Written by Nathan Yee <nyee32@schedmd.com>
14
#
15
# This file is part of SLURM, a resource management program.
16
# For details, see <http://slurm.schedmd.com/>.
17
# Please also read the included file: DISCLAIMER.
18
#
19
# SLURM is free software; you can redistribute it and/or modify it under
20
# the terms of the GNU General Public License as published by the Free
21
# Software Foundation; either version 2 of the License, or (at your option)
22
# any later version.
23
#
24
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
25
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
26
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
27
# details.
28
#
29
# You should have received a copy of the GNU General Public License along
30
# with SLURM; if not, write to the Free Software Foundation, Inc.,
31
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
32
############################################################################
33
source ./globals
34
35
set test_id       17.37
36
set job_id1       0
37
set job_id2       0
38
set script        "test$test_id\_sc"
39
set exit_code     0
40
41
print_header $test_id
42
43
make_bash_script $script "sleep 10"
44
45
# Submit a job to depend on
46
spawn $sbatch -t1 -N2 -o/dev/null $script
47
expect {
48
	-re "Submitted batch job ($number)" {
49
		set job_id1 $expect_out(1,string)
50
		exp_continue
51
	}
52
	timeout {
53
		send_user "\nFAILURE: sbatch is not responding\n"
54
		set exit_code 1
55
	}
56
	eof {
57
		wait
58
	}
59
}
60
61
if { $job_id1 == 0 } {
62
	send_user "\nFAILURE: sbatch did not submit job\n"
63
	exit 1
64
}
65
66
# Submit a job that depends on job above
67
spawn $sbatch -t1 -N2 -dafternotok:$job_id1 -o/dev/null $script
68
expect {
69
	-re "Submitted batch job ($number)" {
70
		set job_id2 $expect_out(1,string)
71
		exp_continue
72
	}
73
	timeout {
74
		send_user "\nFAILURE: sbatch is not responding\n"
75
		set exit_code 1
76
	}
77
	eof {
78
		wait
79
	}
80
}
81
82
if { $job_id2 == 0 } {
83
	send_user "\nFAILURE: sbatch did not submit job\n"
84
	exit 1
85
}
86
87
wait_for_job $job_id1 DONE
88
89
# Check exit code of the first job
90
set match 0
91
spawn $scontrol show job $job_id1
92
expect {
93
	-re "ExitCode=0:0" {
94
		set match 1
95
		exp_continue
96
	}
97
	timeout {
98
		send_user "\nFAILURE: scontrol is not responding\n"
99
		set exit_code 1
100
	}
101
	eof {
102
		wait
103
	}
104
}
105
106
if { $match != 1 } {
107
	send_user "\nFAILURE: job $job_id1 did not exit with exit code 0\n"
108
	set exit_code 1
109
}
110
111
# Check that the job with dependency is in the correct state and has correct
112
# reason
113
set match 0
114
spawn $squeue --job=$job_id2 -o%t|%r --noheader
115
expect {
116
	-re "PD|DependencyNeverSatisfied" {
117
		incr match 1
118
		exp_continue
119
	}
120
	timeout {
121
		send_user "\nFAILURE: squeue is not responding\n"
122
		set exit_code 1
123
	}
124
	eof {
125
		wait
126
	}
127
}
128
129
if { $match != 2 } {
130
	send_user "\nFAILURE: job $job_id2 should be in pending state and "
131
	send_user "should have DependencyNeverSatisfied for a reason\n"
132
	set exit_code 1
133
}
134
135
cancel_job $job_id2
136
137
if {$exit_code == 0} {
138
	exec $bin_rm -f $script
139
	send_user "\nSUCCESS\n"
140
}
141
exit $exit_code

Return to ticket 886