autobuild: FreeBSD portability fixes

Change-Id: Id6db5d80ee7fa602da8763372f92555e7e299445
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-10-02 17:11:56 -07:00 committed by Gerrit Code Review
parent 8780063f2c
commit f0b3db3f1e
6 changed files with 58 additions and 24 deletions

View File

@ -3,10 +3,9 @@
set -e
src=$(readlink -f $(dirname $0))
out=$PWD
source "$src/scripts/autotest_common.sh"
MAKEFLAGS=${MAKEFLAGS:--j16}
DPDK_DIR=/usr/local/dpdk-2.1.0/x86_64-native-linuxapp-gcc
out=$PWD
umask 022
@ -19,16 +18,16 @@ if hash scan-build; then
scanbuild="scan-build -o $out/scan-build-tmp --status-bugs"
fi
make $MAKEFLAGS clean
$MAKE $MAKEFLAGS clean
fail=0
time $scanbuild make $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
time $scanbuild $MAKE $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
# Check that header file dependencies are working correctly by
# capturing a binary's stat data before and after touching a
# header file and re-making.
STAT1=`stat examples/nvme/identify/identify`
touch lib/nvme/nvme_internal.h
make $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
$MAKE $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
STAT2=`stat examples/nvme/identify/identify`
if [ "$STAT1" == "$STAT2" ]; then
@ -43,7 +42,7 @@ if [ -d $out/scan-build-tmp ]; then
fi
if hash doxygen; then
(cd "$src"/doc; make $MAKEFLAGS)
(cd "$src"/doc; $MAKE $MAKEFLAGS)
mkdir -p "$out"/doc
for d in "$src"/doc/output.*; do
component=$(basename "$d" | sed -e 's/^output.//')

View File

@ -2,15 +2,15 @@
set -xe
DPDK_DIR=/usr/local/dpdk-2.1.0/x86_64-native-linuxapp-gcc
src=$(readlink -f $(dirname $0))
source "$src/scripts/autotest_common.sh"
out=$PWD
MAKEFLAGS=${MAKEFLAGS:--j16}
cd $src
make clean
$MAKE clean
if [ `git status --porcelain | wc -l` -ne 0 ]; then
echo make clean left the following files:
@ -36,6 +36,6 @@ tar -C "$tmpdir" -xf $out/$tarball
cd "$tmpdir"/spdk-*
cp CONFIG CONFIG.orig
sed -e 's/CONFIG_DEBUG=y/CONFIG_DEBUG=n/' <CONFIG.orig >CONFIG
time make ${MAKEFLAGS} DPDK_DIR=$DPDK_DIR
time $MAKE ${MAKEFLAGS} DPDK_DIR=$DPDK_DIR
)
rm -rf "$tmpdir"

View File

@ -10,7 +10,7 @@ if [ $EUID -ne 0 ]; then
exit 1
fi
trap "process_core; exit 1" SIGINT SIGTERM EXIT
trap "process_core; $rootdir/scripts/cleanup.sh; exit 1" SIGINT SIGTERM EXIT
timing_enter autotest
@ -36,17 +36,7 @@ time test/lib/memory/memory.sh
timing_exit lib
# detach pci devices from uio driver
grep -q "^uio_pci_generic" /proc/modules && rmmod uio_pci_generic
# bind NVMe devices to NVMe driver if no kernel device
if [ -d "/sys/bus/pci/drivers/nvme" ]; then
device=`find /sys/bus/pci/drivers/nvme -name "0000*" -print`
if [ -z "$device" ]; then
rmmod nvme
modprobe nvme
fi
fi
./scripts/cleanup.sh
timing_exit autotest
chmod a+r $output_dir/timing.txt

View File

@ -1,6 +1,23 @@
set -xe
ulimit -c unlimited
case `uname` in
FreeBSD)
DPDK_DIR=/usr/local/share/dpdk/x86_64-native-bsdapp-clang
MAKE=gmake
;;
Linux)
DPDK_DIR=/usr/local/dpdk-2.1.0/x86_64-native-linuxapp-gcc
MAKE=make
;;
*)
echo "Unknown OS in $0"
exit 1
;;
esac
MAKEFLAGS=${MAKEFLAGS:--j16}
if [ -z "$rootdir" ] || [ ! -d "$rootdir/../output" ]; then
output_dir=.
else

27
scripts/cleanup.sh Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
function cleanup_linux() {
# detach pci devices from uio driver
grep -q "^uio_pci_generic" /proc/modules && rmmod uio_pci_generic
# bind NVMe devices to NVMe driver if no kernel device
if [ -d "/sys/bus/pci/drivers/nvme" ]; then
device=`find /sys/bus/pci/drivers/nvme -name "0000*" -print`
if [ -z "$device" ]; then
rmmod nvme
modprobe nvme
fi
fi
}
function cleanup_freebsd {
kldunload contigmem.ko || true
}
if [ `uname` = Linux ]; then
cleanup_linux
else
cleanup_freebsd
fi

View File

@ -18,9 +18,10 @@ function configure_linux {
}
function configure_freebsd {
kldunload contigmem.ko || true
kenv hw.contigmem.num_buffers=16
kenv hw.contigmem.buffer_size=33554432
kldload `find . -name contigmem.ko | head -1`
kldload contigmem.ko
}
if [ `uname` = Linux ]; then