Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit bb826f5

Browse files
author
Sarah Jelinek
authored
Merge pull request #48 from GBuella/use_pmemfile_in_travis_tests
Use pmemfile in travis tests
2 parents e7dfb66 + 52617d2 commit bb826f5

File tree

6 files changed

+191
-1
lines changed

6 files changed

+191
-1
lines changed

utils/docker/images/Dockerfile.fedora-25

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,17 @@ RUN dnf install -y \
4545
cmake \
4646
gcc \
4747
git \
48+
libcap-devel \
49+
libunwind-devel \
4850
make \
4951
pandoc \
52+
perl-Text-Diff \
5053
rpm-build \
5154
passwd \
5255
sudo \
56+
sqlite \
57+
tcl-devel \
58+
wget \
5359
which \
5460
whois
5561

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

69+
# Install nvml
70+
COPY install-nvml.sh install-nvml.sh
71+
RUN ./install-nvml.sh rpm
72+
6373
USER $USER
6474

75+
# Build pmemfile
76+
COPY libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h
77+
COPY build-pmemfile.sh build-pmemfile.sh
78+
RUN ./build-pmemfile.sh
79+
6580
# Set required environment variables
6681
ENV OS fedora
6782
ENV OS_VER 25

utils/docker/images/Dockerfile.ubuntu-16.04

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,27 @@ MAINTAINER gabor.buella@intel.com
4141
# Update the Apt cache and install basic tools
4242
RUN apt-get update
4343
RUN apt-get install -y \
44+
autoconf \
45+
automake \
4446
clang \
4547
curl \
4648
cmake \
49+
debhelper \
50+
devscripts \
51+
doxygen \
4752
git \
53+
libcap-dev \
4854
libcapstone-dev \
55+
libunwind-dev \
4956
pandoc \
57+
libtext-diff-perl \
5058
pkg-config \
5159
debhelper \
5260
devscripts \
5361
ruby \
5462
sudo \
63+
sqlite3 \
64+
tcl-dev \
5565
wget \
5666
whois
5767

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

74+
75+
# Install nvml
76+
COPY install-nvml.sh install-nvml.sh
77+
RUN ./install-nvml.sh dpkg
78+
6479
USER $USER
6580

81+
# Build pmemfile
82+
COPY libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h
83+
COPY build-pmemfile.sh build-pmemfile.sh
84+
RUN ./build-pmemfile.sh
85+
6686
# Set required environment variables
6787
ENV OS ubuntu
6888
ENV OS_VER 16.04

utils/docker/images/build-image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ if [[ ! -f "Dockerfile.$os_ver" ]]; then
6161
exit 1
6262
fi
6363

