Skip to content

Commit

Permalink
Merge pull request #48 from GBuella/use_pmemfile_in_travis_tests
Browse files Browse the repository at this point in the history
Use pmemfile in travis tests
  • Loading branch information
Sarah Jelinek authored Sep 11, 2017
2 parents e7dfb66 + 52617d2 commit bb826f5
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 1 deletion.
15 changes: 15 additions & 0 deletions utils/docker/images/Dockerfile.fedora-25
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ RUN dnf install -y \
cmake \
gcc \
git \
libcap-devel \
libunwind-devel \
make \
pandoc \
perl-Text-Diff \
rpm-build \
passwd \
sudo \
sqlite \
tcl-devel \
wget \
which \
whois

Expand All @@ -60,8 +66,17 @@ RUN useradd -m $USER
RUN echo $USERPASS | passwd $USER --stdin
RUN gpasswd wheel -a $USER

# Install nvml
COPY install-nvml.sh install-nvml.sh
RUN ./install-nvml.sh rpm

USER $USER

# Build pmemfile
COPY libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h
COPY build-pmemfile.sh build-pmemfile.sh
RUN ./build-pmemfile.sh

# Set required environment variables
ENV OS fedora
ENV OS_VER 25
Expand Down
20 changes: 20 additions & 0 deletions utils/docker/images/Dockerfile.ubuntu-16.04
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,27 @@ MAINTAINER gabor.buella@intel.com
# Update the Apt cache and install basic tools
RUN apt-get update
RUN apt-get install -y \
autoconf \
automake \
clang \
curl \
cmake \
debhelper \
devscripts \
doxygen \
git \
libcap-dev \
libcapstone-dev \
libunwind-dev \
pandoc \
libtext-diff-perl \
pkg-config \
debhelper \
devscripts \
ruby \
sudo \
sqlite3 \
tcl-dev \
wget \
whois

Expand All @@ -61,8 +71,18 @@ ENV USER user
ENV USERPASS pass
RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`


# Install nvml
COPY install-nvml.sh install-nvml.sh
RUN ./install-nvml.sh dpkg

USER $USER

# Build pmemfile
COPY libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h
COPY build-pmemfile.sh build-pmemfile.sh
RUN ./build-pmemfile.sh

# Set required environment variables
ENV OS ubuntu
ENV OS_VER 16.04
Expand Down
2 changes: 2 additions & 0 deletions utils/docker/images/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ if [[ ! -f "Dockerfile.$os_ver" ]]; then
exit 1
fi

cp ../../../include/libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h

# Build a Docker image tagged with PROJECT/OS:VER
tag=${DOCKER_USER}/${PROJECT}_$1
sudo docker build -t $tag \
Expand Down
92 changes: 92 additions & 0 deletions utils/docker/images/build-pmemfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash -ex
#
# Copyright 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#
# build-pmemfile.sh - builds libpmemfile
#

# libpmemfile needs syscall_intercept to build, so create a mock library
# that looks like libsyscall_intercept (as long as it is used for linking
# with, not for executing).
mkdir -p ~/mock_syscall_intercept
cp libsyscall_intercept_hook_point.h ~/mock_syscall_intercept/.

cd
cd mock_syscall_intercept

echo int intercept_hook_point\; > mock_syscall_intercept.c
echo int intercept_hook_point_clone_child\; >> mock_syscall_intercept.c
echo int syscall_no_intercept\(void\) \{return 0\;\} >> mock_syscall_intercept.c
echo int syscall_hook_in_process_allowed\(void\) \{return 0\;\} >> mock_syscall_intercept.c

gcc -xc -nostdlib -shared mock_syscall_intercept.c -o libsyscall_intercept.so

echo Name: libsyscall_intercept > libsyscall_intercept.pc
echo Version: mock >> libsyscall_intercept.pc
echo Description: Mock libsyscall_intercept >> libsyscall_intercept.pc
echo includedir=$PWD >> libsyscall_intercept.pc
echo Libs: -L$PWD -lsyscall_intercept >> libsyscall_intercept.pc
echo Cflags: -I$PWD >> libsyscall_intercept.pc

# Set some environment variables, allowing cmake to find the mock library
export LD_LIBRARY_PATH=$PWD
export PKG_CONFIG_PATH=$PWD

cd

# Build pmemfile.
# The tests from pmemfile repo are going to be used, so there is no point
# in calling `make install`.
# Trying to make a minimal build here, not needing libpmemfile-posix tests,
# antool tests.
git clone https://github.com/pmem/pmemfile.git
cd pmemfile
git checkout a7f1d347bfdbabec3b0e0b1dca50542ec6c267e3
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_LIBPMEMFILE=ON \
-DAUTO_GENERATE_SOURCES=OFF \
-DTESTS_USE_FORCED_PMEM=ON \
-DDEVELOPER_MODE=OFF \
-DFAULT_INJECTION=OFF \
-DLONG_TESTS=OFF \
-DTRACE_TESTS=ON \
-DUSE_ASAN=OFF \
-DUSE_UBSAN=OFF \
-DANTOOL_TESTS=SKIP \
-DBUILD_LIBPMEMFILE_POSIX_TESTS=OFF \
-DBUILD_LIBPMEMFILE_TESTS=ON \
..
make
cd
rm -rf mock_syscall_intercept
51 changes: 51 additions & 0 deletions utils/docker/images/install-nvml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -ex
#
# Copyright 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#
# install-nvml.sh - installs libpmem & libpmemobj
#

mkdir nvml
cd nvml

if [ "$1" = "dpkg" ]; then
wget https://github.com/pmem/nvml/releases/download/1.3/nvml-1.3-dpkgs.tar.gz
tar -xzf nvml-1.3-dpkgs.tar.gz
sudo dpkg -i libpmem_*.deb libpmem-dev_*.deb libpmemobj_*.deb libpmemobj-dev_*.deb
elif [ "$1" = "rpm" ]; then
wget https://github.com/pmem/nvml/releases/download/1.3/nvml-1.3-rpms.tar.gz
tar -xzf nvml-1.3-rpms.tar.gz
sudo rpm -i x86_64/libpmem-*.rpm x86_64/libpmemobj-*.rpm
fi

cd ..
rm -rf nvml
12 changes: 11 additions & 1 deletion utils/docker/run-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ CC=gcc cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \

make
ctest --output-on-failure
bash <(curl -s https://codecov.io/bash)
bash <(curl -s https://codecov.io/bash) -c -F regular_tests
find . -name ".coverage" -exec rm {} \;
find . -name "coverage.xml" -exec rm {} \;
find . -name "*.gcov" -exec rm {} \;
find . -name "*.gcda" -exec rm {} \;

pushd ~/pmemfile/build
LD_LIBRARY_PATH=$WORKDIR/build ctest --output-on-failure -R preload_
popd
bash <(curl -s https://codecov.io/bash) -c -F pmemfile_tests

cd ..
rm -r build

0 comments on commit bb826f5

Please sign in to comment.