build: add automated build infrastructure

Change-Id: Ie929debaaa74b0d8460b508199e842a244e090fa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-09-21 14:48:40 -07:00
parent a56f73febb
commit a65aafd006
4 changed files with 141 additions and 0 deletions

36
autobuild.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e
src=$(readlink -f $(dirname $0))
out=$PWD
MAKEFLAGS=${MAKEFLAGS:--j16}
DPDK_DIR=/usr/local/dpdk-2.1.0/x86_64-native-linuxapp-gcc
cd $src
scanbuild=''
if hash scan-build; then
scanbuild="scan-build -o $out/scan-build-tmp"
fi
make $MAKEFLAGS clean
time $scanbuild make $MAKEFLAGS DPDK_DIR=$DPDK_DIR
if [ -d $out/scan-build-tmp ]; then
scanoutput=$(ls -1 $out/scan-build-tmp/)
mv $out/scan-build-tmp/$scanoutput $out/scan-build
rmdir $out/scan-build-tmp
chmod -R a+rX $out/scan-build
fi
if hash doxygen; then
(cd "$src"/doc; make $MAKEFLAGS)
mkdir -p "$out"/doc
for d in "$src"/doc/output.*; do
component=$(basename "$d" | sed -e 's/^output.//')
mv "$d"/html "$out"/doc/$component
rm -rf "$d"
done
fi

36
autopackage.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -xe
DPDK_DIR=/usr/local/dpdk-2.1.0/x86_64-native-linuxapp-gcc
src=$(readlink -f $(dirname $0))
out=$PWD
MAKEFLAGS=${MAKEFLAGS:--j16}
cd $src
make clean
if [ `git status --porcelain | wc -l` -ne 0 ]; then
echo make clean left the following files:
git status --porcelain
exit 1
fi
pv=spdk-$(date +%Y_%m_%d)
find . -iname "spdk-*.tar.gz" -delete
git archive HEAD -9 --prefix=${pv}/ -o ${pv}.tar.gz
tarball=$(ls -1 spdk-*.tar.gz)
if [ $PWD != $out ]; then
mv $tarball $out/
fi
# Build from packaged source
tmpdir=$(mktemp -d)
echo "tmpdir=$tmpdir"
tar -C "$tmpdir" -xf $out/$tarball
(cd "$tmpdir"/spdk-* && time make ${MAKEFLAGS} DPDK_DIR=$DPDK_DIR)
rm -rf "$tmpdir"

53
autotest.sh Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env bash
rootdir=$(readlink -f $(dirname $0))
source "$rootdir/scripts/autotest_common.sh"
set -xe
if [ $EUID -ne 0 ]; then
echo "$0 must be run as root"
exit 1
fi
timing_enter autotest
src=$(readlink -f $(dirname $0))
out=$PWD
cd $src
# set up huge pages
timing_enter afterboot
./scripts/configure_hugepages.sh 3072
timing_exit afterboot
lsmod | grep -q ^nvme && rmmod nvme || true
#####################
# Unit Tests
#####################
timing_enter lib
time test/lib/nvme/nvme.sh
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
timing_exit autotest
chmod a+r $output_dir/timing.txt
# catch any stray core files
process_core

16
scripts/configure_hugepages.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
if [ "$1" = "" ]; then
NRHUGE=1024
else
NRHUGE="$1"
fi
if mount | grep -qv hugetlbfs; then
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
fi
echo $NRHUGE > /proc/sys/vm/nr_hugepages