Skip to content

Commit

Permalink
Merging from master
Browse files Browse the repository at this point in the history
  • Loading branch information
srini009 committed Jun 30, 2020
2 parents c8d73b9 + 1794ba7 commit b7fdd9b
Show file tree
Hide file tree
Showing 77 changed files with 6,240 additions and 5,448 deletions.
18 changes: 18 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
BasedOnStyle: LLVM
UseTab: Never
IndentWidth: 4
TabWidth: 4
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: AfterHash
ColumnLimit: 80
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: true
AlwaysBreakAfterReturnType: All
SpaceAfterCStyleCast: true
ForEachMacros: ['HG_QUEUE_FOREACH', 'HG_LIST_FOREACH']
...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
.vscode
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ cache:
- $HOME/install

env:
global:
- MERCURY_NO_LOOP="true"
jobs:
- MERCURY_BUILD_CONFIGURATION="Debug"
- MERCURY_BUILD_CONFIGURATION="RelWithDebInfo"
Expand All @@ -35,7 +33,7 @@ jobs:
- libtsan0
- libasan5
- liblsan0
env: MERCURY_MEMORYCHECK_TYPE="ThreadSanitizer"
env: MERCURY_BUILD_CONFIGURATION="Tsan"
- os: linux
compiler: gcc
addons:
Expand All @@ -48,7 +46,7 @@ jobs:
- libtsan0
- libasan5
- liblsan0
env: MERCURY_MEMORYCHECK_TYPE="AddressSanitizer"
env: MERCURY_BUILD_CONFIGURATION="Asan"
- os: linux
compiler: gcc
addons:
Expand All @@ -65,6 +63,7 @@ branches:
- master

before_install:
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then git fetch origin pull/${TRAVIS_PULL_REQUEST}/head:pr${TRAVIS_PULL_REQUEST}; git checkout pr${TRAVIS_PULL_REQUEST}; fi
- echo "Existing directories in $HOME" && ls $HOME
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask uninstall --force oclint; fi
Expand Down
37 changes: 37 additions & 0 deletions CMake/CheckAsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
set(ASAN_FLAG "-fsanitize=address")
set(ASAN_C_FLAGS "-O1 -g ${ASAN_FLAG} -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(ASAN_CXX_FLAGS ${ASAN_C_FLAGS})

get_property(ASAN_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach(lang ${ASAN_LANGUAGES})
set(ASAN_${lang}_LANG_ENABLED 1)
endforeach()

if(ASAN_C_LANG_ENABLED)
include(CheckCCompilerFlag)
set(CMAKE_REQUIRED_LINK_OPTIONS ${ASAN_FLAG})
check_c_compiler_flag(${ASAN_FLAG} ASAN_C_FLAG_SUPPORTED)
if(NOT ASAN_C_FLAG_SUPPORTED)
message(STATUS "Asan flags are not supported by the C compiler.")
else()
if(NOT CMAKE_C_FLAGS_ASAN)
set(CMAKE_C_FLAGS_ASAN ${ASAN_C_FLAGS} CACHE STRING "Flags used by the C compiler during ASAN builds." FORCE)
endif()
endif()
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()

if(ASAN_CXX_LANG_ENABLED)
include(CheckCXXCompilerFlag)
set(CMAKE_REQUIRED_LINK_OPTIONS ${ASAN_FLAG})
check_cxx_compiler_flag(${ASAN_FLAG} ASAN_CXX_FLAG_SUPPORTED)
if(NOT ASAN_CXX_FLAG_SUPPORTED)
message(STATUS "Asan flags are not supported by the CXX compiler.")
else()
if(NOT CMAKE_CXX_FLAGS_ASAN)
set(CMAKE_CXX_FLAGS_ASAN ${ASAN_CXX_FLAGS} CACHE STRING "Flags used by the CXX compiler during ASAN builds." FORCE)
endif()
endif()
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()

37 changes: 37 additions & 0 deletions CMake/CheckTsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
set(TSAN_FLAG "-fsanitize=thread")
set(TSAN_C_FLAGS "-O1 -g ${TSAN_FLAG}")
set(TSAN_CXX_FLAGS ${TSAN_C_FLAGS})

get_property(TSAN_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach(lang ${TSAN_LANGUAGES})
set(TSAN_${lang}_LANG_ENABLED 1)
endforeach()

if(TSAN_C_LANG_ENABLED)
include(CheckCCompilerFlag)
set(CMAKE_REQUIRED_LINK_OPTIONS ${TSAN_FLAG})
check_c_compiler_flag(${TSAN_FLAG} TSAN_C_FLAG_SUPPORTED)
if(NOT TSAN_C_FLAG_SUPPORTED)
message(STATUS "Asan flags are not supported by the C compiler.")
else()
if(NOT CMAKE_C_FLAGS_TSAN)
set(CMAKE_C_FLAGS_TSAN ${TSAN_C_FLAGS} CACHE STRING "Flags used by the C compiler during TSAN builds." FORCE)
endif()
endif()
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()

if(TSAN_CXX_LANG_ENABLED)
include(CheckCXXCompilerFlag)
set(CMAKE_REQUIRED_LINK_OPTIONS ${TSAN_FLAG})
check_cxx_compiler_flag(${TSAN_FLAG} TSAN_CXX_FLAG_SUPPORTED)
if(NOT TSAN_CXX_FLAG_SUPPORTED)
message(STATUS "Asan flags are not supported by the CXX compiler.")
else()
if(NOT CMAKE_CXX_FLAGS_TSAN)
set(CMAKE_CXX_FLAGS_TSAN ${TSAN_CXX_FLAGS} CACHE STRING "Flags used by the CXX compiler during TSAN builds." FORCE)
endif()
endif()
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()

16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,18 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
"MinSizeRel" "RelWithDebInfo" "Asan" "Tsan")
endif()

if(NOT CMAKE_C_FLAGS AND CMAKE_COMPILER_IS_GNUCC)
message(STATUS "GCC detected, setting additional flags")
set(CMAKE_C_FLAGS "-Wall -Wextra -Winline -Wcast-qual -std=gnu99 -Wshadow" CACHE STRING "Flags used by the compiler during all build types." FORCE)
endif()

# Detect Asan and Tsan compiler flags
include(CheckAsan)
include(CheckTsan)

#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
# by other projects.
Expand Down Expand Up @@ -212,10 +216,12 @@ function(mercury_set_lib_options libtarget libname libtype)

set_target_properties(${libtarget}
PROPERTIES
DEBUG_OUTPUT_NAME ${LIB_DEBUG_NAME}
RELEASE_OUTPUT_NAME ${LIB_RELEASE_NAME}
MINSIZEREL_OUTPUT_NAME ${LIB_RELEASE_NAME}
RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME}
OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME}
OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME}
OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME}
OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME}
OUTPUT_NAME_ASAN ${LIB_DEBUG_NAME}
OUTPUT_NAME_TSAN ${LIB_DEBUG_NAME}
VERSION ${LIB_VERSION}
SOVERSION ${API_VERSION}
)
Expand Down
4 changes: 2 additions & 2 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
set(CTEST_PROJECT_NAME "MERCURY")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CST")

