Skip to content

Commit 09260f2

Browse files
committed
EH: CS-1484 testsuite error/warning/info mails shall contain the previous test run
1 parent 00460f1 commit 09260f2

File tree

2 files changed

+46
-36
lines changed

2 files changed

+46
-36
lines changed

src/check.exp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ set CHECK_HUDSON_STACKTRACE ""
406406
global CHECK_HIGH_JOBIDS
407407
set CHECK_HIGH_JOBIDS 0
408408

409+
global CHECK_PREVIOUS_TEST
410+
set CHECK_PREVIOUS_TEST "-"
411+
409412
global custom_checktree ;# For a custom checktree building, list of checks for which to build checktree
410413
set custom_checktree {}
411414

@@ -4943,6 +4946,7 @@ proc run_test {path state_to_run {run_single_test "all"} { send_mail_report 1 }
49434946
global check_set_ignore_dependencies
49444947
global ONLY_ONE_LEVEL
49454948
global CHECK_VALGRIND_STOP_ON_ERROR
4949+
global CHECK_PREVIOUS_TEST
49464950

49474951
# check if the state_to_run is valid
49484952
if {$state_to_run != "all" &&
@@ -5248,12 +5252,14 @@ proc run_test {path state_to_run {run_single_test "all"} { send_mail_report 1 }
52485252

52495253
if {$immediate_return != 0} {
52505254
set CHECK_TEST_RUNNING 0
5255+
set CHECK_PREVIOUS_TEST $check_name
52515256
ts_log_fine "immediate_return: $immediate_return"
52525257
return $immediate_return
52535258
}
52545259

52555260
if {$nr_already_done == $no_level_calls && $no_level_calls > 0} {
52565261
set CHECK_TEST_RUNNING 0
5262+
set CHECK_PREVIOUS_TEST $check_name
52575263
ts_log_fine "nr_already_done == no_level_calls ($nr_already_done == $no_level_calls)"
52585264
return 1 ;# was done time before
52595265
}
@@ -5292,9 +5298,11 @@ proc run_test {path state_to_run {run_single_test "all"} { send_mail_report 1 }
52925298
ts_log_info $mail_body 0 "" 0 0 1
52935299
}
52945300
set CHECK_TEST_RUNNING 0
5301+
set CHECK_PREVIOUS_TEST $check_name
52955302
return 0
52965303
} else {
52975304
set CHECK_TEST_RUNNING 0
5305+
set CHECK_PREVIOUS_TEST $check_name
52985306
if {$nr_errors == 0} {
52995307
if {$setup_ret == 99} {
53005308
# this means there was only ts_log_config. We will set the test to unsupported

src/tcl_files/logging.tcl

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#
2828
# All Rights Reserved.
2929
#
30-
# Portions of this software are Copyright (c) 2024 HPC-Gridware GmbH
30+
# Portions of this software are Copyright (c) 2024-2025 HPC-Gridware GmbH
3131
#
3232
##########################################################################
3333
#___INFO__MARK_END__
@@ -60,12 +60,12 @@
6060
# INFO: Info message (e.g. testsuite success messages, compile report, etc.)
6161
# FINE: what is now "puts $CHECK_OUTPUT", e.g. steps of a test, "adding pe xyz"
6262
# FINER: details of a test step
63-
# FINEST: debugging output, e.g. command output parsed in expect blocks,
63+
# FINEST: debugging output, e.g. command output parsed in expect blocks,
6464
# the commands to be sent to vi, etc.
6565
#
6666
# Logging is triggered by calling one of the logging functions
6767
# ts_log_severe, ts_log_warning, ... , ts_log_finest.
68-
#
68+
#
6969
# SEE ALSO
7070
# logging/ts_log_setup()
7171
# logging/ts_log_cleanup()
@@ -94,12 +94,12 @@
9494
# ts_log_setup() -- setup the logging framework
9595
#
9696
# SYNOPSIS
97-
# ts_log_setup { }
97+
# ts_log_setup { }
9898
#
9999
# FUNCTION
100100
# Initialize the logging internal data structures.
101101
# Setup default behavior of the logging framework:
102-
# Loglevel INFO for sending mail,
102+
# Loglevel INFO for sending mail,
103103
# FINE for output to stdout,
104104
# FINER for logging to file.
105105
#
@@ -137,7 +137,7 @@ proc ts_log_setup {} {
137137
# ts_log_cleanup() -- cleanup / shutdown the logging framework
138138
#
139139
# SYNOPSIS
140-
# ts_log_cleanup {}
140+
# ts_log_cleanup {}
141141
#
142142
# FUNCTION
143143
# Shutdown the logging framework:
@@ -162,7 +162,7 @@ proc ts_log_cleanup {} {
162162
# ts_log_set_level() -- set the output level for a certain media
163163
#
164164
# SYNOPSIS
165-
# ts_log_set_level {media level}
165+
# ts_log_set_level {media level}
166166
#
167167
# FUNCTION
168168
# Sets the level, up to which logging is done on a certain media.
@@ -215,7 +215,7 @@ proc ts_log_set_level {media level} {
215215
#*******************************************************************************
216216
proc ts_log_set_logfile {filename {mode "w"}} {
217217
global ts_log_logfile
218-
218+
219219
# close currently open logfile
220220
if {$ts_log_logfile != ""} {
221221
close $ts_log_logfile
@@ -236,7 +236,7 @@ proc ts_log_set_logfile {filename {mode "w"}} {
236236
#
237237
# FUNCTION
238238
# Do logging of a severe error message.
239-
#
239+
#
240240
# Severe error means, that with such an error, continuing the current
241241
# check will most probably fail, and doesn't make sense.
242242
# The current check shall be aborted (see NOTE).
@@ -267,7 +267,7 @@ proc ts_log_set_logfile {filename {mode "w"}} {
267267
# Testsuite will finish running the current check in the current runlevel,
268268
# but not enter the next runlevel.
269269
# When all checks are to be run, an installation (install re_init) will
270-
# be done once the current check finished, and the next check will be
270+
# be done once the current check finished, and the next check will be
271271
# started.
272272
#
273273
# SEE ALSO
@@ -649,7 +649,7 @@ proc ts_log_progress {{level FINE} {message "."} {isFinal 0}} {
649649
#*******************************************************************************
650650
proc ts_log_frame {{level FINE} {line ""}} {
651651
global ts_log_config
652-
652+
653653
set level [ts_log_get_level_number $level]
654654
if {$ts_log_config(output) >= $level} {
655655
if {$line == ""} {
@@ -680,7 +680,7 @@ proc ts_log_frame {{level FINE} {line ""}} {
680680
#*******************************************************************************
681681
proc ts_log_newline {{level FINE}} {
682682
global ts_log_config
683-
683+
684684
set level [ts_log_get_level_number $level]
685685
if {$ts_log_config(output) >= $level} {
686686
puts ""
@@ -695,7 +695,7 @@ proc ts_log_newline {{level FINE}} {
695695
# ts_log_heading() -- log a heading
696696
#
697697
# SYNOPSIS
698-
# ts_log_heading { msg {level FINE} }
698+
# ts_log_heading { msg {level FINE} }
699699
#
700700
# FUNCTION
701701
#
@@ -708,7 +708,7 @@ proc ts_log_newline {{level FINE}} {
708708
# A new line is prepended.
709709
#
710710
# INPUTS
711-
# msg - the log message
711+
# msg - the log message
712712
# {level FINE} - the log level (default is FINE)
713713
#
714714
# RESULT
@@ -731,7 +731,7 @@ proc ts_log_heading { msg {level FINE} } {
731731
# ts_log_init_level_map() -- internal function - initialize datastructures
732732
#
733733
# SYNOPSIS
734-
# ts_log_init_level_map {}
734+
# ts_log_init_level_map {}
735735
#
736736
# FUNCTION
737737
# Initializes the ts_log_level_map.
@@ -772,7 +772,7 @@ proc ts_log_init_level_map {} {
772772
# logging/ts_log_get_stacktrace()
773773
#*******************************************************************************
774774
proc ts_log_get_function {} {
775-
# assume that we got called from ts_private_do_log,
775+
# assume that we got called from ts_private_do_log,
776776
# called from ts_log, ts_log_severe, ts_log_warning, etc.
777777
# so we skip our own level, plus 2 other levels
778778
set stack_level [expr [info level] -3]
@@ -814,7 +814,7 @@ proc ts_log_get_function {} {
814814
# logging/ts_log_get_function()
815815
#*******************************************************************************
816816
proc ts_log_get_stacktrace {{skip_stack_levels 4}} {
817-
# by default assume that we got called from ts_private_log_send_mail,
817+
# by default assume that we got called from ts_private_log_send_mail,
818818
# called from ts_private_do_log,
819819
# called from ts_log, ts_log_severe, ts_log_warning, etc.
820820
# so we skip our own level, plus 3 other levels
@@ -832,7 +832,7 @@ proc ts_log_get_stacktrace {{skip_stack_levels 4}} {
832832
# ts_log_get_level_name() -- return name of a logging level
833833
#
834834
# SYNOPSIS
835-
# ts_log_get_level_name {level}
835+
# ts_log_get_level_name {level}
836836
#
837837
# FUNCTION
838838
# Returns the name of a given logging level.
@@ -874,7 +874,7 @@ proc ts_log_get_level_name {level} {
874874
# ts_log_get_level_name() -- return number of a logging level
875875
#
876876
# SYNOPSIS
877-
# ts_log_get_level_number {level}
877+
# ts_log_get_level_number {level}
878878
#
879879
# FUNCTION
880880
# Returns the number of a given logging level.
@@ -957,7 +957,7 @@ proc ts_log_get_level_abbreviation {level raise_error} {
957957
# ts_private_do_log() -- function doing the actual logging work
958958
#
959959
# SYNOPSIS
960-
# ts_private_do_log {level message {raise_error 1} {function ""}
960+
# ts_private_do_log {level message {raise_error 1} {function ""}
961961
# {do_output 1} {do_logging 1} {do_mail 1}}
962962
#
963963
# FUNCTION
@@ -1005,7 +1005,7 @@ proc ts_private_do_log {level message {raise_error 1} {function ""} {do_output 1
10051005
wait_for_enter
10061006
}
10071007
}
1008-
1008+
10091009
if {$CHECK_USE_HUDSON == 1} {
10101010
ts_private_log_hudson_output $level $message $raise_error $function
10111011
return
@@ -1015,7 +1015,7 @@ proc ts_private_do_log {level message {raise_error 1} {function ""} {do_output 1
10151015
if {$do_logging} {
10161016
ts_private_log_do_logging $level $message $raise_error $function
10171017
}
1018-
1018+
10191019
# send mail
10201020
if {$do_mail} {
10211021
ts_private_log_send_mail $level $message $raise_error $function
@@ -1031,12 +1031,12 @@ proc ts_private_do_log {level message {raise_error 1} {function ""} {do_output 1
10311031
#
10321032
# FUNCTION
10331033
# If called from error logging (level SEVERE, WARNING, or CONFIG),
1034-
# and raise_error is 1,
1034+
# and raise_error is 1,
10351035
# stores the error description in the global variables
10361036
# check_errno and check_errstr.
1037-
#
1038-
# The error information is used by the testsuite framework to
1039-
# figure out, if a check was successfull, and is stored in
1037+
#
1038+
# The error information is used by the testsuite framework to
1039+
# figure out, if a check was successfull, and is stored in
10401040
# per check information.
10411041
#
10421042
# INPUTS
@@ -1053,7 +1053,7 @@ proc ts_private_log_store_error {level message raise_error function} {
10531053
global CHECK_CUR_PROC_NAME check_name
10541054
global check_errno check_errstr
10551055
global DISABLE_ADD_PROC_ERROR
1056-
1056+
10571057
# only if error logging is not disabled
10581058
# not during setup
10591059
# only store SEVERE, WARNING, CONFIG (the former "unsupported")
@@ -1237,14 +1237,14 @@ proc ts_private_log_do_logging {level message raise_error function} {
12371237
# third line
12381238
# last line
12391239
# --------------------------------------------------------------------------------
1240-
#
1241-
#
1240+
#
1241+
#
12421242
# Stack Trace:
12431243
# ============
12441244
# 0: toplevel
12451245
# 1: ts_log_test
1246-
#
1247-
#
1246+
#
1247+
#
12481248
# Testsuite configuration (ts_config):
12491249
# ====================================
12501250
# Testsuite configuration setup: "1.14"
@@ -1259,6 +1259,7 @@ proc ts_private_log_send_mail {level message raise_error function} {
12591259
global CHECK_SEND_ERROR_MAILS
12601260
global DISABLE_ADD_PROC_ERROR
12611261
global CHECK_CUR_PREPARATION_PROCEDURE
1262+
global CHECK_PREVIOUS_TEST
12621263
global ts_private_do_log_recursive
12631264

12641265
# shall we send mail at all, and for this level?
@@ -1272,9 +1273,9 @@ proc ts_private_log_send_mail {level message raise_error function} {
12721273
return
12731274
}
12741275

1275-
# ts_private_do_log could be called recursively, for example,
1276+
# ts_private_do_log could be called recursively, for example,
12761277
# if errors occur while sending the error message as mail.
1277-
# In this case, just output the error message - Otherwise we might
1278+
# In this case, just output the error message - Otherwise we might
12781279
# end up in endless recursion.
12791280
if {$ts_private_do_log_recursive} {
12801281
puts ""
@@ -1294,6 +1295,7 @@ proc ts_private_log_send_mail {level message raise_error function} {
12941295
append mail_body "\n"
12951296
append mail_body "Date : [clock format [clock seconds]]\n"
12961297
append mail_body "check_name : $check_name\n"
1298+
append mail_body "previous_check : $CHECK_PREVIOUS_TEST\n"
12971299
append mail_body "category : $category\n"
12981300
if {$CHECK_CUR_PREPARATION_PROCEDURE != ""} {
12991301
append mail_body "preparation func: $CHECK_CUR_PREPARATION_PROCEDURE\n"
@@ -1328,11 +1330,11 @@ proc ts_private_log_hudson_output {level message raise_error function {display_h
13281330
global CHECK_HUDSON_OUTPUT
13291331
global CHECK_HUDSON_STACKTRACE
13301332
global ts_log_config
1331-
1333+
13321334
if {$level > $ts_log_config(logging)} {
13331335
return
13341336
}
1335-
1337+
13361338
if {$display_header != 1} {
13371339
append CHECK_HUDSON_OUTPUT $message
13381340
} else {
@@ -1397,7 +1399,7 @@ proc get_ts_log_washing_machine { } {
13971399
# end of private functions
13981400
# ================================================================================
13991401
# some tests
1400-
# call via
1402+
# call via
14011403
# expect check.exp execute_func ts_log_test
14021404

14031405
proc ts_log_sub_test {arg1 arg2} {

0 commit comments

Comments
 (0)