Add FreeBSD core handling in zloop.sh

And use the correct path to libtool and ztest.

Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9790
This commit is contained in:
Ryan Moeller 2020-01-02 16:48:06 -05:00 committed by Brian Behlendorf
parent 82e996c261
commit 54007c791f
2 changed files with 30 additions and 14 deletions

View File

@ -25,7 +25,7 @@ define EXTRA_ENVIRONMENT
# Only required for in-tree use # Only required for in-tree use
export INTREE="yes" export INTREE="yes"
export GDB="/usr/bin/libtool --mode=execute gdb" export GDB="libtool --mode=execute gdb"
export LDMOD=/sbin/insmod export LDMOD=/sbin/insmod
export CMD_DIR=@abs_top_builddir@/cmd export CMD_DIR=@abs_top_builddir@/cmd

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# CDDL HEADER START # CDDL HEADER START
@ -70,16 +70,26 @@ function or_die
fi fi
} }
# core file helpers case $(uname) in
origcorepattern="$(cat /proc/sys/kernel/core_pattern)" FreeBSD)
coreglob="$(grep -E -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*" coreglob="z*.core"
;;
Linux)
# core file helpers
origcorepattern="$(cat /proc/sys/kernel/core_pattern)"
coreglob="$(grep -E -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
if [[ $coreglob = "*" ]]; then if [[ $coreglob = "*" ]]; then
echo "Setting core file pattern..." echo "Setting core file pattern..."
echo "core" > /proc/sys/kernel/core_pattern echo "core" > /proc/sys/kernel/core_pattern
coreglob="$(grep -E -o '^([^|%[:space:]]*)' \ coreglob="$(grep -E -o '^([^|%[:space:]]*)' \
/proc/sys/kernel/core_pattern)*" /proc/sys/kernel/core_pattern)*"
fi fi
;;
*)
exit 1
;;
esac
function core_file function core_file
{ {
@ -108,7 +118,7 @@ function store_core
foundcrashes=$((foundcrashes + 1)) foundcrashes=$((foundcrashes + 1))
# zdb debugging # zdb debugging
zdbcmd="$ZDB -U "$workdir/zpool.cache" -dddMmDDG ztest" zdbcmd="$ZDB -U "$workdir/zpool.cache" -dddMmDDG $ZTEST"
zdbdebug=$($zdbcmd 2>&1) zdbdebug=$($zdbcmd 2>&1)
echo -e "$zdbcmd\n" >>ztest.zdb echo -e "$zdbcmd\n" >>ztest.zdb
echo "$zdbdebug" >>ztest.zdb echo "$zdbdebug" >>ztest.zdb
@ -278,8 +288,14 @@ done
echo "zloop finished, $foundcrashes crashes found" echo "zloop finished, $foundcrashes crashes found"
#restore core pattern # restore core pattern.
echo "$origcorepattern" > /proc/sys/kernel/core_pattern case $(uname) in
Linux)
echo "$origcorepattern" > /proc/sys/kernel/core_pattern
;;
*)
;;
esac
uptime >>ztest.out uptime >>ztest.out