From 8f99ccc5d80835297e8e948842ab6e84ab49c9b6 Mon Sep 17 00:00:00 2001 From: yosefe Date: Thu, 30 Oct 2014 17:47:23 +0200 Subject: [PATCH] TEST/BUILD: Fix release build --- Makefile.am | 6 +++++- src/ucs/Makefile.am | 33 ++++++++++++++++++++------------- src/ucs/gtest/test_helpers.cc | 1 + src/ucs/stats/stats.c | 23 +++++++++++++++++++++++ 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1c369273378..c4ab5aea469 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,11 @@ ACLOCAL_AMFLAGS = -I config/m4 -SUBDIRS = src/ucs src/uct test/gtest +SUBDIRS = src/ucs src/uct + +if HAVE_GTEST +SUBDIRS += test/gtest +endif EXTRA_DIST = EXTRA_DIST += m4/gtest.m4 diff --git a/src/ucs/Makefile.am b/src/ucs/Makefile.am index 708b1afd19d..6efa4dc0ea4 100644 --- a/src/ucs/Makefile.am +++ b/src/ucs/Makefile.am @@ -7,17 +7,13 @@ AUTOMAKE_OPTIONS = nostdinc # avoid collision with built-in debug.h AM_CPPFLAGS = -I$(top_builddir) -I$(abs_top_srcdir)/src -lib_LTLIBRARIES = libucs.la libucstest.la -bin_PROGRAMS = ucs_stats_parser +lib_LTLIBRARIES = libucs.la +bin_PROGRAMS = libucs_la_LDFLAGS = -ldl -version-info $(SOVERSION) libucs_la_LIBADD = $(LIBM) libucs_ladir = $(includedir) -libucstest_la_LDFLAGS = -ldl -version-info $(SOVERSION) -libucstest_la_LIBADD = libucs.la -libucstest_ladir = $(includedir) - noinst_HEADERS = \ config/global_opts.h \ config/parser.h \ @@ -64,10 +60,7 @@ libucs_la_SOURCES = \ debug/instrument.c \ debug/log.c \ debug/memtrack.c \ - stats/client_server.c \ - stats/serialization.c \ stats/stats.c \ - stats/libstats.c \ sys/math.c \ sys/sys.c \ time/time.c \ @@ -77,13 +70,27 @@ libucs_la_SOURCES = \ type/component.c \ type/status.c -libucstest_la_SOURCES = \ +if HAVE_STATS +libucs_la_SOURCES += \ + stats/client_server.c \ + stats/serialization.c \ + stats/libstats.c + +bin_PROGRAMS += ucs_stats_parser +ucs_stats_parser_LDADD = libucs.la +ucs_stats_parser_SOURCES = stats/stats_parser.c +endif + +if HAVE_GTEST +lib_LTLIBRARIES += libucstest.la +libucstest_la_LDFLAGS = -ldl -version-info $(SOVERSION) +libucstest_la_LIBADD = libucs.la +libucstest_ladir = $(includedir) +libucstest_la_SOURCES = \ gtest/main.cc \ gtest/test_helpers.cc \ gtest/test.cc - -ucs_stats_parser_LDADD = libucs.la -ucs_stats_parser_SOURCES = stats/stats_parser.c +endif #TODO stats/stats_dump.c diff --git a/src/ucs/gtest/test_helpers.cc b/src/ucs/gtest/test_helpers.cc index 6512832781f..16fb415f6c6 100644 --- a/src/ucs/gtest/test_helpers.cc +++ b/src/ucs/gtest/test_helpers.cc @@ -8,6 +8,7 @@ #include "test_helpers.h" extern "C" { +#include #include } diff --git a/src/ucs/stats/stats.c b/src/ucs/stats/stats.c index e127e2fad3f..d2da176426f 100644 --- a/src/ucs/stats/stats.c +++ b/src/ucs/stats/stats.c @@ -17,6 +17,8 @@ #include +#if ENABLE_STATS + enum { UCS_STATS_FLAG_ON_EXIT = UCS_BIT(0), UCS_STATS_FLAG_ON_TIMER = UCS_BIT(1), @@ -442,3 +444,24 @@ int ucs_stats_is_active() { return ucs_stats_context.flags & (UCS_STATS_FLAG_SOCKET|UCS_STATS_FLAG_STREAM); } + +#else + +void mxm_stats_init() +{ +} + +void mxm_stats_cleanup() +{ +} + +void mxm_stats_dump() +{ +} + +int mxm_stats_is_active() +{ + return 0; +} + +#endif