set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "149.28.123.102/CDash")
set(CTEST_DROP_METHOD "https")
set(CTEST_DROP_SITE "mercury-cdash.hdfgroup.org")
set(CTEST_DROP_LOCATION "/submit.php?project=Mercury")
set(CTEST_DROP_SITE_CDASH TRUE)

1 change: 1 addition & 0 deletions Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ set(MERCURY_TESTS
rpc
bulk
)
build_mercury_test(lookup)

# List of serial tests
set(MERCURY_SERIAL_TESTS
Expand Down
3 changes: 3 additions & 0 deletions Testing/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR)
project(MERCURY_TEST_DRIVER CXX)

include(CheckAsan)
include(CheckTsan)

set(KWSYS_NAMESPACE mercury_sys)
set(KWSYS_USE_SystemTools 1)
set(KWSYS_USE_Process 1)
Expand Down
43 changes: 2 additions & 41 deletions Testing/mercury_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
/* Local Type and Struct Definition */
/************************************/

struct hg_test_lookup_arg {
hg_addr_t *addr_ptr;
hg_request_t *request;
};

/********************/
/* Local Prototypes */
/********************/
Expand All @@ -54,9 +49,6 @@ static hg_return_t
hg_test_handle_create_cb(hg_handle_t handle, void *arg);
#endif

static hg_return_t
hg_test_addr_lookup_cb(const struct hg_cb_info *callback_info);

static hg_return_t
hg_test_finalize_rpc(struct hg_test_info *hg_test_info, hg_uint8_t target_id);

Expand Down Expand Up @@ -205,20 +197,6 @@ hg_test_handle_create_cb(hg_handle_t handle, void *arg)
}
#endif

/*---------------------------------------------------------------------------*/
static hg_return_t
hg_test_addr_lookup_cb(const struct hg_cb_info *callback_info)
{
struct hg_test_lookup_arg *request_args =
(struct hg_test_lookup_arg *) callback_info->arg;

*request_args->addr_ptr = callback_info->info.lookup.addr;

hg_request_complete(request_args->request);

return HG_SUCCESS;
}

