Commit a985a3ae authored by Karol Latecki's avatar Karol Latecki Committed by Jim Harris
Browse files

test/common: don't specify output dir for core_pattern in command line



Remove output directory argument for core-collector.sh when
setting system core_pattern. Instead save the full output
directory path into a file to a known location and read it
directly in core-collector.sh.

The reason for this change is 128 bytes command line length
for core_pattern (see 'man core 5'). In case working with
long paths the core_pattern command line gets truncated and
core dumps are not generated.

Change-Id: Ia74c180e4923fb43d6ff66129ffe54c32827adca
Signed-off-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12755


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarMichal Berger <michallinuxstuff@gmail.com>
Reviewed-by: default avatarPawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 68108360
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -39,3 +39,4 @@ PYTHON_COMMAND
test_completions.txt
timing.txt
test/common/build_config.sh
.coredump_path
+6 −2
Original line number Diff line number Diff line
@@ -28,8 +28,12 @@ fi
if [ $(uname -s) = Linux ]; then
	old_core_pattern=$(< /proc/sys/kernel/core_pattern)
	mkdir -p "$output_dir/coredumps"
	# set core_pattern to a known value to avoid ABRT, systemd-coredump, etc.
	echo "|$rootdir/scripts/core-collector.sh %P %s %t %c $output_dir/coredumps" > /proc/sys/kernel/core_pattern
	# Set core_pattern to a known value to avoid ABRT, systemd-coredump, etc.
	# Dump the $output_dir path to a file so collector can pick it up while executing.
	# We don't set in in the core_pattern command line because of the string length limitation
	# of 128 bytes. See 'man core 5' for details.
	echo "|$rootdir/scripts/core-collector.sh %P %s %t %c" > /proc/sys/kernel/core_pattern
	echo "$output_dir/coredumps" > "$rootdir/.coredump_path"

	# make sure nbd (network block device) driver is loaded if it is available
	# this ensures that when tests need to use nbd, it will be fully initialized
+1 −2
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ args+=(core_pid)
args+=(core_sig)
args+=(core_ts)
args+=(rlimit)
args+=(output_dir)

read -r "${args[@]}" <<< "$*"

@@ -41,7 +40,7 @@ statm=$(< "/proc/$core_pid/statm")
core_time=$(date -d@"$core_ts")
core_sig_name=$(kill -l "$core_sig")

core=$output_dir/${exe_path##*/}_$core_pid.core
core=$(< "${0%/*}/../.coredump_path")/${exe_path##*/}_$core_pid.core
stderr

# RLIMIT_CORE is not enforced when core is piped to us. To make