File: test7.14

package info (click to toggle)
slurm-wlm 22.05.8-4%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 48,492 kB
  • sloc: ansic: 475,246; exp: 69,020; sh: 8,862; javascript: 6,528; python: 6,444; makefile: 4,185; perl: 4,069; pascal: 131
file content (100 lines) | stat: -rwxr-xr-x 3,740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env expect
############################################################################
# Purpose: Verify the ability to modify the Derived Exit Code and Comment
#          fields of a job record in the database.
############################################################################
# Copyright (C) 2010 Lawrence Livermore National Security.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Don Lipari <lipari1@llnl.gov>
# CODE-OCEC-09-009. All rights reserved.
#
# This file is part of Slurm, a resource management program.
# For details, see <https://slurm.schedmd.com/>.
# 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 file_in          "$test_dir/input"
set file_prog1       "$test_name.prog1"
set file_prog2       "$test_name.prog2"

if {[get_config_param "AccountingStorageType"] ne "accounting_storage/slurmdbd"} {
	skip "This test can't be run without a usable AccountStorageType"
}

proc cleanup {} {
	global file_prog1 file_prog2

	file delete $file_prog1 $file_prog2
}

#
# Build programs
#
exec $bin_cc -O -o $file_prog1 ${file_prog1}.c
exec $bin_cc -O -o $file_prog2 ${file_prog2}.c

#
# Submit a script that returns a successful exit code and confirm that
# the job record's ExitCode reflects this value.  $file_prog1 returns a
# successful error code (0) and $file_prog2 returns an unsuccessful
# error code (123).
#
# The failed job step should have no influence on the job's ExitCode
# value.  However the DerivedExitCode value should be set to the
# highest value of all the job steps, in this case, 123.
#

make_bash_script $file_in "
  $bin_echo 'testing successful job return code'
  $srun $file_prog1
  $srun $file_prog2
  exit 0
"

set job_id [submit_job -fail "--output=/dev/null -t1 $file_in"]

#
# Wait for job to complete
#
wait_for_job -fail $job_id "DONE"

#
# Confirm correct ExitCode and DerivedExitCode settings in job record
#
set job_exit_code [get_job_param $job_id "ExitCode"]
subtest {$job_exit_code eq "0:0"} "Verify ExitCode in job record" "$job_exit_code != 0:0"
set derived_exit_code [get_job_param $job_id "DerivedExitCode"]
subtest {$derived_exit_code eq "123:0"} "Verify DerivedExitCode in job record" "$derived_exit_code != 123:0"

# Wait for the end time to be recorded in the accounting database
wait_for_job_acct -fail $job_id end

#
# Modify the DerivedExitCode and String of the job
#
set output [run_command -fail "$sacctmgr -i modify job job=$job_id set DerivedExitCode=22 Comment=hello"]
if {![regexp $job_id $output]} {
	fail "sacctmgr failed to change DerivedExitCode/Comment"
}

#
# Confirm the DerivedExitCode and String fields of the job record in the db
# matches the above modification and that ExitCode did not change.
#
set output [run_command_output -fail "$sacct -n -P -X -j $job_id -o ExitCode,DerivedExitCode,Comment"]
subtest [regexp {0:0\|0:22\|hello} $output] "Verify job record in the accounting database has the right exit codes"