64+
cp ../../../include/libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h
65+
6466
# Build a Docker image tagged with PROJECT/OS:VER
6567
tag=${DOCKER_USER}/${PROJECT}_$1
6668
sudo docker build -t $tag \
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash -ex
2+
#
3+
# Copyright 2017, Intel Corporation
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions
7+
# are met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
#
12+
# * Redistributions in binary form must reproduce the above copyright
13+
# notice, this list of conditions and the following disclaimer in
14+
# the documentation and/or other materials provided with the
15+
# distribution.
16+
#
17+
# * Neither the name of the copyright holder nor the names of its
18+
# contributors may be used to endorse or promote products derived
19+
# from this software without specific prior written permission.
20+
#
21+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
33+
#
34+
# build-pmemfile.sh - builds libpmemfile
35+
#
36+
37+
# libpmemfile needs syscall_intercept to build, so create a mock library
38+
# that looks like libsyscall_intercept (as long as it is used for linking
39+
# with, not for executing).
40+
mkdir -p ~/mock_syscall_intercept
41+
cp libsyscall_intercept_hook_point.h ~/mock_syscall_intercept/.
42+
43+
cd
44+
cd mock_syscall_intercept
45+
46+
echo int intercept_hook_point\; > mock_syscall_intercept.c
47+
echo int intercept_hook_point_clone_child\; >> mock_syscall_intercept.c
48+
echo int syscall_no_intercept\(void\) \{return 0\;\} >> mock_syscall_intercept.c
49+
echo int syscall_hook_in_process_allowed\(void\) \{return 0\;\} >> mock_syscall_intercept.c
50+
51+
gcc -xc -nostdlib -shared mock_syscall_intercept.c -o libsyscall_intercept.so
52+
53+
echo Name: libsyscall_intercept > libsyscall_intercept.pc
54+
echo Version: mock >> libsyscall_intercept.pc
55+
echo Description: Mock libsyscall_intercept >> libsyscall_intercept.pc
56+
echo includedir=$PWD >> libsyscall_intercept.pc
57+
echo Libs: -L$PWD -lsyscall_intercept >> libsyscall_intercept.pc
58+
echo Cflags: -I$PWD >> libsyscall_intercept.pc
59+
60+
# Set some environment variables, allowing cmake to find the mock library
61+
export LD_LIBRARY_PATH=$PWD
62+
export PKG_CONFIG_PATH=$PWD
63+
64+
cd
65+
66+
# Build pmemfile.
67+
# The tests from pmemfile repo are going to be used, so there is no point
68+
# in calling `make install`.
69+
# Trying to make a minimal build here, not needing libpmemfile-posix tests,
70+
# antool tests.
71+
git clone https://github.com/pmem/pmemfile.git
72+
cd pmemfile
73+
git checkout a7f1d347bfdbabec3b0e0b1dca50542ec6c267e3
74+
mkdir build
75+
cd build
76+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
77+
-DBUILD_LIBPMEMFILE=ON \
78+
-DAUTO_GENERATE_SOURCES=OFF \
79+
-DTESTS_USE_FORCED_PMEM=ON \
80+
-DDEVELOPER_MODE=OFF \
81+
-DFAULT_INJECTION=OFF \
82+
-DLONG_TESTS=OFF \
83+
-DTRACE_TESTS=ON \
84+
-DUSE_ASAN=OFF \
85+
-DUSE_UBSAN=OFF \
86+
-DANTOOL_TESTS=SKIP \
87+
-DBUILD_LIBPMEMFILE_POSIX_TESTS=OFF \
88+
-DBUILD_LIBPMEMFILE_TESTS=ON \
89+
..
90+
make
91+
cd
92+
rm -rf mock_syscall_intercept
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash -ex
2+
#
3+
# Copyright 2017, Intel Corporation
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions
7+
# are met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
#
12+
# * Redistributions in binary form must reproduce the above copyright
13+
# notice, this list of conditions and the following disclaimer in
14+
# the documentation and/or other materials provided with the
15+
# distribution.
16+
#
17+
# * Neither the name of the copyright holder nor the names of its
18+
# contributors may be used to endorse or promote products derived
19+
# from this software without specific prior written permission.
20+
#
21+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
33+
#
34+
# install-nvml.sh - installs libpmem & libpmemobj
35+
#
36+
37+
mkdir nvml
38+
cd nvml
39+
40+
if [ "$1" = "dpkg" ]; then
41+
wget https://github.com/pmem/nvml/releases/download/1.3/nvml-1.3-dpkgs.tar.gz
42+
tar -xzf nvml-1.3-dpkgs.tar.gz
43+
sudo dpkg -i libpmem_*.deb libpmem-dev_*.deb libpmemobj_*.deb libpmemobj-dev_*.deb
44+
elif [ "$1" = "rpm" ]; then
45+
wget https://github.com/pmem/nvml/releases/download/1.3/nvml-1.3-rpms.tar.gz
46+
tar -xzf nvml-1.3-rpms.tar.gz
47+
sudo rpm -i x86_64/libpmem-*.rpm x86_64/libpmemobj-*.rpm
48+
fi
49+
50+
cd ..
51+
rm -rf nvml

utils/docker/run-coverage.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ CC=gcc cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
4646

4747
make
4848
ctest --output-on-failure
49-
bash <(curl -s https://codecov.io/bash)
49+
bash <(curl -s https://codecov.io/bash) -c -F regular_tests
50+
find . -name ".coverage" -exec rm {} \;
51+
find . -name "coverage.xml" -exec rm {} \;
52+
find . -name "*.gcov" -exec rm {} \;
53+
find . -name "*.gcda" -exec rm {} \;
54+
55+
pushd ~/pmemfile/build
56+
LD_LIBRARY_PATH=$WORKDIR/build ctest --output-on-failure -R preload_
57+
popd
58+
bash <(curl -s https://codecov.io/bash) -c -F pmemfile_tests
59+
5060
cd ..
5161
rm -r build

0 commit comments

Comments
 (0)