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
* Making the code config.h compliant
  • Loading branch information
shamisp authored and Pavel Shamis (Pasha) committed Nov 11, 2014
1 parent 9cc6c8b commit 6030b49
Show file tree
Hide file tree
Showing 20 changed files with 143 additions and 102 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-2014. 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-2014. 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
14 changes: 12 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,17 @@ config_flags="$*"
valgrind_libpath=""

AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.10 foreign tar-ustar silent-rules subdir-objects])

AH_TOP([
#ifndef UCX_CONFIG_H
#define UCX_CONFIG_H
])

AH_BOTTOM([
#endif /* UCX_CONFIG_H */
])

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
4 changes: 2 additions & 2 deletions contrib/configure-devel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
#
# Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand All @@ -14,7 +14,7 @@
basedir=$(cd $(dirname $0) && pwd)
$basedir/../configure \
--enable-gtest \
--with-valgrind \
--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-2014. ALL RIGHTS RESERVED.
#
# Copyright (C) 2014 Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED.
# $COPYRIGHT$
# $HEADER$
#
Expand Down Expand Up @@ -84,9 +84,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
1 change: 1 addition & 0 deletions src/ucs/debug/instrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <ucs/sys/preprocessor.h>
#include <ucs/time/time.h>

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
5 changes: 4 additions & 1 deletion src/ucs/gtest/main.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/**
* 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" {
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <ucs/sys/sys.h>
}

Expand Down
1 change: 0 additions & 1 deletion src/ucs/stats/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# include "config.h"
#endif


void ucs_stats_init();
void ucs_stats_cleanup();
void ucs_stats_dump();
Expand Down
2 changes: 1 addition & 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
9 changes: 6 additions & 3 deletions 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 All @@ -74,14 +77,14 @@ static inline struct ibv_mr *ibv_exp_reg_mr(struct ibv_exp_reg_mr_in *in)
}

# define IBV_IS_MPAGES_AVAIL(_attr) ((_attr)->exp_device_cap_flags & IBV_EXP_DEVICE_MR_ALLOCATE)
# define IBV_DEVICE_HAS_DC(_attr) ((_attr)->exp_device_cap_flags & IBV_EXP_DEVICE_DC_TRANSPORT)
# define IBV_DEVICE_HAS_DC(_attr) 0
# define IBV_EXP_REG_MR_FLAGS(_f, _e) ((_f) | (_e))
# define IBV_SHARED_MR_ACCESS_FLAGS(_shared_mr) ((_shared_mr)->exp_access)
# define IBV_EXP_DEVICE_ATTR_SET_COMP_MASK(_attr)
# define IBV_EXP_PORT_ATTR_SET_COMP_MASK(_attr)
#else
# define IBV_IS_MPAGES_AVAIL(_attr) ((_attr)->device_cap_flags2 & IBV_EXP_DEVICE_MR_ALLOCATE)
# define IBV_DEVICE_HAS_DC(_attr) 0
# define IBV_DEVICE_HAS_DC(_attr) ((_attr)->exp_device_cap_flags & IBV_EXP_DEVICE_DC_TRANSPORT)
# define IBV_EXP_REG_MR_FLAGS(_f, _e) (_f) , (_e)
# define IBV_SHARED_MR_ACCESS_FLAGS(_shared_mr) ((_shared_mr)->access)
# define IBV_EXP_DEVICE_ATTR_SET_COMP_MASK(_attr) (_attr)->comp_mask = (IBV_EXP_DEVICE_ATTR_RESERVED - 1)
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 6030b49

Please sign in to comment.