/*---------------------------------------------------------------------------*/
static hg_return_t
hg_test_finalize_rpc(struct hg_test_info *hg_test_info, hg_uint8_t target_id)
Expand Down Expand Up @@ -559,9 +537,6 @@ HG_Test_init(int argc, char *argv[], struct hg_test_info *hg_test_info)
HG_Error_to_string(ret));
} else {
char test_addr_name[NA_TEST_MAX_ADDR_NAME] = { '\0' };
hg_request_t *request = NULL;
unsigned int flag = 0;
struct hg_test_lookup_arg lookup_args;

#ifdef HG_TEST_HAS_PARALLEL
/* If static client must wait for server to write config file */
Expand All @@ -582,25 +557,11 @@ HG_Test_init(int argc, char *argv[], struct hg_test_info *hg_test_info)
printf("# Target name read: %s\n",
hg_test_info->na_test_info.target_name);

/* Look up target addr using target name info */
request = hg_request_create(hg_test_info->request_class);
lookup_args.addr_ptr = &hg_test_info->target_addr;
lookup_args.request = request;

/* Forward call to remote addr and get a new request */
ret = HG_Addr_lookup(hg_test_info->context, hg_test_addr_lookup_cb,
&lookup_args, hg_test_info->na_test_info.target_name,
HG_OP_ID_IGNORE);
ret = HG_Addr_lookup2(hg_test_info->hg_class,
hg_test_info->na_test_info.target_name, &hg_test_info->target_addr);
HG_TEST_CHECK_HG_ERROR(done, ret, "HG_Addr_lookup() failed (%s)",
HG_Error_to_string(ret));

/* Wait for request to be marked completed */
hg_request_wait(request, HG_MAX_IDLE_TIME, &flag);
HG_TEST_CHECK_ERROR(flag == 0, done, ret, HG_TIMEOUT,
"Operation did not complete");

/* Free request */
hg_request_destroy(request);
}

done:
Expand Down
4 changes: 2 additions & 2 deletions Testing/na/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ endif()

#------------------------------------------------------------------------------
# Network abstraction test
build_na_test(client)
#build_na_test(client)
build_na_test(server)
build_na_test(cancel_client)
#build_na_test(cancel_client)
build_na_test(cancel_server)
build_na_test(lat_client)
build_na_test(lat_server)
Expand Down
42 changes: 3 additions & 39 deletions Testing/na/test_lat_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ struct na_test_lat_info {
struct na_test_info na_test_info;
};

struct na_test_target_lookup_arg {
na_addr_t *addr_ptr;
hg_request_t *request;
};

/********************/
/* Local Prototypes */
/********************/
Expand All @@ -65,9 +60,6 @@ na_test_request_trigger(unsigned int timeout, unsigned int *flag, void *arg);
static na_return_t
na_test_target_lookup(struct na_test_lat_info *na_test_lat_info);

static NA_INLINE int
na_test_target_lookup_cb(const struct na_cb_info *na_cb_info);

static NA_INLINE int
na_test_recv_expected_cb(const struct na_cb_info *na_cb_info);

Expand Down Expand Up @@ -118,49 +110,21 @@ na_test_request_trigger(unsigned int timeout, unsigned int *flag, void *arg)
static na_return_t
na_test_target_lookup(struct na_test_lat_info *na_test_lat_info)
{
struct na_test_target_lookup_arg request_args = { 0 };
hg_request_t *request = NULL;
na_op_id_t op_id = NA_OP_ID_NULL;
na_return_t ret = NA_SUCCESS;

request = hg_request_create(na_test_lat_info->request_class);
request_args.addr_ptr = &na_test_lat_info->target_addr;
request_args.request = request;

op_id = NA_Op_create(na_test_lat_info->na_class);

/* Forward call to remote addr and get a new request */
ret = NA_Addr_lookup(na_test_lat_info->na_class, na_test_lat_info->context,
na_test_target_lookup_cb, &request_args,
na_test_lat_info->na_test_info.target_name, &op_id);
ret = NA_Addr_lookup(na_test_lat_info->na_class,
na_test_lat_info->na_test_info.target_name,
&na_test_lat_info->target_addr);
if (ret != NA_SUCCESS) {
NA_LOG_ERROR("Could not lookup address (%s)", NA_Error_to_string(ret));
goto done;
}

/* Wait for request to be marked completed */
hg_request_wait(request, NA_MAX_IDLE_TIME, NULL);

done:
NA_Op_destroy(na_test_lat_info->na_class, op_id);
hg_request_destroy(request);
return ret;
}

/*---------------------------------------------------------------------------*/
static NA_INLINE int
na_test_target_lookup_cb(const struct na_cb_info *na_cb_info)
{
struct na_test_target_lookup_arg *na_test_target_lookup_arg =
(struct na_test_target_lookup_arg *) na_cb_info->arg;

*na_test_target_lookup_arg->addr_ptr = na_cb_info->info.lookup.addr;

hg_request_complete(na_test_target_lookup_arg->request);

return NA_SUCCESS;
}

/*---------------------------------------------------------------------------*/
static NA_INLINE int
na_test_recv_expected_cb(const struct na_cb_info *na_cb_info)
Expand Down
Loading

0 comments on commit b7fdd9b

Please sign in to comment.