Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions gdb/testsuite/gdb.rocm/runtime-core.exp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
return -1
}

# The "do_test" function is called multiple times, and any may exit early if
# it turns out the current configuration does not allow the creation of core
# dumps. However, if at least one core dump can be produced, all must be.
# Keep track of the number of attempts and their status to enforce this
# property.
Comment thread
lancesix marked this conversation as resolved.
set total_count 0
set untested_count 0
set success_count 0

# do_test FAULT CORE_TYPE OUTPUT_TYPE
# Run the test exercising generation of a core dump on fault FAULT
# using a file or a pipe.
Expand All @@ -45,6 +54,7 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
# OUTPUT_TYPE is one of "file" of "pipe".
#
proc do_test { fault core_type output_type } {
incr ::total_count
set use_pipe [expr {$output_type eq "pipe"}]
save_vars { ::env(HSA_ENABLE_LIGHTWEIGHT_COREDUMP) } {
set ::env(HSA_ENABLE_LIGHTWEIGHT_COREDUMP) [expr {$core_type == "lightweight"}]
Expand All @@ -53,6 +63,7 @@ proc do_test { fault core_type output_type } {

if {$coredump eq ""} {
untested "Could not generate a core file"
incr ::untested_count
return
}

Expand Down Expand Up @@ -134,6 +145,7 @@ proc do_test { fault core_type output_type } {
}

gdb_exit
incr ::success_count
}

with_rocm_gpu_lock {
Expand All @@ -151,3 +163,6 @@ with_rocm_gpu_lock {
do_test $fault lightweight file
}
}

gdb_assert {$::total_count == ($::untested_count + $::success_count)} "all tests accounted for"
gdb_assert {$::untested_count == 0 || $::success_count == 0} "coredump consistently produced"
Loading