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 382-387 EXTRA_DIST = \ Link Here
382
	test17.33			\
382
	test17.33			\
383
	test17.34			\
383
	test17.34			\
384
	test17.36			\
384
	test17.36			\
385
	test17.37			\
385
	test19.1			\
386
	test19.1			\
386
	test19.2			\
387
	test19.2			\
387
	test19.3			\
388
	test19.3			\
(-)a/testsuite/expect/Makefile.in (+1 lines)
Lines 766-771 EXTRA_DIST = \ Link Here
766
	test17.33			\
766
	test17.33			\
767
	test17.34			\
767
	test17.34			\
768
	test17.36			\
768
	test17.36			\
769
	test17.37			\
769
	test19.1			\
770
	test19.1			\
770
	test19.2			\
771
	test19.2			\
771
	test19.3			\
772
	test19.3			\
(-)a/testsuite/expect/README (+1 lines)
Lines 550-555 test17.33 Test of --open-mode option. Link Here
550
test17.34  Test of --core-spec option.
550
test17.34  Test of --core-spec option.
551
test17.35  Test performance/timing of job submissions.
551
test17.35  Test performance/timing of job submissions.
552
test17.36  Test that the shared option in partitions is enforced.
552
test17.36  Test that the shared option in partitions is enforced.
553
test17.37  Validate that afternotok dependency is enforced.
553
554
554
555
555
test19.#   Testing of strigger options.
556
test19.#   Testing of strigger options.
(-)a/testsuite/expect/test17.37 (+146 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
wait_for_job $job_id1 RUNNING
67
68
# Submit a job that depends on job above
69
spawn $sbatch -t1 -N2 -dafternotok:$job_id1 -o/dev/null $script
70
expect {
71
	-re "Submitted batch job ($number)" {
72
		set job_id2 $expect_out(1,string)
73
		exp_continue
74
	}
75
	timeout {
76
		send_user "\nFAILURE: sbatch is not responding\n"
77
		set exit_code 1
78
	}
79
	eof {
80
		wait
81
	}
82
}
83
84
if { $job_id2 == 0 } {
85
	send_user "\nFAILURE: sbatch did not submit job\n"
86
	exit 1
87
}
88
89
wait_for_job $job_id1 DONE
90
91
# Check exit code of the first job
92
set match 0
93
spawn $scontrol show job $job_id1
94
expect {
95
	-re "ExitCode=0:0" {
96
		set match 1
97
		exp_continue
98
	}
99
	timeout {
100
		send_user "\nFAILURE: scontrol is not responding\n"
101
		set exit_code 1
102
	}
103
	eof {
104
		wait
105
	}
106
}
107
108
if { $match != 1 } {
109
	send_user "\nFAILURE: job $job_id1 did not exit with exit code 0\n"
110
	set exit_code 1
111
}
112
113
# Wait for job 2 reason to populate
114
sleep 10
115
116
# Check that the job with dependency is in the correct state and has correct
117
# reason
118
set match 0
119
spawn $squeue --job=$job_id2 -o"%t|%r" --noheader
120
expect {
121
	-re "PD|DependencyNeverSatisfied" {
122
		incr match 1
123
		exp_continue
124
	}
125
	timeout {
126
		send_user "\nFAILURE: squeue is not responding\n"
127
		set exit_code 1
128
	}
129
	eof {
130
		wait
131
	}
132
}
133
134
if { $match != 2 } {
135
	send_user "\nFAILURE: job $job_id2 should be in pending state and "
136
	send_user "should have DependencyNeverSatisfied for a reason\n"
137
	set exit_code 1
138
}
139
140
cancel_job $job_id2
141
142
if {$exit_code == 0} {
143
	exec $bin_rm -f $script
144
	send_user "\nSUCCESS\n"
145
}
146
exit $exit_code

Return to ticket 886