Skip to content

Commit

Permalink
test/common: don't specify output dir for core_pattern in command line
Browse files Browse the repository at this point in the history
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: Karol Latecki <[email protected]>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12755
Community-CI: Broadcom CI <[email protected]>
Tested-by: SPDK CI Jenkins <[email protected]>
Reviewed-by: Michal Berger <[email protected]>
Reviewed-by: Pawel Piatek <[email protected]>
Reviewed-by: Konrad Sztyber <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
  • Loading branch information
karlatec authored and jimharris committed Jun 8, 2022
1 parent 6810836 commit a985a3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ PYTHON_COMMAND
test_completions.txt
timing.txt
test/common/build_config.sh
.coredump_path
8 changes: 6 additions & 2 deletions autotest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions scripts/core-collector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ args+=(core_pid)
args+=(core_sig)
args+=(core_ts)
args+=(rlimit)
args+=(output_dir)

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

Expand All @@ -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
Expand Down

0 comments on commit a985a3a

Please sign in to comment.