@@ -54,80 +54,60 @@ exitcode_list[131]="SIGQUIT Ctrl-\ occurred. Core dumped."
54
54
exitcode_list[132]=" SIGILL Illegal Instruction. Core dumped. Likely codegen issue."
55
55
exitcode_list[133]=" SIGTRAP Breakpoint hit. Core dumped."
56
56
exitcode_list[134]=" SIGABRT Abort. Managed or native assert, or runtime check such as heap corruption, caused call to abort(). Core dumped."
57
- exitcode_list[135]=" IGBUS Unaligned memory access. Core dumped."
57
+ exitcode_list[135]=" IGBUS Unaligned memory access. Core dumped."
58
58
exitcode_list[136]=" SIGFPE Bad floating point arguments. Core dumped."
59
59
exitcode_list[137]=" SIGKILL Killed eg by kill"
60
60
exitcode_list[139]=" SIGSEGV Illegal memory access. Deref invalid pointer, overrunning buffer, stack overflow etc. Core dumped."
61
61
exitcode_list[143]=" SIGTERM Terminated. Usually before SIGKILL."
62
62
exitcode_list[159]=" SIGSYS Bad System Call."
63
63
64
- function print_info_from_core_file_using_lldb {
64
+ function move_core_file_to_temp_location {
65
65
local core_file_name=$1
66
- local executable_name=$2
67
- local plugin_path_name=" $RUNTIME_PATH /shared/Microsoft.NETCore.App/9.9.9/libsosplugin.so"
68
66
69
- # check for existence of lldb on the path
70
- hash lldb 2> /dev/null || { echo >&2 " lldb was not found. Unable to print core file. " ; return ; }
67
+ # Append the dmp extension to ensure XUnitLogChecker finds it
68
+ local new_location= $HELIX_DUMP_FOLDER / $core_file_name .dmp
71
69
72
- # pe, clrstack, and dumpasync are defined in libsosplugin.so
73
- if [ ! -f $plugin_path_name ]; then
74
- echo $plugin_path_name cannot be found.
75
- return
76
- fi
77
-
78
- echo ----- start =============== lldb Output =====================================================
79
- echo Printing managed exceptions, managed call stacks, and async state machines.
80
- lldb -O " settings set target.exec-search-paths $RUNTIME_PATH " -o " plugin load $plugin_path_name " -o " clrthreads -managedexception" -o " pe -nested" -o " clrstack -all -a -f" -o " dumpasync -fields -stacks -roots" -o " quit" --core $core_file_name $executable_name
81
- echo ----- end =============== lldb Output =======================================================
82
- }
83
-
84
- function print_info_from_core_file_using_gdb {
85
- local core_file_name=$1
86
- local executable_name=$2
87
-
88
- # Check for the existence of GDB on the path
89
- hash gdb 2> /dev/null || { echo >&2 " GDB was not found. Unable to print core file." ; return ; }
70
+ echo " Copying dump file '$core_file_name ' to '$new_location '"
71
+ cp $core_file_name $new_location
90
72
91
- echo ----- start =============== GDB Output =====================================================
92
- # Open the dump in GDB and print the stack from each thread. We can add more
93
- # commands here if desired.
94
- echo printing native stack.
95
- gdb --batch -ex " thread apply all bt full" -ex " quit" $executable_name $core_file_name
96
- echo ----- end =============== GDB Output =======================================================
73
+ # Delete the old one
74
+ rm $core_file_name
97
75
}
98
76
99
- function print_info_from_core_file {
100
- local core_file_name=$1
101
- local executable_name=$RUNTIME_PATH /$2
102
-
103
- if ! [ -e $executable_name ]; then
104
- echo " Unable to find executable $executable_name "
105
- return
106
- elif ! [ -e $core_file_name ]; then
107
- echo " Unable to find core file $core_file_name "
108
- return
77
+ xunitlogchecker_exit_code=0
78
+ function invoke_xunitlogchecker {
79
+ local dump_folder=$1
80
+
81
+ total_dumps=$( find $dump_folder -name " *.dmp" | wc -l)
82
+
83
+ if [[ $total_dumps > 0 ]]; then
84
+ echo " Total dumps found in $dump_folder : $total_dumps "
85
+ xunitlogchecker_file_name=" $HELIX_CORRELATION_PAYLOAD /XUnitLogChecker.dll"
86
+ dotnet_file_name=" $RUNTIME_PATH /dotnet"
87
+
88
+ if [[ ! -f $dotnet_file_name ]]; then
89
+ echo " '$dotnet_file_name ' was not found. Unable to run XUnitLogChecker."
90
+ xunitlogchecker_exit_code=1
91
+ elif [[ ! -f $xunitlogchecker_file_name ]]; then
92
+ echo " '$xunitlogchecker_file_name ' was not found. Unable to print dump file contents."
93
+ xunitlogchecker_exit_code=2
94
+ elif [[ ! -d $dump_folder ]]; then
95
+ echo " The dump directory '$dump_folder ' does not exist."
96
+ else
97
+ echo " Executing XUnitLogChecker in $dump_folder ..."
98
+ cmd=" $dotnet_file_name --roll-forward Major $xunitlogchecker_file_name --dumps-path $dump_folder "
99
+ echo " $cmd "
100
+ $cmd
101
+ xunitlogchecker_exit_code=$?
102
+ fi
103
+ else
104
+ echo " No dumps found in $dump_folder ."
109
105
fi
110
- echo " Printing info from core file $core_file_name "
111
- print_info_from_core_file_using_gdb $core_file_name $executable_name
112
- print_info_from_core_file_using_lldb $core_file_name $executable_name
113
- }
114
-
115
- function copy_core_file_to_temp_location {
116
- local core_file_name=$1
117
-
118
- local storage_location=" /tmp/coredumps"
119
-
120
- # Create the directory (this shouldn't fail even if it already exists).
121
- mkdir -p $storage_location
122
-
123
- local new_location=$storage_location /core.$RANDOM
124
-
125
- echo " Copying core file $core_file_name to $new_location in case you need it."
126
- cp $core_file_name $new_location
127
106
}
128
107
129
108
# ========================= BEGIN Core File Setup ============================
130
- if [[ " $( uname -s) " == " Darwin" ]]; then
109
+ system_name=" $( uname -s) "
110
+ if [[ $system_name == " Darwin" ]]; then
131
111
# On OS X, we will enable core dump generation only if there are no core
132
112
# files already in /cores/ at this point. This is being done to prevent
133
113
# inadvertently flooding the CI machines with dumps.
@@ -140,21 +120,11 @@ if [[ "$(uname -s)" == "Darwin" ]]; then
140
120
# https://github.com/dotnet/core-eng/issues/15597
141
121
ulimit -c 0
142
122
fi
143
-
144
- elif [[ " $( uname -s) " == " Linux" ]]; then
145
- # On Linux, we'll enable core file generation unconditionally, and if a dump
146
- # is generated, we will print some useful information from it and delete the
147
- # dump immediately.
148
-
149
- if [ -e /proc/self/coredump_filter ]; then
150
- # Include memory in private and shared file-backed mappings in the dump.
151
- # This ensures that we can see disassembly from our shared libraries when
152
- # inspecting the contents of the dump. See 'man core' for details.
153
- echo -n 0x3F > /proc/self/coredump_filter
154
- fi
155
-
156
- ulimit -c unlimited
157
123
fi
124
+
125
+ export DOTNET_DbgEnableMiniDump=1
126
+ export DOTNET_EnableCrashReport=1
127
+ export DOTNET_DbgMiniDumpName=$HELIX_DUMP_FOLDER /coredump.%d.dmp
158
128
# ========================= END Core File Setup ==============================
159
129
160
130
# ========================= BEGIN support for SuperPMI collection ==============================
@@ -171,7 +141,7 @@ if [ ! -z $spmi_enable_collection ]; then
171
141
fi
172
142
mkdir -p $spmi_collect_dir
173
143
export spmi_file_extension=so
174
- if [[ " $( uname -s ) " == " Darwin" ]]; then
144
+ if [[ $system_name == " Darwin" ]]; then
175
145
export spmi_file_extension=dylib
176
146
fi
177
147
export SuperPMIShimLogPath=$spmi_collect_dir
@@ -193,6 +163,11 @@ if [ ! -z $spmi_enable_collection ]; then
193
163
fi
194
164
# ========================= END support for SuperPMI collection ==============================
195
165
166
+ echo ========================= Begin custom configuration settings ==============================
167
+ [[SetCommandsEcho]]
168
+ [[SetCommands]]
169
+ echo ========================== End custom configuration settings ===============================
170
+
196
171
# ========================= BEGIN Test Execution =============================
197
172
echo ----- start $( date) =============== To repro directly: =====================================================
198
173
echo pushd $EXECUTION_DIR
@@ -220,51 +195,59 @@ if [[ $test_exitcode -ne 0 ]]; then
220
195
echo ulimit -c value: $( ulimit -c)
221
196
fi
222
197
223
- if [[ " $( uname -s) " == " Linux" && $test_exitcode -ne 0 ]]; then
224
- if [ -n " $HELIX_WORKITEM_PAYLOAD " ]; then
225
-
226
- # For abrupt failures, in Helix, dump some of the kernel log, in case there is a hint
227
- if [[ $test_exitcode -ne 1 ]]; then
228
- dmesg | tail -50
229
- fi
230
-
231
- have_sleep=$( which sleep)
232
- if [ -x " $have_sleep " ]; then
233
- echo Waiting a few seconds for any dump to be written..
234
- sleep 10s
235
- fi
236
- fi
237
-
198
+ if [[ $system_name == " Linux" && $test_exitcode -ne 0 ]]; then
238
199
echo cat /proc/sys/kernel/core_pattern: $( cat /proc/sys/kernel/core_pattern)
239
200
echo cat /proc/sys/kernel/core_uses_pid: $( cat /proc/sys/kernel/core_uses_pid)
240
201
echo cat /proc/sys/kernel/coredump_filter: $( cat /proc/sys/kernel/coredump_filter)
241
202
242
- echo Looking around for any Linux dump..
243
-
244
203
# Depending on distro/configuration, the core files may either be named "core"
245
204
# or "core.<PID>" by default. We read /proc/sys/kernel/core_uses_pid to
246
205
# determine which it is.
247
206
core_name_uses_pid=0
248
207
if [[ -e /proc/sys/kernel/core_uses_pid && " 1" == $( cat /proc/sys/kernel/core_uses_pid) ]]; then
249
208
core_name_uses_pid=1
250
209
fi
210
+
211
+ # The osx dumps are too large to egress the machine
212
+ echo Looking around for any Linux dumps...
251
213
252
214
if [[ " $core_name_uses_pid " == " 1" ]]; then
253
215
# We don't know what the PID of the process was, so let's look at all core
254
216
# files whose name matches core.NUMBER
255
- echo Looking for files matching core.* ...
256
- for f in core.* ; do
257
- [[ $f =~ core.[0-9]+ ]] && print_info_from_core_file " $f " " dotnet " && copy_core_file_to_temp_location " $f " && rm " $f "
217
+ echo " Looking for files matching core.* ..."
218
+ for f in $( find . -name " core.*" ) ; do
219
+ [[ $f =~ core.[0-9]+ ]] && move_core_file_to_temp_location " $f "
258
220
done
259
- elif [ -f core ]; then
260
- echo found a dump named core in $EXECUTION_DIR !
261
- print_info_from_core_file " core" " dotnet"
262
- copy_core_file_to_temp_location " core"
263
- rm " core"
264
- else
265
- echo ... found no dump in $PWD
266
221
fi
222
+
223
+ if [ -f core ]; then
224
+ move_core_file_to_temp_location " core"
225
+ fi
226
+ fi
227
+
228
+ if [ -n " $HELIX_WORKITEM_PAYLOAD " ]; then
229
+ # For abrupt failures, in Helix, dump some of the kernel log, in case there is a hint
230
+ if [[ $test_exitcode -ne 1 ]]; then
231
+ dmesg | tail -50
232
+ fi
233
+
267
234
fi
235
+
236
+ if [[ -z " $__IsXUnitLogCheckerSupported " ]]; then
237
+ echo " The '__IsXUnitLogCheckerSupported' env var is not set."
238
+ elif [[ " $__IsXUnitLogCheckerSupported " != " 1" ]]; then
239
+ echo " XUnitLogChecker not supported for this test case. Skipping."
240
+ else
241
+ echo ----- start =============== XUnitLogChecker Output =====================================================
242
+
243
+ invoke_xunitlogchecker " $HELIX_DUMP_FOLDER "
244
+
245
+ if [[ $xunitlogchecker_exit_code -ne 0 ]]; then
246
+ test_exitcode=$xunitlogchecker_exit_code
247
+ fi
248
+ echo ----- end =============== XUnitLogChecker Output - exit code $xunitlogchecker_exit_code ===========================
249
+ fi
250
+
268
251
popd > /dev/null
269
252
# ======================== END Core File Inspection ==========================
270
253
# The helix work item should not exit with non-zero if tests ran and produced results
0 commit comments