Skip to content

Commit

Permalink
BUILD: apply comments from PR
Browse files Browse the repository at this point in the history
add jenkins script which can be executed as ./contrib/test_jenkins.sh
detect/add mlnx valgrind libs
  • Loading branch information
mike-dubman committed Nov 5, 2014
1 parent 42d17c1 commit ef63824
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 7 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ EXTRA_DIST += config/m4/ib.m4
EXTRA_DIST += config/m4/sysdep.m4
EXTRA_DIST += contrib/configure-devel
EXTRA_DIST += contrib/configure-release
EXTRA_DIST += contrib/configure-prof

6 changes: 6 additions & 0 deletions config/m4/ib.m4
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,9 @@ AC_CHECK_HEADER([infiniband/verbs_exp.h],
#
AM_CONDITIONAL([HAVE_IB], [test "x$with_ib" != xno])
AM_CONDITIONAL([HAVE_TL_RC], [test "x$with_rc" != xno])

mlnx_valg_libdir=/usr/lib64/mlnx_ofed/valgrind
AS_IF([test -d "$mlnx_valg_libdir"],
[AC_MSG_NOTICE([Added $mlnx_valg_libdir to valgrind LD_LIBRARY_PATH])
valgrind_libpath="$mlnx_valg_libdir:$valgrind_libpath"])

7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ define([libucx_so_version], 2:1:0)
AC_INIT([ucx], [ucx_ver_major.ucx_ver_minor])

config_flags="$*"
valgrind_libpath=""

AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.10 foreign tar-ustar silent-rules subdir-objects])
Expand Down Expand Up @@ -157,6 +158,12 @@ AC_ARG_ENABLE([debug-data],
[AC_DEFINE([ENABLE_DEBUG_DATA], [0])])


#
# Path for valgrind-enabled libraries
#
AC_SUBST([VALGRIND_LIBPATH], [${valgrind_libpath}])


#
# Print which transports are built
#
Expand Down
73 changes: 73 additions & 0 deletions contrib/test_jenkins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash -eExl

rc=0

if [ -z "$BUILD_NUMBER" ]; then
echo Running interactive
WORKSPACE=$PWD
BUILD_NUMBER=1
JOB_URL=$WORKSPACE
else
echo Running under jenkins
fi

rpm_topdir=$WORKSPACE/rpm-dist

make_opt="-j$(($(nproc) - 1))"

echo Starting on host: $(hostname)

echo "Autogen"
./autogen.sh

echo "Build release"
./contrib/configure-release && make $make_opt && make $make_opt distcheck

echo "Build gtest "
make clean && ./contrib/configure-devel && make $make_opt

echo "Starting gtest"

make -C test/gtest test

module load tools/valgrind-3.9.0
make -C test/gtest VALGRIND_EXTRA_ARGS="--xml=yes --xml-file=valgrind.xml" test_valgrind
module unload tools/valgrind-3.9.0


echo "Build with coverity"
module load tools/cov
cov_build_id="cov_build_${BUILD_NUMBER}"
cov_build="$WORKSPACE/$cov_build_id"
rm -rf $cov_build
make clean
cov-build --dir $cov_build make $make_opt all
nerrors=$(cov-analyze --dir $cov_build |grep "Defect occurrences found" | awk '{print $5}')
cov-format-errors --dir $cov_build
rc=$(($rc+$nerrors))

cov_url="$JOB_URL/ws/$cov_build_id/c/output/errors/index.html"
rm -f jenkins_sidelinks.txt
echo 1..1 > coverity.tap
if [ $nerrors -gt 0 ]; then
echo "not ok 1 Coverity Detected $nerrors failures # $cov_url" >> coverity.tap
else
echo ok 1 Coverity found no issues >> coverity.tap
fi
echo Coverity report: $cov_url
printf "%s\t%s\n" Coverity $cov_url >> jenkins_sidelinks.txt
module unload tools/cov

#(make distcheck && rm -rf $rpm_topdir && mkdir -p $rpm_topdir && cd $rpm_topdir && mkdir -p BUILD RPMS SOURCES SPECS SRPMS)
#
#if [ -x /usr/bin/dpkg-buildpackage ]; then
# echo "Build on debian"
# dpkg-buildpackage -us -uc
#else
# echo "Build rpms"
# rpmbuild -bs --define '_sourcedir .' --define "_topdir $rpm_topdir" --nodeps mxm.spec
# fn=$(find $rpm_topdir -name "*.src.rpm" -print0)
# rpmbuild --define "_topdir $rpm_topdir" --rebuild $fn
#fi

exit $rc
10 changes: 3 additions & 7 deletions test/gtest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export UCS_HANDLE_ERRORS
GTEST_FILTER ?= *
export GTEST_FILTER

VALGRIND_EXTRA_ARGS = --xml=yes --xml-file=valgrind.xml
#VALGRIND_EXTRA_ARGS = --xml=yes --xml-file=valgrind.xml
VALGRIND_EXTRA_ARGS =

VALGRIND_ARGS = \
--tool=memcheck \
Expand Down Expand Up @@ -73,9 +74,4 @@ list: gtest
$(abs_builddir)/gtest --gtest_list_tests --gtest_filter=$(GTEST_FILTER)

test_valgrind: uct gtest
. /usr/share/Modules/init/sh && \
env LD_LIBRARY_PATH=/usr/lib64/mlnx_ofed/valgrind:${LD_LIBRARY_PATH} valgrind $(VALGRIND_ARGS) $(abs_builddir)/gtest --gtest_filter=$(GTEST_FILTER)

test_jenkins_valgrind: uct gtest
valgrind $(VALGRIND_ARGS) $(VALGRIND_EXTRA_ARGS) $(abs_builddir)/gtest --gtest_filter=$(GTEST_FILTER)

env LD_LIBRARY_PATH="$(VALGRIND_LIBPATH):${LD_LIBRARY_PATH}" valgrind $(VALGRIND_ARGS) $(VALGRIND_EXTRA_ARGS) $(abs_builddir)/gtest --gtest_filter=$(GTEST_FILTER)

0 comments on commit ef63824

Please sign in to comment.