mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
ci: Collect core files on NetBSD and OpenBSD
Support for NetBSD and OpenBSD operating systems have been added to CI in the prior commit. Now add support for collect core files and generating backtraces using for all core files. Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Discussion: https://postgr.es/m/CAN55FZ32ySyYa06k9MFd+VY5vHhUyBpvgmJUZae5PihjzaurVg@mail.gmail.com
This commit is contained in:
@ -232,11 +232,13 @@ task:
|
|||||||
CCACHE_DIR: /home/postgres/cache
|
CCACHE_DIR: /home/postgres/cache
|
||||||
|
|
||||||
PATH: /usr/sbin:$PATH
|
PATH: /usr/sbin:$PATH
|
||||||
|
CORE_DUMP_DIR: /var/crash
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
- name: NetBSD - Meson
|
- name: NetBSD - Meson
|
||||||
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
|
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
|
||||||
env:
|
env:
|
||||||
|
OS_NAME: netbsd
|
||||||
IMAGE_FAMILY: pg-ci-netbsd-postgres
|
IMAGE_FAMILY: pg-ci-netbsd-postgres
|
||||||
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig'
|
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig'
|
||||||
# initdb fails with: 'invalid locale settings' error on NetBSD.
|
# initdb fails with: 'invalid locale settings' error on NetBSD.
|
||||||
@ -253,12 +255,15 @@ task:
|
|||||||
- name: OpenBSD - Meson
|
- name: OpenBSD - Meson
|
||||||
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
|
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
|
||||||
env:
|
env:
|
||||||
|
OS_NAME: openbsd
|
||||||
IMAGE_FAMILY: pg-ci-openbsd-postgres
|
IMAGE_FAMILY: pg-ci-openbsd-postgres
|
||||||
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
|
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
|
||||||
UUID: -Duuid=e2fs
|
UUID: -Duuid=e2fs
|
||||||
TCL: -Dtcl_version=tcl86
|
TCL: -Dtcl_version=tcl86
|
||||||
setup_additional_packages_script: |
|
setup_additional_packages_script: |
|
||||||
#pkg_add -I ...
|
#pkg_add -I ...
|
||||||
|
# Always core dump to ${CORE_DUMP_DIR}
|
||||||
|
set_core_dump_script: sysctl -w kern.nosuidcoredump=2
|
||||||
<<: *openbsd_task_template
|
<<: *openbsd_task_template
|
||||||
|
|
||||||
sysinfo_script: |
|
sysinfo_script: |
|
||||||
@ -276,6 +281,10 @@ task:
|
|||||||
chown -R postgres:users /home/postgres
|
chown -R postgres:users /home/postgres
|
||||||
mkdir -p ${CCACHE_DIR}
|
mkdir -p ${CCACHE_DIR}
|
||||||
chown -R postgres:users ${CCACHE_DIR}
|
chown -R postgres:users ${CCACHE_DIR}
|
||||||
|
setup_core_files_script: |
|
||||||
|
mkdir -p ${CORE_DUMP_DIR}
|
||||||
|
chmod -R 770 ${CORE_DUMP_DIR}
|
||||||
|
chown -R postgres:users ${CORE_DUMP_DIR}
|
||||||
|
|
||||||
# -Duuid=bsd is not set since 'bsd' uuid option
|
# -Duuid=bsd is not set since 'bsd' uuid option
|
||||||
# is not working on NetBSD & OpenBSD. See
|
# is not working on NetBSD & OpenBSD. See
|
||||||
@ -306,6 +315,12 @@ task:
|
|||||||
|
|
||||||
on_failure:
|
on_failure:
|
||||||
<<: *on_failure_meson
|
<<: *on_failure_meson
|
||||||
|
cores_script: |
|
||||||
|
# Although we try to configure the OS to core dump inside
|
||||||
|
# ${CORE_DUMP_DIR}, they may not obey this. So, move core files to the
|
||||||
|
# ${CORE_DUMP_DIR} directory.
|
||||||
|
find build/ -type f -name '*.core' -exec mv '{}' ${CORE_DUMP_DIR} \;
|
||||||
|
src/tools/ci/cores_backtrace.sh ${OS_NAME} ${CORE_DUMP_DIR}
|
||||||
|
|
||||||
|
|
||||||
# configure feature flags, shared between the task running the linux tests and
|
# configure feature flags, shared between the task running the linux tests and
|
||||||
|
@ -9,7 +9,7 @@ os=$1
|
|||||||
directory=$2
|
directory=$2
|
||||||
|
|
||||||
case $os in
|
case $os in
|
||||||
freebsd|linux|macos)
|
freebsd|linux|macos|netbsd|openbsd)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unsupported operating system ${os}"
|
echo "unsupported operating system ${os}"
|
||||||
@ -26,7 +26,7 @@ for corefile in $(find "$directory" -type f) ; do
|
|||||||
echo -e '\n\n'
|
echo -e '\n\n'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$os" = 'macos' ]; then
|
if [ "$os" = 'macos' ] || [ "$os" = 'openbsd' ]; then
|
||||||
lldb -c $corefile --batch -o 'thread backtrace all' -o 'quit'
|
lldb -c $corefile --batch -o 'thread backtrace all' -o 'quit'
|
||||||
else
|
else
|
||||||
auxv=$(gdb --quiet --core ${corefile} --batch -ex 'info auxv' 2>/dev/null)
|
auxv=$(gdb --quiet --core ${corefile} --batch -ex 'info auxv' 2>/dev/null)
|
||||||
@ -37,6 +37,8 @@ for corefile in $(find "$directory" -type f) ; do
|
|||||||
|
|
||||||
if [ "$os" = 'freebsd' ]; then
|
if [ "$os" = 'freebsd' ]; then
|
||||||
binary=$(echo "$auxv" | grep AT_EXECPATH | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
|
binary=$(echo "$auxv" | grep AT_EXECPATH | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
|
||||||
|
elif [ "$os" = 'netbsd' ]; then
|
||||||
|
binary=$(echo "$auxv" | grep AT_SUN_EXECNAME | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
|
||||||
elif [ "$os" = 'linux' ]; then
|
elif [ "$os" = 'linux' ]; then
|
||||||
binary=$(echo "$auxv" | grep AT_EXECFN | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
|
binary=$(echo "$auxv" | grep AT_EXECFN | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user