Skip to content

Commit

Permalink
Fixing multiple build issues on non-mlnx systems
Browse files Browse the repository at this point in the history
* Autotools scripts were updated
* Fixing multiple warnings in gtests
* Other minor issue
  • Loading branch information
shamisp authored and Pavel Shamis (Pasha) committed Nov 10, 2014
1 parent a4f304f commit b82cc21
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 99 deletions.
6 changes: 3 additions & 3 deletions config/m4/ib.m4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
#
# Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand Down Expand Up @@ -55,11 +55,11 @@ AS_IF([test "x$with_dc" != xno],
#
AS_IF([test "x$with_ib" != xno],
[AC_CHECK_HEADER([infiniband/verbs.h], [],
[AC_MSG_ERROR([ibverbs header files not found]);with_ib=no])
[AC_MSG_WARN([ibverbs header files not found]);with_ib=no])
save_LDFLAGS="$LDFLAGS"
AC_CHECK_LIB([ibverbs], [ibv_get_device_list],
[AC_SUBST(IBVERBS_LDFLAGS, [-libverbs])],
[AC_MSG_ERROR([libibverbs not found]);with_ib=no])
[AC_MSG_WARN([libibverbs not found]);with_ib=no])
LDFLAGS="$save_LDFLAGS"
])
AS_IF([test "x$with_ib" != xno],
Expand Down
22 changes: 19 additions & 3 deletions config/m4/sysdep.m4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
#
# Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand Down Expand Up @@ -66,10 +66,24 @@ GTEST_LIB_CHECK([1.5.0], [true], [true])
#
# Boost C++ library (if we're using gtest)
#
AC_ARG_WITH([boost],
AC_HELP_STRING([--with-boost],
[Enable Boost C++ library (required by gtest)]),
[],
[with_boost=no])

if test "x$HAVE_GTEST" = "xyes"; then

AC_LANG_PUSH([C++])
AC_MSG_CHECKING([for boost])
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([for boost])

AS_IF([test "x$with_boost" != xno],
[GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$with_boost"
GTEST_LDFLAGS="$GTEST_LDFLAGS -L$with_boost/stage/lib"],[])

ORIG_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$GTEST_CPPFLAGS $CXXFLAGS"

AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <boost/version.hpp>]]
[[
Expand All @@ -82,6 +96,8 @@ if test "x$HAVE_GTEST" = "xyes"; then

AC_CHECK_DECLS([BOOST_FOREACH], [], AC_MSG_ERROR([BOOST_FOREACH not supported]),
[#include <boost/foreach.hpp>])

CXXFLAGS=$ORIG_CXXFLAGS
AC_LANG_POP
fi

Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
#
# Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand All @@ -22,7 +22,7 @@ config_flags="$*"
valgrind_libpath=""

AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.10 foreign tar-ustar silent-rules subdir-objects])
AM_INIT_AUTOMAKE([1.10 foreign tar-ustar subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([config/m4])
Expand Down
3 changes: 1 addition & 2 deletions contrib/configure-devel
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
#
# Copyright (c) 2014 Copyright (c) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand All @@ -14,7 +14,6 @@
basedir=$(cd $(dirname $0) && pwd)
$basedir/../configure \
--enable-gtest \
--with-valgrind \
--enable-instrumentation \
--enable-frame-pointer \
--enable-stats \
Expand Down
12 changes: 10 additions & 2 deletions src/ucs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
#
# Copyright (C) 2014 Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand Down Expand Up @@ -83,9 +83,17 @@ endif

if HAVE_GTEST
lib_LTLIBRARIES += libucstest.la
libucstest_la_LDFLAGS = -ldl -version-info $(SOVERSION)
libucstest_la_LDFLAGS = -ldl -version-info \
$(SOVERSION) \
$(GTEST_LDFLAGS)
libucstest_la_CPPFLAGS = -I$(top_builddir) -I$(abs_top_srcdir)/src \
$(GTEST_CPPFLAGS)
libucstest_la_CXXFLAGS = $(GTEST_CXXFLAGS)
libucstest_la_LIBADD = libucs.la
$(GTEST_LIBS) \
$(BOOST_THREAD_LIB)
libucstest_ladir = $(includedir)

libucstest_la_SOURCES = \
gtest/main.cc \
gtest/test_helpers.cc \
Expand Down
3 changes: 2 additions & 1 deletion src/ucs/debug/memtrack.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2013. ALL RIGHTS RESERVED.
*
* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
* $COPYRIGHT$
* $HEADER$
*/
Expand All @@ -11,6 +11,7 @@
#include <ucs/sys/sys.h>
#include <ucs/stats/stats.h>
#include <stdio.h>
#include <sys/types.h>


enum {
Expand Down
7 changes: 6 additions & 1 deletion src/ucs/gtest/main.cc
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2013. ALL RIGHTS RESERVED.
*
* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
* $COPYRIGHT$
* $HEADER$
*/

#include <gtest/gtest.h>
#include <boost/noncopyable.hpp>
extern "C" {
#include "config.h"
#include <ucs/sys/sys.h>
}

class valgrind_errors_Test : public ::testing::Test, boost::noncopyable {
private:
virtual void TestBody() {
long leaked, dubious, reachable, suppressed, errors;
#if !NVALGRIND
errors = VALGRIND_COUNT_ERRORS;
VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed);
#endif
EXPECT_EQ(0, errors);
EXPECT_EQ(0, leaked);
(void)dubious;
Expand All @@ -42,6 +45,7 @@ void parse_test_opts(int argc, char **argv) {
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);

#if !NVALGRIND
if (RUNNING_ON_VALGRIND) {
::testing::internal::MakeAndRegisterTestInfo(
"valgrind", "errors", "", "",
Expand All @@ -50,6 +54,7 @@ int main(int argc, char **argv) {
::testing::Test::TearDownTestCase,
new ::testing::internal::TestFactoryImpl<valgrind_errors_Test>);
}
#endif
parse_test_opts(argc, argv);
return RUN_ALL_TESTS();
}
4 changes: 3 additions & 1 deletion src/uct/ib/base/ib_device.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
* $COPYRIGHT$
* $HEADER$
*/
Expand Down Expand Up @@ -237,11 +237,13 @@ ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
return UCS_ERR_UNREACHABLE;
}

#if HAVE_VERBS_EXP_H
if (flags & UCT_IB_RESOURCE_FLAG_DC) {
if (!IBV_DEVICE_HAS_DC(&dev->dev_attr)) {
return UCS_ERR_UNSUPPORTED;
}
}
#endif

if (flags & UCT_IB_RESOURCE_FLAG_MLX4_PRM) {
return UCS_ERR_UNSUPPORTED; /* Unsupported yet */
Expand Down
5 changes: 4 additions & 1 deletion src/uct/ib/base/ib_verbs.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
* $COPYRIGHT$
* $HEADER$
*/
Expand Down Expand Up @@ -58,6 +58,9 @@
# define IBV_EXP_WR_ATOMIC_FETCH_AND_ADD IBV_WR_ATOMIC_FETCH_AND_ADD
# define IBV_EXP_WR_ATOMIC_CMP_AND_SWP IBV_WR_ATOMIC_CMP_AND_SWP
# define ibv_exp_qp_init_attr ibv_qp_init_attr
# define ibv_exp_port_attr ibv_port_attr
# define ibv_exp_query_port ibv_query_port
# define exp_device_cap_flags device_cap_flags
# define ibv_exp_create_qp ibv_create_qp

struct ibv_exp_reg_mr_in {
Expand Down
30 changes: 15 additions & 15 deletions test/gtest/ucs/test_config.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
* $COPYRIGHT$
* $HEADER$
*/
Expand Down Expand Up @@ -163,14 +163,14 @@ class test_config : public ucs::test {
UCS_TEST_F(test_config, parse_default) {
car_opts opts("TEST");

EXPECT_EQ(999, opts->price);
EXPECT_EQ((unsigned)999, opts->price);
EXPECT_EQ(std::string("Chevy"), opts->brand);
EXPECT_EQ(std::string("Corvette"), opts->model);
EXPECT_EQ(COLOR_RED, opts->color);
EXPECT_EQ(6000, opts->engine.volume);
EXPECT_EQ(COLOR_RED, opts->coach.driver_seat.color);
EXPECT_EQ(COLOR_BLUE, opts->coach.passenger_seat.color);
EXPECT_EQ(COLOR_BLACK, opts->coach.rear_seat.color);
EXPECT_EQ((unsigned)COLOR_RED, opts->color);
EXPECT_EQ((unsigned)6000, opts->engine.volume);
EXPECT_EQ((unsigned)COLOR_RED, opts->coach.driver_seat.color);
EXPECT_EQ((unsigned)COLOR_BLUE, opts->coach.passenger_seat.color);
EXPECT_EQ((unsigned)COLOR_BLACK, opts->coach.rear_seat.color);

}

Expand All @@ -181,10 +181,10 @@ UCS_TEST_F(test_config, parse_with_prefix) {
ucs::scoped_setenv env4("UCS_TEST_REAR_COLOR", "white");

car_opts dfl, test("TEST");
EXPECT_EQ(COLOR_WHITE, dfl->color);
EXPECT_EQ(COLOR_BLACK, test->color);
EXPECT_EQ(COLOR_YELLOW, test->coach.driver_seat.color);
EXPECT_EQ(COLOR_WHITE, test->coach.rear_seat.color);
EXPECT_EQ((unsigned)COLOR_WHITE, dfl->color);
EXPECT_EQ((unsigned)COLOR_BLACK, test->color);
EXPECT_EQ((unsigned)COLOR_YELLOW, test->coach.driver_seat.color);
EXPECT_EQ((unsigned)COLOR_WHITE, test->coach.rear_seat.color);
}

UCS_TEST_F(test_config, clone) {
Expand All @@ -194,21 +194,21 @@ UCS_TEST_F(test_config, clone) {
{
ucs::scoped_setenv env1("UCS_TEST_COLOR", "white");
car_opts opts("TEST");
EXPECT_EQ(COLOR_WHITE, opts->color);
EXPECT_EQ((unsigned)COLOR_WHITE, opts->color);

ucs::scoped_setenv env2("UCS_TEST_COLOR", "black");
opts_clone_ptr = boost::make_shared<car_opts>(opts);
}

EXPECT_EQ(COLOR_WHITE, (*opts_clone_ptr)->color);
EXPECT_EQ((unsigned)COLOR_WHITE, (*opts_clone_ptr)->color);
}

UCS_TEST_F(test_config, set) {
car_opts opts("TEST");
EXPECT_EQ(COLOR_RED, opts->color);
EXPECT_EQ((unsigned)COLOR_RED, opts->color);

opts.set("COLOR", "white");
EXPECT_EQ(COLOR_WHITE, opts->color);
EXPECT_EQ((unsigned)COLOR_WHITE, opts->color);

}

Expand Down
Loading

0 comments on commit b82cc21

Please sign in to comment.