ctest: Print custom timeout signal properties in show-only output

This was missed in commit 54c5654f7d (ctest: Optionally terminate tests
with a custom signal on timeout, 2023-05-11, v3.27.0-rc1~18^2).
This commit is contained in:
Brad King
2024-11-25 11:53:22 -05:00
parent 57587b3863
commit 733808150b
4 changed files with 60 additions and 7 deletions

View File

@@ -1202,6 +1202,15 @@ static Json::Value DumpCTestProperties(
properties.append(
DumpCTestProperty("TIMEOUT", testProperties.Timeout->count()));
}
if (testProperties.TimeoutSignal) {
properties.append(DumpCTestProperty("TIMEOUT_SIGNAL_NAME",
testProperties.TimeoutSignal->Name));
}
if (testProperties.TimeoutGracePeriod) {
properties.append(
DumpCTestProperty("TIMEOUT_SIGNAL_GRACE_PERIOD",
testProperties.TimeoutGracePeriod->count()));
}
if (!testProperties.TimeoutRegularExpressions.empty()) {
properties.append(DumpCTestProperty(
"TIMEOUT_AFTER_MATCH", DumpTimeoutAfterMatch(testProperties)));

View File

@@ -469,10 +469,13 @@ function(run_ShowOnly)
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo)
set_tests_properties(ShowOnly PROPERTIES
WILL_FAIL true
RESOURCE_GROUPS \"2,threads:2,gpus:4;gpus:2,threads:4\"
REQUIRED_FILES RequiredFileDoesNotExist
_BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\"
TIMEOUT 1234.5
TIMEOUT_SIGNAL_NAME SIGINT
TIMEOUT_SIGNAL_GRACE_PERIOD 2.1
WILL_FAIL true
USER_DEFINED_A \"User defined property A value\"
USER_DEFINED_B \"User defined property B value\"
)

View File

@@ -1,3 +1,5 @@
import sys
from show_only_json_check import *
def check_kind(k):
@@ -72,6 +74,30 @@ def check_reqfiles_property(p):
assert len(p["value"]) == 1
assert p["value"][0] == "RequiredFileDoesNotExist"
def check_timeout_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
assert is_string(p["name"])
assert is_float(p["value"])
assert p["name"] == "TIMEOUT"
assert p["value"] == 1234.5
def check_timeout_signal_name_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
assert is_string(p["name"])
assert is_string(p["value"])
assert p["name"] == "TIMEOUT_SIGNAL_NAME"
assert p["value"] == "SIGINT"
def check_timeout_signal_grace_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
assert is_string(p["name"])
assert is_float(p["value"])
assert p["name"] == "TIMEOUT_SIGNAL_GRACE_PERIOD"
assert p["value"] == 2.1
def check_willfail_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
@@ -155,12 +181,24 @@ def check_defined_properties(p_list):
def check_properties(p):
assert is_list(p)
assert len(p) == 6
check_resource_groups_property(p[0])
check_reqfiles_property(p[1])
check_willfail_property(p[2])
check_workingdir_property(p[3])
check_defined_properties(p[4:5])
if sys.platform in ("win32"):
assert len(p) == 7
check_resource_groups_property(p[0])
check_reqfiles_property(p[1])
check_timeout_property(p[2])
check_willfail_property(p[3])
check_workingdir_property(p[4])
check_defined_properties(p[5:6])
else:
assert len(p) == 9
check_resource_groups_property(p[0])
check_reqfiles_property(p[1])
check_timeout_property(p[2])
check_timeout_signal_name_property(p[3])
check_timeout_signal_grace_property(p[4])
check_willfail_property(p[5])
check_workingdir_property(p[6])
check_defined_properties(p[7:8])
def check_tests(t):
assert is_list(t)

View File

@@ -14,6 +14,9 @@ def is_list(x):
def is_int(x):
return isinstance(x, int) or isinstance(x, long)
def is_float(x):
return isinstance(x, float)
def is_string(x):
return isinstance(x, str) or isinstance(x, unicode)