diff options
author | Ryan Moeller <[email protected]> | 2020-01-02 16:48:06 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-01-02 13:48:06 -0800 |
commit | 54007c791f74c4b0bc84d3837e5c4fbec6c9cfc8 (patch) | |
tree | cab4034576b8059d97657d5c58168168f1ada307 | |
parent | 82e996c2616af6254002065398de7cfb6929c4fd (diff) |
Add FreeBSD core handling in zloop.sh
And use the correct path to libtool and ztest.
Reviewed-By: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #9790
-rw-r--r-- | scripts/Makefile.am | 2 | ||||
-rwxr-xr-x | scripts/zloop.sh | 44 |
2 files changed, 31 insertions, 15 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 1d4306492..1605ab886 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -25,7 +25,7 @@ define EXTRA_ENVIRONMENT # Only required for in-tree use export INTREE="yes" -export GDB="/usr/bin/libtool --mode=execute gdb" +export GDB="libtool --mode=execute gdb" export LDMOD=/sbin/insmod export CMD_DIR=@abs_top_builddir@/cmd diff --git a/scripts/zloop.sh b/scripts/zloop.sh index 1f36f865b..ae10617f6 100755 --- a/scripts/zloop.sh +++ b/scripts/zloop.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # CDDL HEADER START @@ -70,16 +70,26 @@ function or_die fi } -# core file helpers -origcorepattern="$(cat /proc/sys/kernel/core_pattern)" -coreglob="$(grep -E -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*" - -if [[ $coreglob = "*" ]]; then - echo "Setting core file pattern..." - echo "core" > /proc/sys/kernel/core_pattern - coreglob="$(grep -E -o '^([^|%[:space:]]*)' \ - /proc/sys/kernel/core_pattern)*" -fi +case $(uname) in +FreeBSD) + 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 + echo "Setting core file pattern..." + echo "core" > /proc/sys/kernel/core_pattern + coreglob="$(grep -E -o '^([^|%[:space:]]*)' \ + /proc/sys/kernel/core_pattern)*" + fi + ;; +*) + exit 1 + ;; +esac function core_file { @@ -108,7 +118,7 @@ function store_core foundcrashes=$((foundcrashes + 1)) # zdb debugging - zdbcmd="$ZDB -U "$workdir/zpool.cache" -dddMmDDG ztest" + zdbcmd="$ZDB -U "$workdir/zpool.cache" -dddMmDDG $ZTEST" zdbdebug=$($zdbcmd 2>&1) echo -e "$zdbcmd\n" >>ztest.zdb echo "$zdbdebug" >>ztest.zdb @@ -278,8 +288,14 @@ done echo "zloop finished, $foundcrashes crashes found" -#restore core pattern -echo "$origcorepattern" > /proc/sys/kernel/core_pattern +# restore core pattern. +case $(uname) in +Linux) + echo "$origcorepattern" > /proc/sys/kernel/core_pattern + ;; +*) + ;; +esac uptime >>ztest.out |