diff --git a/CMakeLists.txt b/CMakeLists.txt index 00b78dde..46a6cb8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ # limitations under the License. # -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.29.0 FATAL_ERROR) project(LPF C CXX ASM) # Version info @@ -52,12 +52,12 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY - "A high performance BSP communications library" ) + "A high performance BSP communications library" ) set(CPACK_SOURCE_GENERATOR "TGZ" ) set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/" "/\\\\.svn/" "\\\\.swp$" "/site/" "/build/" "/pclint/" "/junit/" "/ideas/" ) set(CPACK_SOURCE_PACKAGE_FILE_NAME - "LPF-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_PACKAGE}") + "LPF-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_PACKAGE}") set(CPACK_GENERATOR "RPM") set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64") @@ -105,18 +105,6 @@ set( INSTALL_HEADERS "${prefix}/include" CACHE PATH "Installation path for header files" ) message( STATUS "Installation directory prefix is ${prefix}") -# C++ standard -find_file(TR1_ARRAY "tr1/array") -if (TR1_ARRAY) - message(STATUS "Governing C++ standard is C++98/TR1") - set(CMAKE_CXX_STANDARD 98) - set(CMAKE_CXX_STANDARD_REQUIRED YES) -else() - message(STATUS "Governing C++ standard is C++11") - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED YES) -endif() - # Dependencies set(ENGINES) find_library( LIB_POSIX_THREADS @@ -173,9 +161,6 @@ if ( MPI_FOUND ) if ( NOT MPI_IS_THREAD_COMPAT OR NOT MPI_IS_NOT_OPENMPI1 ) message( WARNING "MPI implementation does not tolerate any threading. Hybrid implementation will not be built") endif() - if ( NOT MPI_OPEN_PORT ) - message( WARNING "MPI implementation does not support dynamically connecting separate MPI processes. Hence, lpf_mpi_initialize_over_tcp will always fail.") - endif() if ( NOT MPI_IBARRIER ) message( WARNING "MPI implementation does not have MPI_Ibarrier, which is required to use the dense all-to-all algorithm on large (> 2 GB) meta-data exchanges") endif() @@ -189,7 +174,7 @@ if ( LIB_MATH AND LIB_DL AND MPI_FOUND ) list(APPEND ENGINES "mpirma") endif() - if (LIB_IBVERBS) + if (ENABLE_IBVERBS) list(APPEND ENGINES "ibverbs") endif() @@ -197,10 +182,29 @@ endif() #enable the hybrid engine if ( LIB_POSIX_THREADS AND LIB_MATH AND LIB_DL AND MPI_FOUND - AND MPI_IS_THREAD_COMPAT AND MPI_IS_NOT_OPENMPI1 - AND LIB_IBVERBS ) - list(APPEND ENGINES "hybrid") - set(HYBRID_ENGINE_ENABLED on) + AND MPI_IS_THREAD_COMPAT AND MPI_IS_NOT_OPENMPI1 ) + if( ENABLE_IBVERBS ) + set(LPFLIB_HYBRID_MPI_ENGINE "ibverbs" CACHE STRING + "Choice of MPI engine to use for inter-process communication") + list(APPEND ENGINES "hybrid") + set(HYBRID_ENGINE_ENABLED on) + elseif( MPI_RMA ) + set(LPFLIB_HYBRID_MPI_ENGINE "mpirma" CACHE STRING + "Choice of MPI engine to use for inter-process communication") + list(APPEND ENGINES "hybrid") + set(HYBRID_ENGINE_ENABLED on) + elseif( LIB_MATH AND LIB_DL AND MPI_FOUND ) + set(LPFLIB_HYBRID_MPI_ENGINE "mpimsg" CACHE STRING + "Choice of MPI engine to use for inter-process communication") + list(APPEND ENGINES "hybrid") + set(HYBRID_ENGINE_ENABLED on) + endif() + if( HYBRID_ENGINE_ENABLED ) + message( "Hybrid engine will be built using the ${LPFLIB_HYBRID_MPI_ENGINE} engine" ) + else() + message( "No suitable inter-node communication engine found; " + "hybrid engine will not be built" ) + endif() endif() message( STATUS "The following engines will be built: ${ENGINES}") @@ -246,59 +250,19 @@ add_definitions(-DBSPLIB_DLL=1) option(LPF_ENABLE_TESTS "Enable unit and API tests. This uses Google Testing and Mocking Framework" OFF) +option(GTEST_AGREE_TO_LICENSE + "Does the user agree to the GoogleTest license" + OFF) + +# C++ standard -- Google tests require newer C++ standard than C++11 if (LPF_ENABLE_TESTS) -message(STATUS "Unit and API tests will be built") - -# set testing timeout to 60 seconds -set(CMAKE_TESTING_TIMEOUT 60) - -# import Google Testing Framework -include(cmake/googletest.cmake) - -# Have directory to gather all the tests results -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/junit) -set(test_output "${CMAKE_BINARY_DIR}/junit") - -# Have a macro to add a unit test -function(add_gtest testName) - add_executable(${testName} ${ARGN}) - target_link_libraries(${testName} gtest_main) - add_test(${testName} ${testName} --gtest_output=xml:${test_output}/ ) -endfunction(add_gtest) - -# Have a macro to add a unit test that should run with MPI -if (MPI_FOUND) - function(add_gtest_mpi testName nprocs) - add_executable(${testName} ${ARGN}) - target_link_libraries(${testName} ${MPI_C_LIBRARIES} gtest_main) - foreach( p ${nprocs}) - set(mpmd) - foreach( i RANGE 1 ${p}) - if (i GREATER 1) - set(mpmd ${mpmd} ":") - endif() - set(mpmd ${mpmd} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS} - ./${testName} --gtest_output=xml:${test_output}/${testName}_${i}of${p}.xml) - endforeach(i) - add_test(NAME ${testName}_${p} - COMMAND ${MPIRUN} ${mpmd} - ) - endforeach(p) - endfunction(add_gtest_mpi) -endif(MPI_FOUND) - -# Enable testing in CMake -enable_testing() -else(LPF_ENABLE_TESTS) - message(STATUS "Unit and API tests will *not* be built") - function(add_gtest testName) - # Do nothing because tests are disabled - endfunction(add_gtest) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED YES) +else() + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED YES) +endif() - function(add_gtest_mpi testName nprocs) - # DO nothing because tests are disabled - endfunction(add_gtest_mpi) -endif(LPF_ENABLE_TESTS) # Handling of compiler flags function(target_add_compilation_flags target visibility) @@ -366,10 +330,7 @@ endfunction(target_compile_flags) # Source set(lpf_cflags) set(lpf_lib_link_flags) -set(lpf_exe_link_flags) -include_directories(include) -include_directories(src/common) -add_subdirectory(src) +set(lpf_exe_link_flags "-rdynamic") # Collating all compile & link flags set(LPF_CORE_COMPILE_FLAGS "${lpf_cflags}" CACHE STRING "Compilation flags for all user code" ) @@ -384,14 +345,141 @@ function( target_link_exe_with_core target ) endif() set(corelib "lpf_core_univ_${engine}_${LPFLIB_CONFIG_NAME}") - target_link_libraries(${target} ${corelib}) + if ("${engine}" STREQUAL "pthread") + target_link_libraries(${target} ${corelib}) + else() + target_link_libraries(${target} ${corelib} ${MPI_C_LIBRARIES}) + endif() target_compile_flags(${target} PRIVATE ${LPF_CORE_COMPILE_FLAGS}) set_target_properties(${target} PROPERTIES - LINK_FLAGS "${LPF_CORE_LIB_LINK_FLAGS} ${LPF_CORE_EXE_LINK_FLAGS}" - LINKER_LANGUAGE CXX - ) + LINK_FLAGS "${LPF_CORE_LIB_LINK_FLAGS} ${LPF_CORE_EXE_LINK_FLAGS}" + LINKER_LANGUAGE CXX + ) endfunction() +if (LPF_ENABLE_TESTS) + message(STATUS "Unit and API tests will be built. This requires CMake version 3.29 or higher, since we use recent features of the GoogleTest package in CMake.") + + if (NOT GTEST_AGREE_TO_LICENSE) + message(FATAL_ERROR "The user needs to agree with the GoogleTest license to use tests (option GTEST_AGREE_TO_LICENSE=TRUE)") + endif() + # Enable testing in CMake + enable_testing() + include(ProcessorCount) + ProcessorCount(processorCount) + find_package(GTest) + include(GoogleTest) + if(NOT GTest_FOUND) # if not found, download it and pull it in + include(FetchContent) + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + # This tag corresponds to GoogleTest 1.15.0 release + GIT_TAG e397860 + ) + FetchContent_MakeAvailable(googletest) + + endif() + # set testing timeout to 60 seconds + set(CMAKE_TESTING_TIMEOUT 60) + + # Have directory to gather all the tests results + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/junit) + set(test_output "${CMAKE_BINARY_DIR}/junit") + + find_package( Python3 REQUIRED COMPONENTS Interpreter) + set(MY_TEST_LAUNCHER ${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/test_launcher.py) + configure_file( ${CMAKE_SOURCE_DIR}/test_launcher.py.in ${CMAKE_BINARY_DIR}/test_launcher.py @ONLY FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ) + + # Macro for adding a new GoogleTest test + function(add_gtest testName ENGINE debug testSource ) + if ("{$ENGINE}" STREQUAL "") + message(FATAL_ERROR "engine cannot be empty, ever!") + endif() + add_executable(${testName} ${testSource} ${ARGN}) + target_compile_definitions(${testName} PUBLIC LPF_CORE_IMPL_ID=${ENGINE}) + target_compile_definitions(${testName} PUBLIC LPF_CORE_MPI_USES_${ENGINE}) + if (debug) + target_include_directories( ${testName} BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/include/debug ) + target_link_libraries(${testName} lpf_debug lpf_hl_debug GTest::gtest GTest::gtest_main) + else(debug) + target_link_libraries(${testName} GTest::gtest GTest::gtest_main) + endif(debug) + + + # Extract test-specific information from comments of tests + file(READ ${testSource} fileContents) + string(REGEX MATCH "Exit code: ([0-9]+)" _ ${fileContents}) + set(retCode ${CMAKE_MATCH_1}) + string(REGEX MATCH "pre P >= ([0-9]+)" _ ${fileContents}) + set(minProcs ${CMAKE_MATCH_1}) + string(REGEX MATCH "pre P <= ([0-9]+)" _ ${fileContents}) + set(maxProcs ${CMAKE_MATCH_1}) + string(REGEX MATCH "-probe ([0-9]+.[0-9]+)" _ ${fileContents}) + set(lpfProbeSecs ${CMAKE_MATCH_1}) + + target_link_exe_with_core(${testName} ${ENGINE}) + + # The "\pre P <= max" comment in a test indicates the desired number of + # maximum LPF processes. If the test does not define a desired number of + # maximum LPF processes, it will be set to 5. + # + # The "\pre P >= min" comment in a test indicates the desired number of + # minimum LPF processes. If the test does not define a desired minimum + # number of LPF processes, it will be set to 1. + # + # Let 'processorCount' be the detected number of processors by the system. + # If this number is smaller than the desider minimum and/or maximum number + # of processes, it overwrites these + # + # Most tests only define a mininum number of desired processes, such as + # "\pre P >= 1". In those cases, the test will execute for the range 1,..,5 + # (including) + + if ("${minProcs}" STREQUAL "") + set(minProcs "1") + endif() + if ("${maxProcs}" STREQUAL "") + set(maxProcs "5") + endif() + # cap min with processorCount, if needed + if ("${minProcs}" GREATER "${processorCount}") + set(minProcs ${processorCount}) + endif() + # cap max with processorCount, if needed + if ("${maxProcs}" GREATER "${processorCount}") + set(maxProcs ${processorCount}) + endif() + if ("${lpfProbeSecs}" STREQUAL "") + set(lpfProbeSecs "0.0") + endif() + if ("${retCode}" STREQUAL "") + set(retCode "0") + endif() + + # Most recent approach to Gtests, recommended! + set_property(TARGET ${testName} PROPERTY TEST_LAUNCHER ${MY_TEST_LAUNCHER};--engine;${ENGINE};--parallel_launcher;${CMAKE_BINARY_DIR}/lpfrun_build;--min_process_count;${minProcs};--max_process_count;${maxProcs};--lpf_probe_timer;${lpfProbeSecs};--expected_return_code;${retCode}) + gtest_discover_tests(${testName} + TEST_PREFIX ${ENGINE}_ + EXTRA_ARGS --gtest_output=xml:${test_output}/${ENGINE}_${testName} + DISCOVERY_MODE POST_BUILD + DISCOVERY_TIMEOUT 15 + ) + + endfunction(add_gtest) + +else(LPF_ENABLE_TESTS) + message(STATUS "Unit and API tests will *not* be built") + function(add_gtest testName ENGINE debug testSource ) + # Do nothing because tests are disabled + endfunction(add_gtest) + +endif(LPF_ENABLE_TESTS) + +include_directories(include) +include_directories(src/common) + +add_subdirectory(src) # Apps add_subdirectory(src/utils) @@ -432,7 +520,7 @@ set( lpf_proxy_dummy ${CMAKE_CURRENT_BINARY_DIR}/src/MPI/lpf_proxy_dummy) set( lpf_probe ${CMAKE_CURRENT_BINARY_DIR}/src/utils/lpfprobe) set( lpfrun ${CMAKE_CURRENT_BINARY_DIR}/lpfrun_build) set( lpfcore ${CMAKE_CURRENT_BINARY_DIR}/src/*/liblpf_core_univ_ENGINE_${LPFLIB_CONFIG_NAME}${SOSUFFIX} ) -configure_file( lpfrun.in lpfrun_build @ONLY) +configure_file( lpfrun.in lpfrun_build FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE @ONLY) configure_file( lpfproxy.in lpfproxy_build @ONLY) configure_file( lpfprobe.in lpfprobe_build @ONLY) diff --git a/README b/README index 9fd8463d..b0a5b33d 100644 --- a/README +++ b/README @@ -28,9 +28,9 @@ Prerequisites Mandatory - GNU/Linux, - GNU C compiler, - - GNU C++ compiler (C++03/TR1 or C++11), + - GNU C++ compiler (C++11 compatible; however, C++17 compatible with tests enabled) - GNU Make, - - CMake 3.1 or better. + - CMake 3.29.0 or better. Optional MPI engine requires - MPI-3, such as 'MPICH', 'OpenMPI', or 'MVAPICH'. @@ -38,6 +38,10 @@ Optional MPI engine requires Optional for thread pinning by Pthreads and hybrid engines - hwloc > 1.11 +Optional tests requires + - GNU C++ compiler (C++17 compatible), + - Python 3. + Optional (see --enable-doc) documentation requires - doxygen > 1.5.6, - graphviz, diff --git a/bootstrap.sh b/bootstrap.sh index e641e56e..1bc1835c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -87,7 +87,7 @@ installdir="$builddir" config=Release doc=OFF functests=OFF -googletest_license_agreement=NO +googletest_license_agreement=FALSE perftests=OFF reconfig=no CMAKE_EXE=cmake @@ -133,7 +133,7 @@ do ------------------------------------------------------------------------------ The functional test suite requires Google Testing Framework which comes with its own license. The license can be viewed via - https://github.com/google/googletest/blob/release-1.8.1/LICENSE + https://github.com/google/googletest/blob/v1.15.x/LICENSE Do you agree with the license [yes/no] ? EOF read answer @@ -154,7 +154,7 @@ User agrees with Google Testing Framework license. It will be downloaded during the build. ============================================================================== EOF - googletest_license_agreement=YES + googletest_license_agreement=TRUE fi shift @@ -162,7 +162,7 @@ EOF --functests=i-agree-with-googletest-license) functests=ON - googletest_license_agreement=YES + googletest_license_agreement=TRUE shift ;; @@ -192,7 +192,7 @@ EOF --with-mpiexec=*) mpiexec="${arg#--with-mpiexec=}" - mpi_cmake_flags="${mpi_cmake_flags} -DMPIEXEC=$mpiexec" + mpi_cmake_flags="${mpi_cmake_flags} -DMPIEXEC=$mpiexec -DMPIEXEC_EXECUTABLE=$mpiexec" shift; ;; @@ -288,8 +288,8 @@ ${CMAKE_EXE} -Wno-dev \ -DLPF_HWLOC="${hwloc}" \ $hwloc_found_flag \ $mpi_cmake_flags \ - "$extra_flags" \ - "$perf_flags" \ + ${extra_flags+"$extra_flags"} \ + ${perf_flags+"$perf_flags"} \ "$@" $srcdir \ || { echo FAIL "Failed to configure LPF; Please check your chosen configuration"; exit 1; } diff --git a/cmake/googletest.cmake b/cmake/googletest.cmake deleted file mode 100644 index 14135c2f..00000000 --- a/cmake/googletest.cmake +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright 2021 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include(ExternalProject) -set(gtest_prefix "${CMAKE_CURRENT_BINARY_DIR}/gtest") -set(GTEST_DOWNLOAD_URL - "https://github.com/google/googletest/archive/release-1.8.1.tar.gz" - CACHE STRING "File location or URL from where to download Google Test") -set(GTEST_LICENSE_URL - "https://github.com/google/googletest/blob/release-1.8.1/LICENSE" - CACHE STRING "File location or URL to license file of Google Test") -option(GTEST_AGREE_TO_LICENSE - "User agreement with license of Google Testing Framework, available at ${GOOGLE_LICENSE_URL}" - OFF) - -if (NOT GTEST_AGREE_TO_LICENSE) - message(SEND_ERROR "The LPF test suite requires agreement with the license of Google Test. Either disable LPF_ENABLE_TESTS or agree with the license by enabling GTEST_AGREE_TO_LICENSE") -endif() - -ExternalProject_Add( - GoogleTest - PREFIX ${gtest_prefix} - INSTALL_DIR ${gtest_prefix} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${gtest_prefix} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -Dgtest_disable_pthreads=ON - URL ${GTEST_DOWNLOAD_URL} - EXCLUDE_FROM_ALL YES) -ExternalProject_Add_StepTargets(GoogleTest install) -add_library(gtest_main STATIC IMPORTED) -add_dependencies(gtest_main GoogleTest-install) -add_library(gtest STATIC IMPORTED) -add_dependencies(gtest GoogleTest-install) - -# In order to prevent failure of the next set_target_properties -# INTERFACE_INCLUDE_DIRECTORIES, make this directory before it is made by the -# GoogleTest external project -file(MAKE_DIRECTORY ${gtest_prefix}/include) -set_target_properties(gtest_main - PROPERTIES IMPORTED_LOCATION ${gtest_prefix}/${CMAKE_INSTALL_LIBDIR}/libgtest_main.a - INTERFACE_INCLUDE_DIRECTORIES ${gtest_prefix}/include - INTERFACE_LINK_LIBRARIES ${gtest_prefix}/${CMAKE_INSTALL_LIBDIR}/libgtest.a) -set_target_properties(gtest - PROPERTIES IMPORTED_LOCATION ${gtest_prefix}/${CMAKE_INSTALL_LIBDIR}/libgtest.a - INTERFACE_INCLUDE_DIRECTORIES ${gtest_prefix}/include) diff --git a/cmake/ibverbs_init.c b/cmake/ibverbs_init.c new file mode 100644 index 00000000..f38be9dc --- /dev/null +++ b/cmake/ibverbs_init.c @@ -0,0 +1,19 @@ +#include "infiniband/verbs.h" +#include + +int main(int argc, char** argv) +{ + + int numDevices = -1; + struct ibv_device * * const try_get_device_list = ibv_get_device_list( &numDevices ); + + if (!try_get_device_list) { + abort(); + } + + if (numDevices < 1) { + abort(); + } + + return 0; +} diff --git a/cmake/is_openmpi.c b/cmake/is_openmpi.c new file mode 100644 index 00000000..d3ed13c9 --- /dev/null +++ b/cmake/is_openmpi.c @@ -0,0 +1,12 @@ +#include "mpi.h" +#include + +#ifdef OMPI_MAJOR_VERSION + +int main() { + printf("The OMPI_MAJOR_VERSION is %d\n", OMPI_MAJOR_VERSION); + return 0; +} +#else +#error This is not Open MPI +#endif diff --git a/cmake/mpi.cmake b/cmake/mpi.cmake index 71b184c1..f8d55851 100644 --- a/cmake/mpi.cmake +++ b/cmake/mpi.cmake @@ -78,6 +78,14 @@ if (MPI_FOUND) -DINCLUDE_DIRECTORIES:STRING=${MPI_C_INCLUDE_PATH} ) + try_compile( IS_OPENMPI "${CMAKE_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/is_openmpi.c" + LINK_LIBRARIES ${MPI_C_LIBRARIES} + CMAKE_FLAGS + -DCMAKE_C_FLAGS:STRING=${MPI_C_COMPILE_FLAGS} + -DCMAKE_EXE_LINKER_FLAGS:STRING=${MPI_C_LINK_FLAGS} + -DINCLUDE_DIRECTORIES:STRING=${MPI_C_INCLUDE_PATH} + ) try_run( MPI_IS_THREAD_COMPAT_RC MPI_IS_THREAD_COMPAT_COMPILES ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mpi_is_thread_compat.c @@ -153,4 +161,26 @@ if (MPI_FOUND) endif() +if (LIB_IBVERBS) +try_run( IBVERBS_INIT_RUNS IBVERBS_INIT_COMPILES + ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ibverbs_init.c + LINK_LIBRARIES ${LIB_IBVERBS} + ARGS ${MPIRUN} + ) +endif() + +set(ENABLE_IBVERBS FALSE) +if (LPF_ENABLE_TESTS) + # The Google Test integration requires that tests successfully compiled are + # also runnable + if (LIB_IBVERBS AND NOT IBVERBS_INIT_RUNS STREQUAL "FAILED_TO_RUN") + set(ENABLE_IBVERBS TRUE) + endif() +else() + # Without the aforementioned Google Test requirement, we can safely build + # it and allow the user to deploy the built binaries on IB-enabled nodes. + if (LIB_IBVERBS) + set(ENABLE_IBVERBS TRUE) + endif() +endif() diff --git a/doc/lpf_core.cfg.in b/doc/lpf_core.cfg.in index 0a8de71c..bfb940b2 100644 --- a/doc/lpf_core.cfg.in +++ b/doc/lpf_core.cfg.in @@ -742,8 +742,8 @@ INPUT = @PROJECT_SOURCE_DIR@/include/lpf/core.h \ @PROJECT_SOURCE_DIR@/include/bsp/bsp.h \ @PROJECT_SOURCE_DIR@/include/lpf/hybrid.h \ @PROJECT_SOURCE_DIR@/include/lpf/mpirpc-client.h \ - @PROJECT_SOURCE_DIR@/include/lpf/rpc-client.h - + @PROJECT_SOURCE_DIR@/include/lpf/rpc-client.h \ + @PROJECT_SOURCE_DIR@/include/lpf/abort.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/include/debug/lpf/core.h b/include/debug/lpf/core.h index 028e015f..ff2306c6 100644 --- a/include/debug/lpf/core.h +++ b/include/debug/lpf/core.h @@ -70,6 +70,9 @@ extern "C" { #define lpf_resize_message_queue( ctx, size ) \ lpf_debug_resize_message_queue( __FILE__, __LINE__, (ctx), (size) ) +#define lpf_abort( ctx ) \ + lpf_debug_abort( __FILE__, __LINE__, (ctx)) + extern _LPFLIB_API lpf_err_t lpf_debug_exec( const char * file, int line, @@ -133,6 +136,9 @@ extern _LPFLIB_API lpf_err_t lpf_debug_resize_message_queue( const char * file, int line, lpf_t ctx, size_t max_msgs ); +extern _LPFLIB_API +lpf_err_t lpf_debug_abort( const char * file, int line, lpf_t ctx); + #ifdef __cplusplus } #endif diff --git a/include/lpf/abort.h b/include/lpf/abort.h new file mode 100644 index 00000000..383a6ab8 --- /dev/null +++ b/include/lpf/abort.h @@ -0,0 +1,152 @@ + +/* + * Copyright 2021 Huawei Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LPFLIB_ABORT_H +#define LPFLIB_ABORT_H + +#include "lpf/static_dispatch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \addtogroup LPF_EXTENSIONS LPF API extensions + * @{ + * + * \defgroup LPF_ABORT Functionality for aborting LPF applications + * + * If #LPF_HAS_ABORT has a nonzero value, then a call to #lpf_abort from any + * process in a distributed application, will abort the entire application. + * + * \note As with all LPF extensions, it is \em not mandatory for all LPF + * implementations to support this one. + * + * If #LPF_HAS_ABORT has a zero value, then a call to #lpf_abort shall have no + * other effect than it returning #LPF_SUCCESS. + * + * Therefore, + * - LPF implementations that cannot support an abort functionality may still + * provide a valid, albeit trivial, implementation of this extension. + * - LPF applications that aim to rely on #lpf_abort should first ensure that + * #LPF_HAS_ABORT is nonzero. + * + * \warning Portable LPF implementations best not rely on #lpf_abort at all. + * Although sometimes unavoidable, the recommendation is to avoid the + * use of this extension as best as possible. + * + * \note One case where #lpf_abort is absolutely required is for \em testing an + * LPF debug layer. Such a layer should detect erroneous usage, report it, + * but then typically cannot continue execution. In this case, relying on + * the standard abort or exit functionalities to terminate the process the + * error was detected at, typically results in implementation-specific + * (i.e., undefined) behaviour with regards to how the application at + * large terminates. This means that a test-suite for such a debug layer + * cannot reliably detect whether a distributed application has terminated + * for the expected reasons. In this case, #lpf_abort provides a reliable + * mechanism that such a test requires. + * + * @{ + */ + +/** + * Whether the active LPF engine supports aborting distributed applications. + * + * If the value of this field is zero (0), then a call to #lpf_abort will be a + * no-op and always return #LPF_SUCCESS. + */ +extern _LPFLIB_VAR const int LPF_HAS_ABORT ; + +/** + * A call to this function aborts the distributed application as soon as + * possible. + * + * \warning This function corresponds to a no-op if #LPF_HAS_ABORT equals zero. + * + * The below specification only applies when #LPF_HAS_ABORT contains a non-zero + * value; otherwise, a call to this function will have no other effect besides + * returning #LPF_SUCCESS. + * + * \note Rationale: the capability to abort relies on the software stack that + * underlies LPF, and in aiming to be a minimal API, LPF does not wish to + * force such a capabilities unto the underlying software or system. + * + * \note Applications that rely on #lpf_abort therefore should first check if + * the capability is supported. + * + * \note The recommended way to abort LPF applications that is fully supported + * by the core specification alone (i.e., excluding this #lpf_abort + * extension), is to simply exit the process that should be aborted. + * Compliant LPF implementations will then quit sibling processes at + * latest at a call to #lpf_sync that should handle communications + * with the exited process. Sibling processes may also exit early without + * involvement of LPF. In all cases, the parent call to #lpf_exec, + * #lpf_hook, or #lpf_rehook should return with #LPF_ERR_FATAL. + * + * \warning Therefore, whenever possible, code implemented on top of LPF ideally + * does not rely on #lpf_abort. Instead, error handling more reliably + * could be implemented on top of the above-described default LPF + * behaviour. + * + * The call to #lpf_abort differs from the stdlib abort; for example, + * implementations are not required to raise SIGABRT as part of a call to + * #lpf_abort. Instead, the requirements are that: + * 1. processes that call this function terminate during the call to + * #lpf_abort; + * 2. all other processes associated with the distributed application terminate + * at latest during a next call to #lpf_sync that should have handled + * communications with any aborted process; + * 3. regardless of whether LPF aborted sibling processes, whether they exited + * gracefully, or whether they also called #lpf_abort, the process(es) which + * made the parent call to #lpf_exec, #lpf_hook, or #lpf_rehook should + * either: a) terminate also, at latest when all (other) associated + * processes have terminated, (exclusive-)or b) return #LPF_ERR_FATAL. + * Which behaviour (a or b) will be followed is up to the implementation, + * and portable applications should account for both possibilities. + * + * \note In the above, \em other is between parenthesis since the processes + * executing the application may be fully disjoint from the process that + * spawned the application. In this case it is natural to elect that the + * spawning process returns #LPF_ERR_FATAL, though under this + * specification also that process may be aborted before the spawning + * call returns. + * + * \note If one of the associated processes deadlock (e.g. due to executing + * while(1){}), it shall remain undefined when the entire + * application aborts. Implementations shall make a best effort to do this + * as early as possible. + * + * \note Though implied by the above, we note explicitly that #lpf_abort is + * \em not a collective function; a single process calling #lpf_abort can + * terminate all associated processes. + * + * @returns #LPF_SUCCESS If and only if #LPF_HAS_ABORT equals zero. + * + * If #LPF_HAS_ABORT is nonzero, then this function shall not return. + */ +extern _LPFLIB_API +lpf_err_t lpf_abort(lpf_t ctx); + +/** + * @} + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/lpf/core.h b/include/lpf/core.h index 42872f15..9c0d1da8 100644 --- a/include/lpf/core.h +++ b/include/lpf/core.h @@ -126,6 +126,8 @@ * - \ref LPF_EXTENSIONS * - \ref LPF_PTHREAD * - \ref LPF_MPI + * - \ref LPF_HYBRID + * - \ref LPF_ABORT * - \ref LPF_HL * - \ref LPF_BSPLIB * - \ref LPF_COLLECTIVES diff --git a/include/lpf/hybrid.h b/include/lpf/hybrid.h index 00845f08..4c324adf 100644 --- a/include/lpf/hybrid.h +++ b/include/lpf/hybrid.h @@ -28,7 +28,7 @@ extern "C" { * * @{ * - * \defgroup LPF_HYBRID Specific to Hybrid implementation + * \defgroup LPF_HYBRID Specific to the hybrid engine * * @{ */ diff --git a/include/lpf/pthread.h b/include/lpf/pthread.h index ba68f3f8..454eaf0e 100644 --- a/include/lpf/pthread.h +++ b/include/lpf/pthread.h @@ -28,7 +28,7 @@ extern "C" { * * @{ * - * \defgroup LPF_PTHREAD Specific to Pthreads + * \defgroup LPF_PTHREAD Specific to the Pthreads engine * * @{ */ diff --git a/include/lpf/static_dispatch.h b/include/lpf/static_dispatch.h index 8df6a092..e9eea40b 100644 --- a/include/lpf/static_dispatch.h +++ b/include/lpf/static_dispatch.h @@ -49,6 +49,7 @@ #undef lpf_exec #undef lpf_hook #undef lpf_rehook +#undef lpf_abort #undef lpf_init_t #undef lpf_pid_t @@ -77,6 +78,7 @@ #undef LPF_NONE #undef LPF_INIT_NONE #undef LPF_NO_ARGS +#undef LPF_HAS_ABORT #ifdef LPF_FUNC @@ -92,6 +94,7 @@ #define lpf_exec LPF_FUNC(exec) #define lpf_hook LPF_FUNC(hook) #define lpf_rehook LPF_FUNC(rehook) +#define lpf_abort LPF_FUNC(abort) #define lpf_init_t LPF_TYPE(init_t) #define lpf_pid_t LPF_TYPE(pid_t) @@ -120,6 +123,7 @@ #define LPF_NONE LPF_CONST(NONE) #define LPF_INIT_NONE LPF_CONST(INIT_NONE) #define LPF_NO_ARGS LPF_CONST(NO_ARGS) +#define LPF_HAS_ABORT LPF_CONST(HAS_ABORT) #endif diff --git a/src/MPI/CMakeLists.txt b/src/MPI/CMakeLists.txt index beca3129..905bc3de 100644 --- a/src/MPI/CMakeLists.txt +++ b/src/MPI/CMakeLists.txt @@ -22,13 +22,10 @@ if (MPI_FOUND) list(APPEND MPI_ENGINES mpirma) endif() - if (LIB_IBVERBS) + if (ENABLE_IBVERBS) list(APPEND MPI_ENGINES ibverbs) endif() - if (MPI_OPEN_PORT) - add_definitions("-DMPI_HAS_OPEN_PORT=1") - endif() if (MPI_IBARRIER) add_definitions("-DMPI_HAS_IBARRIER=1") endif() @@ -38,22 +35,20 @@ if (MPI_FOUND) set_target_properties( lpf_proxy_dummy PROPERTIES LINK_FLAGS "${MPI_C_LINK_FLAGS}" ) target_include_directories( lpf_proxy_dummy PRIVATE ${MPI_C_INCLUDE_PATH}) - target_compile_flags(lpf_proxy_dummy PRIVATE ${MPI_C_COMPILE_FLAGS}) install( TARGETS lpf_proxy_dummy RUNTIME DESTINATION ${INSTALL_HELPERS} ) - set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) -# univ_ stands for universal interface => lpf_exec, lpf_put, etc... -# spec_ stands for specific interface => lpf_mpimsg_release_exec, lpf_mpimsg_release_put, etc... + # univ_ stands for universal interface => lpf_exec, lpf_put, etc... + # spec_ stands for specific interface => lpf_mpimsg_release_exec, lpf_mpimsg_release_put, etc... foreach (iface "univ_" "spec_" ) - foreach (LPF_IMPL_ID ${MPI_ENGINES}) - set(libname "lpf_core_${iface}${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}") - set(comlib "lpf_common_${LPFLIB_CONFIG_NAME}") - - set(ibverbs_sources) - if (LPF_IMPL_ID STREQUAL ibverbs) + foreach (LPF_IMPL_ID ${MPI_ENGINES}) + set(libname "lpf_core_${iface}${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}") + set(comlib "lpf_common_${LPFLIB_CONFIG_NAME}") + + set(ibverbs_sources) + if (LPF_IMPL_ID STREQUAL ibverbs) set(ibverbs_sources ibverbs.cpp) endif() @@ -70,15 +65,13 @@ if (MPI_FOUND) spall2all.c messagesort.cpp spall2all.cpp - init.cpp + init.cpp ${ibverbs_sources} ) target_compile_flags(raw_${libname} - PUBLIC ${MPI_C_COMPILE_FLAGS} - INTERFACE "-fPIC" - ) + INTERFACE "-fPIC") target_compile_definitions(raw_${libname} PRIVATE "LPF_CORE_MPI_USES_${LPF_IMPL_ID}=1" @@ -106,9 +99,7 @@ if (MPI_FOUND) MACOSX_RPATH TRUE) target_compile_flags(${libname} - PUBLIC ${MPI_C_COMPILE_FLAGS} - INTERFACE "-fPIC" - ) + INTERFACE "-fPIC") if (iface STREQUAL "spec_") target_compile_definitions(${libname} @@ -162,68 +153,67 @@ if (MPI_FOUND) set(lib_lflags "${MPI_C_LINK_FLAGS}") #Note: the core library is already linked with MPI_C_LIBRARIES. string(REPLACE ";" " " lib_lflags "${lib_lflags}") # So, no need to also link executables with it. - set(lpf_cflags "${lpf_cflags} ${MPI_C_COMPILE_FLAGS} -I${mpi_include_flags} -fPIC" PARENT_SCOPE) + set(lpf_cflags "${lpf_cflags} -I${mpi_include_flags} -fPIC" PARENT_SCOPE) set(lpf_lib_link_flags "${lpf_lib_link_flags} ${lib_lflags}" PARENT_SCOPE) - if (UNIX AND NOT APPLE) - set(lpf_exe_link_flags "${lpf_exe_link_flags} -rdynamic" PARENT_SCOPE) - endif() endforeach() include_directories(${MPI_C_INCLUDE_PATH}) # add a test for dynamichook - if (MPI_OPEN_PORT AND LPF_ENABLE_TESTS) - add_executable(dynamichook.t dynamichook.t.cpp dynamichook.cpp - $ ) - - target_include_directories(dynamichook.t PRIVATE ${GTEST_INCLUDE_PATH}) - target_link_libraries(dynamichook.t ${MPI_C_LIBRARIES} gtest) - set_target_properties(dynamichook.t PROPERTIES - COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}" - LINK_FLAGS "${MPI_C_LINK_FLAGS}" - ) - configure_file( dynamichook.t.sh.in dynamichook.t.sh @ONLY) - set( dynamic_hook_t_sh "${CMAKE_CURRENT_BINARY_DIR}/dynamichook.t.sh") - add_test(NAME dynamichook_1proc - COMMAND bash ${dynamic_hook_t_sh} 1) - set_tests_properties( dynamichook_1proc PROPERTIES TIMEOUT 120 ) - add_test(NAME dynamichook_2proc - COMMAND bash ${dynamic_hook_t_sh} 2) - set_tests_properties( dynamichook_2proc PROPERTIES TIMEOUT 240 ) - add_test(NAME dynamichook_3proc - COMMAND bash ${dynamic_hook_t_sh} 3) - set_tests_properties( dynamichook_3proc PROPERTIES TIMEOUT 360 ) - add_test(NAME dynamichook_10proc - COMMAND bash ${dynamic_hook_t_sh} 10) - set_tests_properties( dynamichook_10proc PROPERTIES TIMEOUT 1200 ) + if (NOT IS_OPENMPI AND LPF_ENABLE_TESTS) + add_gtest(dynamichook.t "mpimsg" ON + ${CMAKE_CURRENT_SOURCE_DIR}/dynamichook.t.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dynamichook.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mpilib.cpp) + + configure_file( dynamichook.t.sh.in dynamichook.t.sh @ONLY) + set( dynamic_hook_t_sh "${CMAKE_CURRENT_BINARY_DIR}/dynamichook.t.sh") + add_test(NAME dynamichook_1proc + COMMAND bash ${dynamic_hook_t_sh} 1) + # We set all dynamichook tests to run in serial mode, without any other tests, + # since these tests occupy the same port and would block each other + set_tests_properties( dynamichook_1proc PROPERTIES TIMEOUT 30 RUN_SERIAL TRUE) + add_test(NAME dynamichook_2proc + COMMAND bash ${dynamic_hook_t_sh} 2) + set_tests_properties( dynamichook_2proc PROPERTIES TIMEOUT 30 RUN_SERIAL TRUE) + add_test(NAME dynamichook_3proc + COMMAND bash ${dynamic_hook_t_sh} 3) + set_tests_properties( dynamichook_3proc PROPERTIES TIMEOUT 30 RUN_SERIAL TRUE) + add_test(NAME dynamichook_10proc + COMMAND bash ${dynamic_hook_t_sh} 10) + set_tests_properties( dynamichook_10proc PROPERTIES TIMEOUT 30 RUN_SERIAL TRUE) endif() # Other unit tests - if (LIB_IBVERBS AND LPF_ENABLE_TESTS) - add_gtest_mpi( ibverbs_test "1;2;5;10" ibverbs.t.cpp ibverbs.cpp - $ mpilib.cpp) - target_link_libraries( ibverbs_test ${LIB_IBVERBS}) + if (ENABLE_IBVERBS AND LPF_ENABLE_TESTS) + add_gtest( ibverbs_test "ibverbs" ON ${CMAKE_CURRENT_SOURCE_DIR}/ibverbs.t.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ibverbs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mpilib.cpp) endif() - add_gtest_mpi( spall2all_test "1;2;5;10" spall2all.t.cpp spall2all.c - spall2all.cpp mpilib.cpp - $ - ) - - add_gtest_mpi( dall2all_test "1;2;5;10" dall2all.t.cpp - mpilib.cpp $ - ) - - if (MPI_IBARRIER) - add_gtest_mpi( hall2all_test "1;2;5;10" hall2all.t.cpp - mpilib.cpp $ ) - endif() + foreach (engine ${MPI_ENGINES}) + add_gtest( spall2all_test_${engine} ${engine} ON + ${CMAKE_CURRENT_SOURCE_DIR}/spall2all.t.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spall2all.c + ${CMAKE_CURRENT_SOURCE_DIR}/spall2all.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mpilib.cpp) + + add_gtest( dall2all_test_${engine} ${engine} ON + ${CMAKE_CURRENT_SOURCE_DIR}/dall2all.t.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mpilib.cpp) + + if (MPI_IBARRIER) + add_gtest( hall2all_test_${engine} ${engine} ON + ${CMAKE_CURRENT_SOURCE_DIR}/hall2all.t.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mpilib.cpp) + endif() - add_gtest( messagesort_test messagesort.t.cpp messagesort.cpp - $ ) + add_gtest( messagesort_test_${engine} ${engine} ON + ${CMAKE_CURRENT_SOURCE_DIR}/messagesort.t.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/messagesort.cpp) - add_gtest( ipcmesg_test ipcmesg.t.cpp - $ ) + add_gtest( ipcmesg_test_${engine} ${engine} ON + ${CMAKE_CURRENT_SOURCE_DIR}/ipcmesg.t.cpp) + endforeach() endif(MPI_FOUND) - diff --git a/src/MPI/core.cpp b/src/MPI/core.cpp index 112403e6..94a9658f 100644 --- a/src/MPI/core.cpp +++ b/src/MPI/core.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -36,6 +37,10 @@ #include +// the value 2 in this implementation indicates support for lpf_abort in a way +// that may deviate from the stdlib abort() +const int LPF_HAS_ABORT = 2; + // Error codes. // Note: Some code (e.g. in process::broadcastSymbol) depends on the // fact that numbers are assigned in order of severity, where 0 means @@ -290,3 +295,10 @@ lpf_err_t lpf_resize_message_queue( lpf_t ctx, size_t max_msgs ) return i->resizeMesgQueue(max_msgs); } +lpf_err_t lpf_abort( lpf_t ctx ) { + (void) ctx; + MPI_Abort(MPI_COMM_WORLD, 6); + return LPF_SUCCESS; +} + + diff --git a/src/MPI/dall2all.t.cpp b/src/MPI/dall2all.t.cpp index 4e5d6172..9813c077 100644 --- a/src/MPI/dall2all.t.cpp +++ b/src/MPI/dall2all.t.cpp @@ -23,28 +23,51 @@ using namespace lpf::mpi; -extern "C" const int LPF_MPI_AUTO_INITIALIZE=1; +extern "C" const int LPF_MPI_AUTO_INITIALIZE=0; +/** + * \pre P >= 1 + * \pre P <= 2 + */ +class DenseAll2AllTests : public testing::Test { + + protected: + + static void SetUpTestSuite() { + + MPI_Init(NULL, NULL); + Lib::instance(); + + MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); + MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); + + } + + static void TearDownTestSuite() { + MPI_Finalize(); + } + + static int my_pid; + static int nprocs; +}; -TEST( Dall2all, Create ) +int DenseAll2AllTests::my_pid = -1; +int DenseAll2AllTests::nprocs = -1; + +TEST_F( DenseAll2AllTests, Create ) { DenseAllToAll x(9, 10); } -TEST( Dall2all, Reserve ) +TEST_F( DenseAll2AllTests, Reserve ) { DenseAllToAll x( 4,10); x.reserve( 50 , 100); } -TEST( Dall2all, Send ) +TEST_F( DenseAll2AllTests, Send ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - DenseAllToAll x( my_pid, nprocs ); x.reserve( nprocs , sizeof(int)); @@ -56,13 +79,8 @@ TEST( Dall2all, Send ) EXPECT_TRUE( !error ); } -TEST( Dall2all, Ring ) +TEST_F( DenseAll2AllTests, Ring ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - DenseAllToAll x(my_pid, nprocs); x.reserve( nprocs , sizeof(int)); x.send( (my_pid + 1) % nprocs, &my_pid, sizeof(my_pid) ); @@ -84,14 +102,8 @@ TEST( Dall2all, Ring ) } -TEST( Dall2all, ManyMsgs ) +TEST_F( DenseAll2AllTests, ManyMsgs ) { - Lib::instance(); - - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - DenseAllToAll x(my_pid, nprocs ); const int nMsgs = 10000; x.reserve( nMsgs , sizeof(int)); @@ -122,13 +134,8 @@ TEST( Dall2all, ManyMsgs ) } } -TEST( Dall2all, LargeSend ) +TEST_F( DenseAll2AllTests, LargeSend ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - DenseAllToAll x( my_pid, nprocs ); size_t bigNum = size_t(std::numeric_limits::max()) + 10u ; diff --git a/src/MPI/dynamichook.cpp b/src/MPI/dynamichook.cpp index 974534fd..930ff420 100644 --- a/src/MPI/dynamichook.cpp +++ b/src/MPI/dynamichook.cpp @@ -52,7 +52,6 @@ struct _LPFLIB_LOCAL HookException : public std::runtime_error { {} }; -#ifdef MPI_HAS_OPEN_PORT namespace { // Compares two sockaddr objects. @@ -514,7 +513,6 @@ namespace { } #endif } -#endif // @@ -525,13 +523,6 @@ MPI_Comm dynamicHook( const std::string & serverNode, ASSERT( nprocs > 0 ); ASSERT( pid < nprocs ); -#ifndef MPI_HAS_OPEN_PORT - (void) serverNode; - (void) serverPort; - (void) timeout; (void) pid; (void) nprocs; - throw HookException("MPI does not support MPI_Open_port"); -#else - #ifdef USE_SIGALRM HookException timeoutException("operation timed out"); struct sigaction oldact; @@ -723,7 +714,6 @@ MPI_Comm dynamicHook( const std::string & serverNode, #endif return result; -#endif } diff --git a/src/MPI/dynamichook.t.cpp b/src/MPI/dynamichook.t.cpp index e7b2e6ca..8509d110 100644 --- a/src/MPI/dynamichook.t.cpp +++ b/src/MPI/dynamichook.t.cpp @@ -24,39 +24,65 @@ #include +extern "C" const int LPF_MPI_AUTO_INITIALIZE=0; +int myArgc; +char **myArgv; + +/** + * \pre P >= 1 + * \pre P <= 1 + * \return Exit code: 1 + */ + int main(int argc, char ** argv) { - MPI_Init(&argc, &argv); - ASSERT( argc >= 6 && "usage: ./dynamichook.t [server] [port] [pid] [nprocs] [timeout]"); - - std::string server = argv[1]; - std::string port = argv[2]; - int pid = atoi(argv[3]); - int nprocs = atoi(argv[4]); - int timeout = atoi(argv[5]); - - MPI_Comm comm = MPI_COMM_NULL; - - try { - comm = lpf::mpi::dynamicHook( server, port, pid, nprocs, - lpf::Time::fromSeconds( timeout / 1000.0 ) ); - } - catch( std::runtime_error & e) - { - ADD_FAILURE() << "hookup failed. Fatal!: " << e.what() << "\n"; - _exit(EXIT_FAILURE); - } - - int mpiPid = -1, mpiNprocs = -1; - MPI_Comm_rank( comm, &mpiPid); - MPI_Comm_size( comm, &mpiNprocs ); - - EXPECT_EQ( pid, mpiPid ); - EXPECT_EQ( nprocs, mpiNprocs ); - - MPI_Comm_free(&comm); - - MPI_Finalize(); - - return 0; + myArgc = argc; + myArgv = argv; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + +} + +TEST(API, dynamicHook) +{ + + /** + * This test is run via following options via + * ./dynamichook.t + * Being run "as is" without all these 5 arguments will lead it + * to fail (which is the normal Google Test case, so we expect exit code 1) + * However, when run via custom add_test tests with correct 5 arguments, it shall work + */ + ASSERT_GE(myArgc, 6); + MPI_Init(&myArgc, &myArgv); + std::string server = myArgv[1]; + std::string port = myArgv[2]; + int pid = atoi(myArgv[3]); + int nprocs = atoi(myArgv[4]); + int timeout = atoi(myArgv[5]); + + + MPI_Comm comm = MPI_COMM_NULL; + + try { + comm = lpf::mpi::dynamicHook( server, port, pid, nprocs, + lpf::Time::fromSeconds( timeout / 1000.0 ) ); + } + catch( std::runtime_error & e) + { + ADD_FAILURE() << "hookup failed. Fatal!: " << e.what() << "\n"; + _exit(EXIT_FAILURE); + } + + int mpiPid = -1, mpiNprocs = -1; + MPI_Comm_rank( comm, &mpiPid); + MPI_Comm_size( comm, &mpiNprocs ); + + EXPECT_EQ( pid, mpiPid ); + EXPECT_EQ( nprocs, mpiNprocs ); + + MPI_Comm_free(&comm); + + MPI_Finalize(); } + diff --git a/src/MPI/hall2all.t.cpp b/src/MPI/hall2all.t.cpp index a5252792..6085dcdc 100644 --- a/src/MPI/hall2all.t.cpp +++ b/src/MPI/hall2all.t.cpp @@ -23,45 +23,65 @@ using namespace lpf::mpi; -extern "C" const int LPF_MPI_AUTO_INITIALIZE=1; +extern "C" const int LPF_MPI_AUTO_INITIALIZE=0; -TEST( Hall2all, Create ) +/** + * \pre P >= 1 + * \pre P <= 2 + */ +class HAll2AllTests : public testing::Test { + + protected: + + static void SetUpTestSuite() { + + MPI_Init(NULL, NULL); + Lib::instance(); + + MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); + MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); + + } + + static void TearDownTestSuite() { + MPI_Finalize(); + } + + static int my_pid; + static int nprocs; +}; + +int HAll2AllTests::my_pid = -1; +int HAll2AllTests::nprocs = -1; + +TEST_F( HAll2AllTests, Create ) { HoeflerAllToAll x(9, 10); } -TEST( Hall2all, Reserve ) +TEST_F( HAll2AllTests, Reserve ) { HoeflerAllToAll x( 4,10); x.reserve( 50 , 100); } -TEST( Hall2all, Send ) +TEST_F( HAll2AllTests, Send ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - - HoeflerAllToAll x( my_pid, nprocs ); x.reserve( nprocs , sizeof(int)); for (int i = 0; i <= my_pid ; ++i) x.send( (my_pid + 1) % nprocs, &i, sizeof(int) ); bool prerandomize = true; - int error = x.exchange( Lib::instance().world(), prerandomize, NULL); + int dummyOutput[4]; + int error = x.exchange( Lib::instance().world(), prerandomize, dummyOutput); EXPECT_TRUE( !error ); } -TEST( Hall2all, Ring ) +TEST_F( HAll2AllTests, Ring ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - + int dummyOutput[4]; HoeflerAllToAll x(my_pid, nprocs); x.reserve( nprocs , sizeof(int)); x.send( (my_pid + 1) % nprocs, &my_pid, sizeof(my_pid) ); @@ -69,7 +89,7 @@ TEST( Hall2all, Ring ) EXPECT_FALSE( x.empty() ); bool prerandomize = true; - int error = x.exchange( Lib::instance().world(), prerandomize, NULL); + int error = x.exchange( Lib::instance().world(), prerandomize, dummyOutput); EXPECT_TRUE( !error ); EXPECT_FALSE( x.empty() ); @@ -83,14 +103,8 @@ TEST( Hall2all, Ring ) } -TEST( Hall2all, ManyMsgs ) +TEST_F( HAll2AllTests, ManyMsgs ) { - Lib::instance(); - - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - HoeflerAllToAll x(my_pid, nprocs ); const int nMsgs = 10000; x.reserve( nMsgs , sizeof(int)); @@ -105,8 +119,9 @@ TEST( Hall2all, ManyMsgs ) bool prerandomize = true; int trials = 5; + int dummyOutput[4]; int error = x.exchange( Lib::instance().world(), prerandomize, - NULL, trials); + dummyOutput, trials); EXPECT_FALSE( error ); for (int i = 0; i < nMsgs; ++i) @@ -121,13 +136,8 @@ TEST( Hall2all, ManyMsgs ) } } -TEST( Hall2all, LargeSend ) +TEST_F( HAll2AllTests, LargeSend ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - HoeflerAllToAll x( my_pid, nprocs ); std::vector data( size_t(std::numeric_limits::max()) + 10u ); @@ -138,7 +148,8 @@ TEST( Hall2all, LargeSend ) x.send( (my_pid + 1) % nprocs, data.data(), data.size() ); bool prerandomize = false; - int error = x.exchange( Lib::instance().world(), prerandomize, NULL); + int dummyOutput[4]; + int error = x.exchange( Lib::instance().world(), prerandomize, dummyOutput); EXPECT_TRUE( !error ); x.recv( data.data(), data.size() ); diff --git a/src/MPI/ibverbs.hpp b/src/MPI/ibverbs.hpp index b79ec53a..a96030a2 100644 --- a/src/MPI/ibverbs.hpp +++ b/src/MPI/ibverbs.hpp @@ -62,6 +62,10 @@ class _LPFLIB_LOCAL IBVerbs SlotID regGlobal( void * addr, size_t size ); void dereg( SlotID id ); + size_t getMaxMsgSize() const { + return m_maxMsgSize; + } + void put( SlotID srcSlot, size_t srcOffset, int dstPid, SlotID dstSlot, size_t dstOffset, size_t size ); diff --git a/src/MPI/ibverbs.t.cpp b/src/MPI/ibverbs.t.cpp index 65bd4905..8b916711 100644 --- a/src/MPI/ibverbs.t.cpp +++ b/src/MPI/ibverbs.t.cpp @@ -24,124 +24,139 @@ using namespace lpf::mpi; -extern "C" const int LPF_MPI_AUTO_INITIALIZE=1; +extern "C" const int LPF_MPI_AUTO_INITIALIZE=0; -TEST( IBVerbs, init ) + +/** + * \pre P >= 1 + * \pre P <= 2 + */ +class IBVerbsTests : public testing::Test { + + protected: + + static void SetUpTestSuite() { + + MPI_Init(NULL, NULL); + Lib::instance(); + comm = new Comm(); + *comm = Lib::instance().world(); + comm->barrier(); + verbs = new IBVerbs( *comm ); + } + + static void TearDownTestSuite() { + delete verbs; + verbs = nullptr; + delete comm; + comm = nullptr; + MPI_Finalize(); + } + + static Comm *comm; + static IBVerbs *verbs; +}; + +lpf::mpi::Comm * IBVerbsTests::comm = nullptr; +IBVerbs * IBVerbsTests::verbs = nullptr; + + +TEST_F( IBVerbsTests, init ) { - Comm comm = Lib::instance().world(); - comm.barrier(); - IBVerbs verbs( comm ); - comm.barrier(); + comm->barrier(); } -TEST( IBVerbs, resizeMemreg ) +TEST_F( IBVerbsTests, resizeMemreg ) { - Comm comm = Lib::instance().world(); - - comm.barrier(); - IBVerbs verbs( comm ); - verbs.resizeMemreg( 2 ); + verbs->resizeMemreg( 2 ); - comm.barrier(); + comm->barrier(); } -TEST( IBVerbs, resizeMesgq ) +TEST_F( IBVerbsTests, resizeMesgq ) { - Comm comm = Lib::instance().world(); - - comm.barrier(); - IBVerbs verbs( comm ); - verbs.resizeMesgq( 2 ); + verbs->resizeMesgq( 2 ); - comm.barrier(); + comm->barrier(); } -TEST( IBVerbs, regVars ) +TEST_F( IBVerbsTests, regVars ) { - Comm comm = Lib::instance().world(); - comm.barrier(); - IBVerbs verbs( comm ); char buf1[30] = "Hi"; char buf2[30] = "Boe"; - verbs.resizeMemreg( 2 ); + verbs->resizeMemreg( 2 ); - verbs.regLocal( buf1, sizeof(buf1) ); - verbs.regGlobal( buf2, sizeof(buf2) ); + IBVerbs::SlotID b1 = verbs->regLocal( buf1, sizeof(buf1) ); + IBVerbs::SlotID b2 = verbs->regGlobal( buf2, sizeof(buf2) ); - comm.barrier(); + comm->barrier(); + verbs->dereg(b1); + verbs->dereg(b2); } -TEST( IBVerbs, put ) +TEST_F( IBVerbsTests, put ) { - Comm comm = Lib::instance().world(); - - comm.barrier(); - IBVerbs verbs( comm ); char buf1[30] = "Hi"; char buf2[30] = "Boe"; - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( 1 ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( 1 ); - IBVerbs::SlotID b1 = verbs.regLocal( buf1, sizeof(buf1) ); - IBVerbs::SlotID b2 = verbs.regGlobal( buf2, sizeof(buf2) ); - - comm.barrier(); + IBVerbs::SlotID b1 = verbs->regLocal( buf1, sizeof(buf1) ); + IBVerbs::SlotID b2 = verbs->regGlobal( buf2, sizeof(buf2) ); + + comm->barrier(); - verbs.put( b1, 0, (comm.pid() + 1)%comm.nprocs(), b2, 0, sizeof(buf1)); + verbs->put( b1, 0, (comm->pid() + 1)%comm->nprocs(), b2, 0, sizeof(buf1)); - verbs.sync(true); + verbs->sync(true); EXPECT_EQ( "Hi", std::string(buf1) ); EXPECT_EQ( "Hi", std::string(buf2) ); + verbs->dereg(b1); + verbs->dereg(b2); } -TEST( IBVerbs, get ) +TEST_F( IBVerbsTests, get ) { - Comm comm = Lib::instance().world(); - - comm.barrier(); - IBVerbs verbs( comm ); char buf1[30] = "Hoi"; char buf2[30] = "Vreemd"; - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( 1 ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( 1 ); - IBVerbs::SlotID b1 = verbs.regLocal( buf1, sizeof(buf1) ); - IBVerbs::SlotID b2 = verbs.regGlobal( buf2, sizeof(buf2) ); - - comm.barrier(); + IBVerbs::SlotID b1 = verbs->regLocal( buf1, sizeof(buf1) ); + IBVerbs::SlotID b2 = verbs->regGlobal( buf2, sizeof(buf2) ); + + comm->barrier(); - verbs.get( (comm.pid() + 1)%comm.nprocs(), b2, 0, + verbs->get( (comm->pid() + 1)%comm->nprocs(), b2, 0, b1, 0, sizeof(buf2)); - verbs.sync(true); + verbs->sync(true); EXPECT_EQ( "Vreemd", std::string(buf1) ); EXPECT_EQ( "Vreemd", std::string(buf2) ); + verbs->dereg(b1); + verbs->dereg(b2); } -TEST( IBVerbs, putAllToAll ) +TEST_F( IBVerbsTests, putAllToAll ) { - Comm comm = Lib::instance().world(); - int nprocs = comm.nprocs(); - int pid = comm.pid(); - - comm.barrier(); - IBVerbs verbs( comm ); - + int nprocs = comm->nprocs(); + int pid = comm->pid(); + const int H = 2.5 * nprocs; std::vector< int > a(H); @@ -152,165 +167,159 @@ TEST( IBVerbs, putAllToAll ) b[i] = nprocs*nprocs - ( i * nprocs + pid); } - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( H ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( H ); - IBVerbs::SlotID a1 = verbs.regGlobal( a.data(), sizeof(int)*a.size()); - IBVerbs::SlotID b1 = verbs.regGlobal( b.data(), sizeof(int)*b.size()); - - comm.barrier(); + IBVerbs::SlotID a1 = verbs->regGlobal( a.data(), sizeof(int)*a.size()); + IBVerbs::SlotID b1 = verbs->regGlobal( b.data(), sizeof(int)*b.size()); + + comm->barrier(); for (int i = 0; i < H; ++i) { int dstPid = (pid + i ) % nprocs; - verbs.put( a1, sizeof(int)*i, - dstPid, b1, sizeof(int)*i, sizeof(int)); + verbs->put( a1, sizeof(int)*i, + dstPid, b1, sizeof(int)*i, sizeof(int)); } - verbs.sync(true); + verbs->sync(true); for (int i = 0; i < H; ++i) { int srcPid = (nprocs + pid - (i%nprocs)) % nprocs; EXPECT_EQ( i*nprocs + pid, a[i] ) ; EXPECT_EQ( i*nprocs + srcPid, b[i] ); } + verbs->dereg(a1); + verbs->dereg(b1); } -TEST( IBVerbs, getAllToAll ) +TEST_F( IBVerbsTests, getAllToAll ) { - Comm comm = Lib::instance().world(); - int nprocs = comm.nprocs(); - int pid = comm.pid(); + int nprocs = comm->nprocs(); + int pid = comm->pid(); - comm.barrier(); - IBVerbs verbs( comm ); + const int H = 100.3 * nprocs; - const int H = 1000.3 * nprocs; - - std::vector< int > a(H); - std::vector< int > b(H); + std::vector< int > a(H), a2(H); + std::vector< int > b(H), b2(H); for (int i = 0; i < H; ++i) { a[i] = i * nprocs + pid ; + a2[i] = a[i]; b[i] = nprocs*nprocs - ( i * nprocs + pid); + b2[i] = i*nprocs+ (nprocs + pid + i) % nprocs; } - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( H ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( H ); + + IBVerbs::SlotID a1 = verbs->regGlobal( a.data(), sizeof(int)*a.size()); + IBVerbs::SlotID b1 = verbs->regGlobal( b.data(), sizeof(int)*b.size()); - IBVerbs::SlotID a1 = verbs.regGlobal( a.data(), sizeof(int)*a.size()); - IBVerbs::SlotID b1 = verbs.regGlobal( b.data(), sizeof(int)*b.size()); - - comm.barrier(); + comm->barrier(); for (int i = 0; i < H; ++i) { int srcPid = (pid + i) % nprocs; - verbs.get( srcPid, a1, sizeof(int)*i, - b1, sizeof(int)*i, sizeof(int)); + verbs->get( srcPid, a1, sizeof(int)*i, + b1, sizeof(int)*i, sizeof(int)); } - verbs.sync(true); + verbs->sync(true); - for (int i = 0; i < H; ++i) { - int srcPid = (nprocs + pid + i ) % nprocs; - EXPECT_EQ( i*nprocs + pid, a[i] ) ; - EXPECT_EQ( i*nprocs + srcPid, b[i] ); - } -} + EXPECT_EQ(a, a2); + EXPECT_EQ(b, b2); + verbs->dereg(a1); + verbs->dereg(b1); -TEST( IBVerbs, putHuge ) -{ - Comm comm = Lib::instance().world(); +} - comm.barrier(); - IBVerbs verbs( comm ); - LOG(4, "Allocating mem1 "); - std::vector< char > hugeMsg( std::numeric_limits::max() * 1.5l ); - LOG(4, "Allocating mem2 "); - std::vector< char > hugeBuf( hugeMsg.size() ); +TEST_F( IBVerbsTests, putHuge ) +{ + std::vector hugeMsg(3*verbs->getMaxMsgSize()); + std::vector< char > hugeBuf(3*verbs->getMaxMsgSize()); + LOG(4, "Allocating putHuge with vector size: " << hugeMsg.size()); -#if 0 - LOG(4, "Initializing mem2 "); for ( size_t i = 0; i < hugeMsg.size() ; ++i) hugeMsg[i] = char( i ); -#endif - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( 1 ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( 1 ); - IBVerbs::SlotID b1 = verbs.regLocal( hugeMsg.data(), hugeMsg.size() ); - IBVerbs::SlotID b2 = verbs.regGlobal( hugeBuf.data(), hugeBuf.size() ); - - comm.barrier(); + IBVerbs::SlotID b1 = verbs->regLocal( hugeMsg.data(), hugeMsg.size() ); + IBVerbs::SlotID b2 = verbs->regGlobal( hugeBuf.data(), hugeBuf.size() ); + + comm->barrier(); - verbs.put( b1, 0, (comm.pid() + 1)%comm.nprocs(), b2, 0, hugeMsg.size() ); + verbs->put( b1, 0, (comm->pid() + 1)%comm->nprocs(), b2, 0, hugeMsg.size() * sizeof(char) ); - verbs.sync(true); + verbs->sync(true); EXPECT_EQ( hugeMsg, hugeBuf ); + + verbs->dereg(b1); + verbs->dereg(b2); } -TEST( IBVerbs, getHuge ) +TEST_F( IBVerbsTests, getHuge ) { - Comm comm = Lib::instance().world(); - - comm.barrier(); - IBVerbs verbs( comm ); - std::vector< char > hugeMsg( std::numeric_limits::max() * 1.5 ); - std::vector< char > hugeBuf( hugeMsg.size() ); + std::vector hugeMsg(3*verbs->getMaxMsgSize()); + std::vector< char > hugeBuf(3*verbs->getMaxMsgSize()); + LOG(4, "Allocating getHuge with vector size: " << hugeMsg.size()); for ( size_t i = 0; i < hugeMsg.size() ; ++i) - hugeMsg[i] = char( i ); + hugeMsg[i] = char(i); - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( 1 ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( 1 ); - IBVerbs::SlotID b1 = verbs.regLocal( hugeBuf.data(), hugeBuf.size() ); - IBVerbs::SlotID b2 = verbs.regGlobal( hugeMsg.data(), hugeMsg.size() ); - - comm.barrier(); + IBVerbs::SlotID b1 = verbs->regLocal( hugeMsg.data(), hugeMsg.size() ); + IBVerbs::SlotID b2 = verbs->regGlobal( hugeBuf.data(), hugeBuf.size() ); - verbs.get( (comm.pid() + 1)%comm.nprocs(), b2, 0, b1, 0, hugeMsg.size() ); + comm->barrier(); - verbs.sync(true); + verbs->get( (comm->pid() + 1)%comm->nprocs(), b2, 0, b1, 0, hugeMsg.size() * sizeof(char)); - EXPECT_EQ( hugeMsg, hugeBuf ); + verbs->sync(true); + + EXPECT_EQ(hugeMsg, hugeBuf); + + verbs->dereg(b1); + verbs->dereg(b2); } -TEST( IBVerbs, manyPuts ) +TEST_F( IBVerbsTests, manyPuts ) { - Comm comm = Lib::instance().world(); - - comm.barrier(); - IBVerbs verbs( comm ); - const unsigned N = 100000; + const unsigned N = 5000; std::vector< unsigned char > buf1( N ); std::vector< unsigned char > buf2( N ); for (unsigned int i = 0 ; i < N; ++ i) - buf1[i] = i + comm.pid() ; + buf1[i] = i + comm->pid() ; - verbs.resizeMemreg( 2 ); - verbs.resizeMesgq( N ); + verbs->resizeMemreg( 2 ); + verbs->resizeMesgq( N ); - IBVerbs::SlotID b1 = verbs.regLocal( buf1.data(), buf1.size() ); - IBVerbs::SlotID b2 = verbs.regGlobal( buf2.data(), buf1.size() ); - - comm.barrier(); + IBVerbs::SlotID b1 = verbs->regLocal( buf1.data(), buf1.size() ); + IBVerbs::SlotID b2 = verbs->regGlobal( buf2.data(), buf1.size() ); + + comm->barrier(); for ( unsigned i = 0 ; i < N; ++i) - verbs.put( b1, i, (comm.pid() + 1)%comm.nprocs(), b2, i, 1); + verbs->put( b1, i, (comm->pid() + 1)%comm->nprocs(), b2, i, 1); - verbs.sync(true); + verbs->sync(true); for ( unsigned i = 0 ; i < N; ++i) { - unsigned char b2_exp = i + (comm.pid() + comm.nprocs() - 1) % comm.nprocs(); - unsigned char b1_exp = i + comm.pid(); + unsigned char b2_exp = i + (comm->pid() + comm->nprocs() - 1) % comm->nprocs(); + unsigned char b1_exp = i + comm->pid(); EXPECT_EQ( b2_exp, buf2[i]); EXPECT_EQ( b1_exp, buf1[i] ); } + + verbs->dereg(b1); + verbs->dereg(b2); } diff --git a/src/MPI/interface.cpp b/src/MPI/interface.cpp index f1919f33..30ece40d 100644 --- a/src/MPI/interface.cpp +++ b/src/MPI/interface.cpp @@ -225,6 +225,4 @@ void Interface :: probe( machine_t & machine ) machine.l = &Interface::latency; } - - } // namespace lpf diff --git a/src/MPI/messagesort.t.cpp b/src/MPI/messagesort.t.cpp index 8347fd45..cd532762 100644 --- a/src/MPI/messagesort.t.cpp +++ b/src/MPI/messagesort.t.cpp @@ -31,6 +31,10 @@ TEST( MessageSort, empty ) } +/** + * \pre P >= 1 + * \pre P <= 1 + */ TEST( MessageSort, oneMsg ) { std::vector< char > array( 50 * G); diff --git a/src/MPI/spall2all.t.cpp b/src/MPI/spall2all.t.cpp index 42fae2c2..1a19d94c 100644 --- a/src/MPI/spall2all.t.cpp +++ b/src/MPI/spall2all.t.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -30,16 +31,40 @@ using namespace lpf::mpi; -extern "C" const int LPF_MPI_AUTO_INITIALIZE=1; +extern "C" const int LPF_MPI_AUTO_INITIALIZE=0; +/** + * \pre P >= 1 + * \pre P <= 2 + */ +class SparseAll2AllTests : public testing::Test { -TEST( Spall2allC, EnoughMemory ) -{ - lpf::mpi::Lib::instance().world(); + protected: + + static void SetUpTestSuite() { + + MPI_Init(NULL, NULL); + Lib::instance(); + + MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); + MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); + + } - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); + static void TearDownTestSuite() { + MPI_Finalize(); + } + + static int my_pid; + static int nprocs; +}; + +int SparseAll2AllTests::my_pid = -1; +int SparseAll2AllTests::nprocs = -1; + + +TEST_F( SparseAll2AllTests, EnoughMemory ) +{ using namespace std; using namespace lpf::mpi; @@ -160,23 +185,18 @@ const int M = N * (6 + 2*(int) ceil(1+log10(nprocs)) ); sparse_all_to_all_destroy( &spt ); } -TEST( Spall2all, Create ) +TEST_F( SparseAll2AllTests, Create ) { SparseAllToAll x(9, 10); } -TEST( Spall2all, Reserve ) +TEST_F( SparseAll2AllTests, Reserve ) { SparseAllToAll x( 4,10); } -TEST( Spall2all, ReserveUnequal ) +TEST_F( SparseAll2AllTests, ReserveUnequal ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - SparseAllToAll x( my_pid, nprocs ); // simulate the case where one of the processes can't @@ -189,14 +209,8 @@ TEST( Spall2all, ReserveUnequal ) EXPECT_TRUE( !error ); } -TEST( Spall2all, Send ) +TEST_F( SparseAll2AllTests, Send ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - - SparseAllToAll x( my_pid, nprocs ); x.reserve( nprocs * ceil(1+log2(nprocs)) , sizeof(int)); for (int i = 0; i <= my_pid ; ++i) @@ -207,13 +221,8 @@ TEST( Spall2all, Send ) EXPECT_TRUE( !error ); } -TEST( Spall2all, Ring ) +TEST_F( SparseAll2AllTests, Ring ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - SparseAllToAll x(my_pid, nprocs); EXPECT_TRUE( x.empty() ); @@ -236,13 +245,8 @@ TEST( Spall2all, Ring ) } -TEST( Spall2all, Access ) +TEST_F( SparseAll2AllTests, Access ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - SparseAllToAll x(my_pid, nprocs); x.reserve( nprocs * ceil(1+log2(nprocs)) , sizeof(int) ); EXPECT_TRUE( x.empty() ); @@ -260,14 +264,8 @@ TEST( Spall2all, Access ) EXPECT_TRUE( x.empty() ); } -TEST( Spall2all, SmallBuf ) +TEST_F( SparseAll2AllTests, SmallBuf ) { - Lib::instance(); - - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - SparseAllToAll x(my_pid, nprocs); const int nMsgs = 5; x.reserve( nMsgs , sizeof(int) ); @@ -287,13 +285,8 @@ TEST( Spall2all, SmallBuf ) } -TEST( Spall2all, SmallBufProc1 ) +TEST_F( SparseAll2AllTests, SmallBufProc1 ) { - Lib::instance(); - - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); SparseAllToAll x(my_pid, nprocs); const int nMsgs = 100; @@ -318,14 +311,8 @@ TEST( Spall2all, SmallBufProc1 ) } -TEST( Spall2all, ManyMsgs ) +TEST_F( SparseAll2AllTests, ManyMsgs ) { - Lib::instance(); - - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - SparseAllToAll x(my_pid, nprocs); const int nMsgs = 10000; x.reserve( nMsgs * 2 , sizeof(int) ); @@ -356,19 +343,14 @@ TEST( Spall2all, ManyMsgs ) } } -TEST( Spall2all, LargeSend ) +TEST_F( SparseAll2AllTests, LargeSend ) { - Lib::instance(); - int my_pid = -1, nprocs = -1; - MPI_Comm_rank( MPI_COMM_WORLD, &my_pid ); - MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); - - SparseAllToAll x( my_pid, nprocs ); std::vector data( size_t(std::numeric_limits::max()) + 10u ); for (size_t i = 0; i < data.size(); ++i) data[i] = char(i + my_pid) ; + SparseAllToAll x( my_pid, nprocs ); x.reserve( 1 , data.size() ); x.send( (my_pid + 1) % nprocs, data.data(), data.size() ); diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 5932d9db..91eddb06 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -24,7 +24,7 @@ add_library(lpf_common_${LPFLIB_CONFIG_NAME} OBJECT ) -add_gtest(time_test time.t.cpp time.cpp stack.cpp) -add_gtest(memreg_test memreg.t.cpp log.cpp time.cpp config.cpp stack.cpp) -add_gtest(sparseset_test sparseset.t.cpp log.cpp time.cpp config.cpp stack.cpp) +add_gtest(time_test "pthread" OFF time.t.cpp time.cpp stack.cpp) +add_gtest(memreg_test "pthread" OFF memreg.t.cpp log.cpp time.cpp config.cpp stack.cpp) +add_gtest(sparseset_test "pthread" OFF sparseset.t.cpp log.cpp time.cpp config.cpp stack.cpp) diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 47c0d57d..7f3f9c92 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -25,7 +25,8 @@ add_library( ${libname} rwconflict.cpp $ ) -target_link_libraries( ${libname} ${LIB_POSIX_THREADS} ) +target_link_libraries(${libname} ${LIB_POSIX_THREADS}) +target_include_directories(${libname} PRIVATE ${MPI_C_INCLUDE_PATH}) set_target_properties(${libname} PROPERTIES SOVERSION ${SOVERSION} ) @@ -34,7 +35,7 @@ install(TARGETS ${libname} EXPORT lpf RUNTIME DESTINATION ${INSTALL_BIN} LIBRARY DESTINATION ${INSTALL_LIB} ARCHIVE DESTINATION ${INSTALL_LIB} - ) +) -add_gtest(rwconflict_test rwconflict.t.cpp rwconflict.cpp - $ ) +add_gtest(rwconflict_test "pthread" rwconflict.t.cpp rwconflict.cpp) + #$ ) diff --git a/src/debug/core.cpp b/src/debug/core.cpp index d120b22b..c3d0adec 100644 --- a/src/debug/core.cpp +++ b/src/debug/core.cpp @@ -16,6 +16,8 @@ */ #include "debug/lpf/core.h" +#include "lpf/abort.h" + #undef lpf_get #undef lpf_put #undef lpf_sync @@ -55,6 +57,7 @@ #undef LPF_NONE #undef LPF_INIT_NONE #undef LPF_NO_ARGS +#undef LPF_HAS_ABORT #if __cplusplus >= 201103L #include @@ -78,8 +81,6 @@ #include "memreg.hpp" #include "rwconflict.hpp" - - namespace lpf { namespace debug { @@ -100,9 +101,21 @@ class _LPFLIB_LOCAL Interface { } static void threadInit() { + // in the below we use std::abort as these are critical *internal* + // errors, not errors in the use of LPF core functionality. + // By contrast, errors that appear due to misuse of the LPF core primitives + // should call lpf_abort. This initialiser ensures that the underlying LPF + // engine has support for lpf_abort. + // The above logic about when to std::abort and when to lpf_abort is applied + // consistently in the below implementation. Only (seemingly) exceptions will + // be documented henceforth. int rc = pthread_key_create( &s_threadKeyCtxStore, &destroyCtxStore ); if (rc) { - LOG( 0, "Internal error while initializing thread static storage"); + LOG( 0, "Internal error while initializing thread static storage" ); + std::abort(); + } + if( ! LPF_HAS_ABORT ) { + LOG( 0, "Debug layer relies on lpf_abort, but selected engine does not support it" ); std::abort(); } } @@ -220,7 +233,6 @@ class _LPFLIB_LOCAL Interface { } } - Interface( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs ) : m_ctx( ctx ) , m_pid( pid ) @@ -268,6 +280,7 @@ class _LPFLIB_LOCAL Interface { { } + void cleanup() { if ( m_comm_bufs_registered ) { @@ -429,27 +442,27 @@ class _LPFLIB_LOCAL Interface { if ( P <= 0 && P != LPF_MAX_P ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_exec: P = " << P ); - std::abort(); + lpf_abort(m_ctx); } if ( spmd == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_exec: NULL spmd argument" ); - std::abort(); + lpf_abort(m_ctx); } if ( args.input_size != 0 && args.input == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_spmd_t: NULL input argument while input_size is non-zero" ); - std::abort(); + lpf_abort(m_ctx); } if ( args.output_size != 0 && args.output == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_spmd_t: NULL output argument while output_size is non-zero" ); - std::abort(); + lpf_abort(m_ctx); } if ( args.f_size != 0 && args.f_symbols == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_spmd_t: NULL f_symbols argument while f_size is non-zero" ); - std::abort(); + lpf_abort(m_ctx); } lpf_args_t new_args; @@ -486,6 +499,13 @@ class _LPFLIB_LOCAL Interface { static lpf_err_t hook( const char * file, int line, lpf_init_t init, lpf_spmd_t spmd, lpf_args_t args ) { + // the lpf_hook could arise from any non-LPF context -- this is in fact + // why it exists: hooking from within an LPF context to create a subcontext is + // provided by lpf_rehook instead. + // Because the callee context is potentially not controlled by the underlying + // LPF engine, and because the callee context in the non-trivial case consists + // of multiple distributed processes, we cannot rely on lpf_abort. The only + // thing we can do is rely on the standard abort. if ( spmd == NULL ) { LOG( 0, file << ":" << line << ": Invalid argument passed to lpf_hook: NULL spmd argument" ); @@ -545,22 +565,22 @@ class _LPFLIB_LOCAL Interface { if ( spmd == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_rehook: NULL spmd argument" ); - std::abort(); + lpf_abort(m_ctx); } if ( args.input_size != 0 && args.input == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_spmd_t: NULL input argument while input_size is non-zero" ); - std::abort(); + lpf_abort(m_ctx); } if ( args.output_size != 0 && args.output == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_spmd_t: NULL output argument while output_size is non-zero" ); - std::abort(); + lpf_abort(m_ctx); } if ( args.f_size != 0 && args.f_symbols == NULL ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid argument passed to lpf_spmd_t: NULL f_symbols argument while f_size is non-zero" ); - std::abort(); + lpf_abort(m_ctx); } lpf_args_t new_args; @@ -676,7 +696,7 @@ class _LPFLIB_LOCAL Interface { "which would have taken the " << (m_memreg_size+1) << "-th slot, while only space for " << m_memreg_reserved << " slots has been reserved" ); - std::abort(); + lpf_abort(m_ctx); } Memslot slot; slot.file = file; @@ -707,7 +727,7 @@ class _LPFLIB_LOCAL Interface { "which would have taken the " << (m_memreg_size+1) << "-th slot, while only space for " << m_memreg_reserved << " slots has been reserved" ); - std::abort(); + lpf_abort(m_ctx); } Memslot slot; @@ -732,7 +752,7 @@ class _LPFLIB_LOCAL Interface { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Invalid attempt to deregister a memory slot, " "because it has not been registered before" ); - std::abort(); + lpf_abort(m_ctx); } if ( m_used_regs.find( slot ) != m_used_regs.end() ) { @@ -741,7 +761,7 @@ class _LPFLIB_LOCAL Interface { "because it is in use by the primitive on " << m_used_regs[slot].first << ":" << m_used_regs[slot].second ); - std::abort(); + lpf_abort(m_ctx); } if ( m_memreg.lookup( slot ).kind == Memslot::Global ) { @@ -778,7 +798,7 @@ class _LPFLIB_LOCAL Interface { if ( dst_pid < 0 || dst_pid >= m_nprocs ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": unknown process ID " << dst_pid << " for data destination " ); - std::abort(); + lpf_abort(m_ctx); } LPFLIB_RESTORE_WARNINGS @@ -786,26 +806,26 @@ class _LPFLIB_LOCAL Interface { LOG( 0, file << ":" << line << ": pid " << m_pid << ": numerical overflow while computing src_offset + size = " << src_offset << " + " << size << " > SIZE_MAX" ); - std::abort(); + lpf_abort(m_ctx); } if ( dst_offset > std::numeric_limits::max() - size ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": numerical overflow while computing dst_offset + size = " << dst_offset << " + " << size << " > SIZE_MAX" ); - std::abort(); + lpf_abort(m_ctx); } if ( m_active_regs.find( src_slot ) == m_active_regs.end() ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": source memory slot does not exist" ); - std::abort(); + lpf_abort(m_ctx); } if ( m_active_regs.find( dst_slot ) == m_active_regs.end() ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": destination memory slot does not exist" ); - std::abort(); + lpf_abort(m_ctx); } const Memslot & ss = m_memreg.lookup( src_slot ); @@ -818,7 +838,7 @@ class _LPFLIB_LOCAL Interface { " A synchronisation is necessary to active" " the memory registration at " << ss.file << ":" << ss.line ); - std::abort(); + lpf_abort(m_ctx); } if ( ss.kind == Memslot::Local && ss.size[0] < src_offset + size ) { @@ -827,7 +847,7 @@ class _LPFLIB_LOCAL Interface { << ss.file << ":" << ss.line << " ) is read past the end by " << ( src_offset + size - ss.size[0] ) << " bytes. "); - std::abort(); + lpf_abort(m_ctx); } if ( ss.kind == Memslot::Global && ss.size[m_pid] < src_offset + size ) { @@ -836,7 +856,7 @@ class _LPFLIB_LOCAL Interface { << ss.file << ":" << ss.line << " ) is read past the end by " << ( src_offset + size - ss.size[m_pid] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } if ( ! ds.active ) { @@ -846,7 +866,7 @@ class _LPFLIB_LOCAL Interface { "missing. A synchronisation is necessary " "to active the memory registration at " << ds.file << ":" << ds.line ); - std::abort(); + lpf_abort(m_ctx); } if ( ds.kind == Memslot::Local ) { @@ -854,7 +874,7 @@ class _LPFLIB_LOCAL Interface { << ": destination memory must be globally registered. " << "Instead, it was only locally registered at " << ds.file << ":" << ds.line ); - std::abort(); + lpf_abort(m_ctx); } if ( ds.kind == Memslot::Global && ds.size[dst_pid] != size_t(-1) @@ -864,7 +884,7 @@ class _LPFLIB_LOCAL Interface { << ds.file << ":" << ds.line << " ) is written past the end by " << ( dst_offset + size - ds.size[dst_pid] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } if ( m_puts.size() + m_gets.size() >= m_mesgq_reserved ) { @@ -874,7 +894,7 @@ class _LPFLIB_LOCAL Interface { << ": This is the " << (m_puts.size() + m_gets.size() + 1) << "-th message, while space for only " << m_mesgq_reserved << " has been reserved. Request queue follows\n" << t.str() ); - std::abort(); + lpf_abort(m_ctx); } m_used_regs[src_slot] = std::make_pair( file, line ); @@ -896,7 +916,7 @@ class _LPFLIB_LOCAL Interface { if ( src_pid < 0 || src_pid >= m_nprocs ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": unknown process ID " << src_pid << " for data source" ); - std::abort(); + lpf_abort(m_ctx); } LPFLIB_RESTORE_WARNINGS @@ -904,26 +924,26 @@ class _LPFLIB_LOCAL Interface { LOG( 0, file << ":" << line << ": pid " << m_pid << ": numerical overflow while computing src_offset + size = " << src_offset << " + " << size << " > SIZE_MAX" ); - std::abort(); + lpf_abort(m_ctx); } if ( dst_offset > std::numeric_limits::max() - size ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": numerical overflow while computing dst_offset + size = " << dst_offset << " + " << size << " > SIZE_MAX" ); - std::abort(); + lpf_abort(m_ctx); } if ( m_active_regs.find( src_slot ) == m_active_regs.end() ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": source memory slot does not exist" ); - std::abort(); + lpf_abort(m_ctx); } if ( m_active_regs.find( dst_slot ) == m_active_regs.end() ) { LOG( 0, file << ":" << line << ": pid " << m_pid << ": destination memory slot does not exist" ); - std::abort(); + lpf_abort(m_ctx); } const Memslot & ss = m_memreg.lookup( src_slot ); @@ -936,7 +956,7 @@ class _LPFLIB_LOCAL Interface { " A synchronisation is necessary to active" " the memory registration at " << ss.file << ":" << ss.line ); - std::abort(); + lpf_abort(m_ctx); } if ( ss.kind == Memslot::Local ) { @@ -945,7 +965,7 @@ class _LPFLIB_LOCAL Interface { "Instead, it was registered only locally at " << ss.file << ":" << ss.line ); - std::abort(); + lpf_abort(m_ctx); } if ( ss.kind == Memslot::Global && ss.size[src_pid] != size_t(-1) @@ -955,7 +975,7 @@ class _LPFLIB_LOCAL Interface { << ss.file << ":" << ss.line << " ) is read past the end by " << ( src_offset + size - ss.size[src_pid] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } if ( ! ds.active ) { @@ -965,7 +985,7 @@ class _LPFLIB_LOCAL Interface { "missing. A synchronisation is necessary" "to active the memory registration at " << ds.file << ":" << ds.line ); - std::abort(); + lpf_abort(m_ctx); } if ( ds.kind == Memslot::Local && ds.size[0] < dst_offset + size ) { @@ -974,7 +994,7 @@ class _LPFLIB_LOCAL Interface { << ds.file << ":" << ds.line << " ) is written past the end by " << ( dst_offset + size - ds.size[0] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } if ( ds.kind == Memslot::Global && ds.size[m_pid] < dst_offset + size ) { @@ -983,7 +1003,7 @@ class _LPFLIB_LOCAL Interface { << ds.file << ":" << ds.line << " ) is written past the end by " << ( dst_offset + size - ds.size[m_pid] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } if ( m_puts.size() + m_gets.size() >= m_mesgq_reserved ) { @@ -993,7 +1013,7 @@ class _LPFLIB_LOCAL Interface { << ": This is the " << (m_puts.size() + m_gets.size() + 1) << "-th message, while space for only " << m_mesgq_reserved << " has been reserved. Request queue follows\n" << t.str() ); - std::abort(); + lpf_abort(m_ctx); } m_used_regs[src_slot] = std::make_pair( file, line ); @@ -1006,6 +1026,13 @@ class _LPFLIB_LOCAL Interface { return LPF_SUCCESS; } + lpf_err_t abort(const char * file, int line) { + (void) file; + (void) line; + lpf_abort(m_ctx); + return LPF_SUCCESS; + } + lpf_err_t sync( const char * file, int line, lpf_sync_attr_t attr = LPF_SYNC_DEFAULT ) { @@ -1019,7 +1046,7 @@ class _LPFLIB_LOCAL Interface { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Could not allocate extra debug messages in message queue" ); - std::abort(); + lpf_abort(m_ctx); } } @@ -1029,7 +1056,7 @@ class _LPFLIB_LOCAL Interface { LOG( 0, file << ":" << line << ": pid " << m_pid << ": Could not allocate extra debug memory slots in memory registration table" ); - std::abort(); + lpf_abort(m_ctx); } } @@ -1089,7 +1116,7 @@ class _LPFLIB_LOCAL Interface { << ": Number of global registrations does not match." " I have " << globregs << ", while pid " << p << " has " << m_glob_regs[p] << " global registrations" ); - std::abort(); + lpf_abort(m_ctx); } if (globderegs != m_glob_deregs[p] ) { @@ -1097,7 +1124,7 @@ class _LPFLIB_LOCAL Interface { << ": Number of deregistrations of global slots does not match." " I have " << globderegs << ", while pid " << p << " has " << m_glob_deregs[p] << " deregistrations" ); - std::abort(); + lpf_abort(m_ctx); } } @@ -1128,7 +1155,7 @@ class _LPFLIB_LOCAL Interface { LOG( 0, file << ":" << line << ": pid " << m_pid << ": the " << i << "-th global deregistration mismatches " " on pid " << p << " and " << m_pid ); - std::abort(); + lpf_abort(m_ctx); } } @@ -1181,7 +1208,7 @@ class _LPFLIB_LOCAL Interface { "somehow (other confused pid " << p << " )" ", which makes me think that this is " "an internal error in the debug layer. Sorry!"); - std::abort(); + lpf_abort(m_ctx); } } @@ -1272,7 +1299,7 @@ class _LPFLIB_LOCAL Interface { "Incoming requests from PIDs 0.." << m_nprocs << " = " << s.str() << ". Local request queue follows (" << m_puts.size() << " puts " << "and " << m_gets.size() << " gets )\n" << t.str() ); - std::abort(); + lpf_abort(m_ctx); } // reallocate access buffers if they were resized. @@ -1316,7 +1343,7 @@ class _LPFLIB_LOCAL Interface { << " ) is written past the end by " << ( put.dstOffset + put.size - ds.size[m_pid] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } m_rwconflict.insertRead( @@ -1344,7 +1371,7 @@ class _LPFLIB_LOCAL Interface { << " ) is read past the end by " << ( get.srcOffset + get.size - ss.size[m_pid] ) << " bytes"); - std::abort(); + lpf_abort(m_ctx); } size_t & index = m_remote_access_by_me_offsets_local[ get.srcPid ]; @@ -1398,7 +1425,7 @@ class _LPFLIB_LOCAL Interface { << static_cast(ptr+a.offset+a.size) << "); Reads are " << s.str() ; ); - std::abort(); + lpf_abort(m_ctx); } } } @@ -1422,7 +1449,7 @@ class _LPFLIB_LOCAL Interface { << static_cast(ptr+get.dstOffset+get.size) << "); Reads are " << s.str() ; ); - std::abort(); + lpf_abort(m_ctx); } } @@ -1609,6 +1636,10 @@ lpf_err_t lpf_debug_register_local( const char * file, int line, ) { return Interface::lookupCtx( file, line, ctx )->register_local( file, line, pointer, size, memslot); } +extern _LPFLIB_API +lpf_err_t lpf_debug_abort( const char * file, int line, lpf_t ctx) +{ return Interface::lookupCtx( file, line, ctx )->abort( file, line); } + extern _LPFLIB_API lpf_err_t lpf_debug_deregister( const char * file, int line, lpf_t ctx, lpf_memslot_t memslot @@ -1656,7 +1687,6 @@ lpf_err_t lpf_debug_sync( const char * file, int line, lpf_t ctx, lpf_sync_attr_t attr ) { return Interface::lookupCtx( file, line, ctx )->sync( file, line, attr ); } - } // extern "C" diff --git a/src/hybrid/CMakeLists.txt b/src/hybrid/CMakeLists.txt index c2a87b14..ea1a3885 100644 --- a/src/hybrid/CMakeLists.txt +++ b/src/hybrid/CMakeLists.txt @@ -20,8 +20,10 @@ if (HYBRID_ENGINE_ENABLED) set(LPF_IMPL_ID hybrid) set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) -set(LPFLIB_HYBRID_MPI_ENGINE "ibverbs" CACHE STRING - "Choice of MPI engine to use for inter-process communication") +if( NOT DEFINED LPFLIB_HYBRID_MPI_ENGINE ) + message( FATAL_ERROR "Hybrid engine is enabled but no inter-node engine was selected" ) +endif() + set(mpi_engine "${LPFLIB_HYBRID_MPI_ENGINE}" ) message( STATUS "Hybrid implementation's multi-node layer is '${mpi_engine}'") diff --git a/src/hybrid/core.cpp b/src/hybrid/core.cpp index 12870298..404edda8 100644 --- a/src/hybrid/core.cpp +++ b/src/hybrid/core.cpp @@ -35,9 +35,12 @@ #endif - extern "C" { +// the value 2 in this implementation indicates support for lpf_abort in a way +// that may deviate from the stdlib abort() +_LPFLIB_VAR const int LPF_HAS_ABORT = 2; + _LPFLIB_VAR const lpf_err_t LPF_SUCCESS = 0; _LPFLIB_VAR const lpf_err_t LPF_ERR_OUT_OF_MEMORY = 1; _LPFLIB_VAR const lpf_err_t LPF_ERR_FATAL = 2; @@ -384,4 +387,13 @@ _LPFLIB_API lpf_err_t lpf_resize_memory_register( lpf_t ctx, size_t max_regs ) return LPF_SUCCESS; } +_LPFLIB_API lpf_err_t lpf_abort(lpf_t ctx) +{ + using namespace lpf::hybrid; + ThreadState * const t = realContext(ctx); + MPI mpi = t->nodeState().mpi(); + mpi.abort(); + return LPF_SUCCESS; +} + } // extern "C" diff --git a/src/hybrid/dispatch.hpp b/src/hybrid/dispatch.hpp index 1235e513..c131c412 100644 --- a/src/hybrid/dispatch.hpp +++ b/src/hybrid/dispatch.hpp @@ -19,23 +19,29 @@ #define LPF_CORE_HYBRID_DISPATCH_HPP #undef LPFLIB_CORE_H +#undef LPFLIB_ABORT_H #define LPF_CORE_STATIC_DISPATCH #define LPF_CORE_STATIC_DISPATCH_ID pthread #define LPF_CORE_STATIC_DISPATCH_CONFIG LPF_CORE_IMPL_CONFIG #include +#include #undef LPF_CORE_STATIC_DISPATCH_ID #undef LPF_CORE_STATIC_DISPATCH_CONFIG #undef LPFLIB_CORE_H +#undef LPFLIB_ABORT_H #define LPF_CORE_STATIC_DISPATCH_ID LPF_CORE_MULTI_NODE_ENGINE #define LPF_CORE_STATIC_DISPATCH_CONFIG LPF_CORE_IMPL_CONFIG #include +#include #undef LPF_CORE_STATIC_DISPATCH_ID #undef LPF_CORE_STATIC_DISPATCH_CONFIG #undef LPFLIB_CORE_H +#undef LPFLIB_ABORT_H #undef LPF_CORE_STATIC_DISPATCH #include +#include #define USE_THREAD( symbol ) \ LPF_RENAME_PRIMITIVE4( lpf, pthread, LPF_CORE_IMPL_CONFIG, symbol ) @@ -226,6 +232,9 @@ namespace lpf { namespace hybrid { err_t resize_memory_register( size_t max_regs ) { return USE_MPI(resize_memory_register)(m_ctx, max_regs); } + err_t abort( ) + { return USE_MPI(abort)(m_ctx); } + static bool is_linked_correctly() { return SUCCESS != ERR_OUT_OF_MEMORY diff --git a/src/imp/core.c b/src/imp/core.c index 990e267c..e076b811 100644 --- a/src/imp/core.c +++ b/src/imp/core.c @@ -22,6 +22,8 @@ #include #include +const int LPF_HAS_ABORT = 0; + const lpf_err_t LPF_SUCCESS = 0; const lpf_err_t LPF_ERR_OUT_OF_MEMORY = 1; const lpf_err_t LPF_ERR_FATAL = 2; @@ -179,3 +181,8 @@ lpf_err_t lpf_resize_memory_register( lpf_t lpf, size_t max_regs ) return LPF_SUCCESS; } +lpf_err_t lpf_abort( lpf_t lpf ) +{ + (void) lpf; + return LPF_SUCCESS; +} diff --git a/src/pthreads/core.cpp b/src/pthreads/core.cpp index 1d90588a..080b6a1d 100644 --- a/src/pthreads/core.cpp +++ b/src/pthreads/core.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "threadlocaldata.hpp" #include "machineparams.hpp" @@ -37,6 +38,10 @@ #include // for pthreads +// the value 2 in this implementation indicates support for lpf_abort in a way +// that may deviate from the stdlib abort() +const int LPF_HAS_ABORT = 2; + const lpf_err_t LPF_SUCCESS = 0; const lpf_err_t LPF_ERR_OUT_OF_MEMORY = 1; const lpf_err_t LPF_ERR_FATAL = 2; @@ -378,3 +383,15 @@ lpf_err_t lpf_resize_memory_register( lpf_t ctx, size_t max_regs ) return t->resizeMemreg(max_regs); } +lpf_err_t lpf_abort(lpf_t ctx) { + (void) ctx; + // Using std::abort is not portable + // SIGABRT code 6 is often coverted to code 134. + // Therefore, use std::quick_exit(6) instead + // The reason we do not use std::exit is that + // it implies calling destructors, and this leads to + // segmentation faults for pthread backend and abnormal + // programs. std::quick_exit does not call destructors + std::quick_exit(6); + return LPF_SUCCESS; +} diff --git a/test_launcher.py.in b/test_launcher.py.in new file mode 100644 index 00000000..656e570f --- /dev/null +++ b/test_launcher.py.in @@ -0,0 +1,38 @@ +import argparse +import subprocess +import sys + +parser = argparse.ArgumentParser( description='Death test launcher' ) +parser.add_argument("-e", "--engine", type=str) +parser.add_argument("-L", "--parallel_launcher", type=str) +parser.add_argument("-p", "--min_process_count", type=int) +parser.add_argument("-P", "--max_process_count", type=int) +parser.add_argument("-t", "--lpf_probe_timer", type=float) +parser.add_argument("-R", "--expected_return_code", type=int) +parser.add_argument( 'cmd', nargs=argparse.REMAINDER ) +args = parser.parse_args() + +# This is only for passing Gtest info to CMake +# The parallel launcher is still needed as Open MPI +# binaries terminate without the launcher on our cluster, +# even for single process runs +if args.cmd[-1] == '--gtest_list_tests': + run_cmd = [args.parallel_launcher, '-engine', args.engine, '-n', '1'] + args.cmd + cmd = subprocess.run( run_cmd) + sys.exit(cmd.returncode) +# Actual use of our launcher +else: + for i in range(args.min_process_count, args.max_process_count+1): + if args.lpf_probe_timer > 0.0: + run_cmd = [args.parallel_launcher, '-engine', args.engine, '-probe', str(args.lpf_probe_timer), '-n', str(i)] + args.cmd + else: + run_cmd = [args.parallel_launcher, '-engine', args.engine, '-n', str(i)] + args.cmd + print("Run command: ") + print(run_cmd) + cmd = subprocess.run( run_cmd) + print("Test returned code = " + str(cmd.returncode)) + retcode = cmd.returncode + if (retcode != args.expected_return_code): + print("Test " + args.cmd[0] + args.cmd[1] + "\nreturned\t" + str(retcode) + "\nexpected return code was: " + str(args.expected_return_code)) + sys.exit(1) + print("Test " + args.cmd[0] + args.cmd[1] + " passed") diff --git a/tests/functional/CMakeLists.txt b/tests/functional/CMakeLists.txt index 7aadf7e1..0eb7eea6 100644 --- a/tests/functional/CMakeLists.txt +++ b/tests/functional/CMakeLists.txt @@ -15,58 +15,143 @@ # limitations under the License. # -# All test sources have file names as bla.c -file(GLOB AllTestSources "*.c" ) -# All test sources which are specific to some engine are of the form -# bla.pthread.c -file(GLOB AllSpecificTestSources "*.*.c") -# All generic test sources don't have the two dots in their name -file(GLOB AllGenericTestSources "*.c") -list(REMOVE_ITEM AllGenericTestSources ${AllSpecificTestSources}) +set(test_sources + func_bsplib_example_lpf_sum.cpp + func_bsplib_example_lpf_sum_unsafemode.cpp + func_bsplib_example_put_array.cpp + func_bsplib_example_put_array_unsafemode.cpp + func_bsplib_example_reverse.cpp + func_bsplib_example_reverse_unsafemode.cpp + func_bsplib_get_exceptions.cpp + func_bsplib_get_normal.cpp + func_bsplib_get_normal_unsafemode.cpp + func_bsplib_get_twice_on_same_remote.cpp + func_bsplib_get_twice_on_same_remote_unsafemode.cpp + func_bsplib_getput_same_dest.cpp + func_bsplib_getput_same_dest_unsafemode.cpp + func_bsplib_getput_same_remote.cpp + func_bsplib_getput_same_remote_unsafemode.cpp + func_bsplib_getput_zero_bytes.cpp + func_bsplib_hpget_many.cpp + func_bsplib_hpput_many.cpp + func_bsplib_hpsend_many.cpp + func_bsplib_nprocs.cpp + func_bsplib_pid.cpp + func_bsplib_pushpopreg_ambiguous.cpp + func_bsplib_pushpopreg_different_variables.cpp + func_bsplib_pushpopreg_exceptions.cpp + func_bsplib_pushpopreg_many_same.cpp + func_bsplib_pushpopreg_normal.cpp + func_bsplib_pushpopreg_normal_unsafemode.cpp + func_bsplib_pushpopreg_null.cpp + func_bsplib_pushpopreg_pop_before_put.cpp + func_bsplib_pushpopreg_pop_before_put_unsafemode.cpp + func_bsplib_pushpopreg_pop_on_one_process.cpp + func_bsplib_pushpopreg_push_on_one_process.cpp + func_bsplib_pushpopreg_same_growing_memory.cpp + func_bsplib_pushpopreg_same_shrinking_memory.cpp + func_bsplib_pushpopreg_two_pops_before_two_puts.cpp + func_bsplib_put_exceptions.cpp + func_bsplib_put_normal.cpp + func_bsplib_put_normal_unsafemode.cpp + func_bsplib_send_empty_tag.cpp + func_bsplib_send_non_empty_tag.cpp + func_bsplib_send_none.cpp + func_bsplib_send_null.cpp + func_bsplib_send_one.cpp + func_bsplib_send_one_unsafemode.cpp + func_bsplib_set_different_tag_size.cpp + func_bsplib_set_tag_size.cpp + func_bsplib_sync_except_p0.cpp + func_bsplib_sync_only_p0.cpp + func_bsplib_time.cpp + func_lpf_deregister_parallel_multiple.cpp + func_lpf_deregister_parallel_single.cpp + func_lpf_exec_multiple_call_single_arg_dual_proc.cpp + func_lpf_exec_nested_call_single_arg_dual_proc.cpp + func_lpf_exec_single_call_no_arg_max_proc.cpp + func_lpf_exec_single_call_no_arg_single_proc.cpp + func_lpf_exec_single_call_single_arg_dual_proc.cpp + func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.cpp + func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.cpp + func_lpf_exec_single_call_single_arg_single_proc.cpp + func_lpf_get_parallel_alltoall.cpp + func_lpf_get_parallel_huge.cpp + func_lpf_get_parallel_overlapping_complete.cpp + func_lpf_get_parallel_overlapping_pyramid.cpp + func_lpf_get_parallel_overlapping_rooftiling.cpp + func_lpf_get_parallel_single.cpp + func_lpf_probe_parallel_full.cpp + func_lpf_probe_parallel_nested.cpp + func_lpf_probe_root.cpp + func_lpf_put_and_get_overlapping.cpp + func_lpf_put_parallel_alltoall.cpp + func_lpf_put_parallel_big.cpp + func_lpf_put_parallel_huge.cpp + func_lpf_put_parallel_overlapping_complete.cpp + func_lpf_put_parallel_overlapping_pyramid.cpp + func_lpf_put_parallel_overlapping_rooftiling.cpp + func_lpf_put_parallel_single.cpp + func_lpf_register_and_deregister_irregularly.cpp + func_lpf_register_and_deregister_many_global.cpp + func_lpf_register_global_parallel_grow.cpp + func_lpf_register_global_parallel_multiple.cpp + func_lpf_register_global_parallel_shrink.cpp + func_lpf_register_global_root_multiple.cpp + func_lpf_register_global_root_single.cpp + func_lpf_register_local_parallel_multiple.cpp + func_lpf_resize_delayed_shrinking_memory_registers.cpp + func_lpf_resize_delayed_shrinking_message_queues.cpp + func_lpf_resize_parallel_five.cpp + func_lpf_resize_root_five.cpp + func_lpf_resize_root_outofmem.cpp + func_lpf_resize_root_zero.cpp + macro_LPF_VERSION.cpp + type_lpf_spmd_t.cpp + type_lpf_t.cpp + ) -foreach(LPF_IMPL_ID ${ENGINES}) -foreach(debug ON OFF) +foreach (LPF_IMPL_ID ${ENGINES}) + set(debug ON) set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) - file(GLOB ThisEngineSources "*.${LPF_IMPL_ID}.c") - set(mode) if (debug) - set(mode "_debug") - endif() + set(mode "_debug") + endif(debug) # add all source files except the ones we don't want - foreach(testSource ${AllGenericTestSources} ${ThisEngineSources}) - string(REGEX REPLACE "(.${LPF_IMPL_ID})?.c$" "" baseName ${testSource}) + foreach(testSource ${test_sources}) + string(REGEX REPLACE "(.${LPF_IMPL_ID})?.cpp$" "" baseName ${testSource}) get_filename_component(baseName ${testSource} NAME_WE ) set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") - set(corelib "lpf_core_univ_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}") - set(hllib "lpf_hl${mode}") - set(debuglib "lpf_debug") + add_gtest(${exeName} ${LPF_IMPL_ID} ${debug} "${CMAKE_CURRENT_SOURCE_DIR}/${testSource}") - add_executable(${exeName} ${testSource}) - target_link_libraries(${exeName} ${hllib}) - target_link_exe_with_core(${exeName} ${LPF_IMPL_ID}) - target_compile_flags(${exeName} PRIVATE ${hllib} "-DLPF_CORE_IMPL_ID=${LPF_IMPL_ID}" ) - - if (debug) - target_link_libraries(${exeName} ${debuglib}) - target_include_directories( ${exeName} BEFORE PRIVATE ../../include/debug ) - endif() - - endforeach() - endforeach(debug) + endforeach(testSource) +endforeach(LPF_IMPL_ID) - add_test( NAME "API_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}" - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" "${LPF_IMPL_ID}" - "${LPF_IMPL_CONFIG}" "${test_output}/api_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}.xml" - ) +# start of engine-specific tests +foreach (LPF_IMPL_ID ${ENGINES}) + if ("${LPF_IMPL_ID}" STREQUAL "pthread" OR "${LPF_IMPL_ID}" STREQUAL "mpirma") + foreach(testSource func_lpf_hook_simple.${LPF_IMPL_ID}.cpp) + string(REGEX REPLACE "(.${LPF_IMPL_ID})?.cpp$" "" baseName ${testSource}) + get_filename_component(baseName ${testSource} NAME_WE ) + set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") + add_gtest(${exeName} ${LPF_IMPL_ID} ON "${CMAKE_CURRENT_SOURCE_DIR}/${testSource}") + endforeach(testSource) + endif() + if ("${LPF_IMPL_ID}" STREQUAL "mpimsg") + add_gtest(func_lpf_hook_subset.mpimsg mpimsg ON "${CMAKE_CURRENT_SOURCE_DIR}/func_lpf_hook_subset.mpimsg.cpp") + endif() + if ("${LPF_IMPL_ID}" STREQUAL "mpirma") + add_gtest(func_lpf_hook_tcp_timeout.mpirma mpirma ON "${CMAKE_CURRENT_SOURCE_DIR}/func_lpf_hook_tcp_timeout.mpirma.cpp") + endif() endforeach(LPF_IMPL_ID) +# end of engine-specific tests include_directories(.) - -add_subdirectory(c99) add_subdirectory(debug) +add_subdirectory(collectives) option(LPFLIB_MAKE_TEST_DOC "Build the test documentation" OFF) diff --git a/tests/functional/Test.h b/tests/functional/Test.h deleted file mode 100644 index 1b1eb807..00000000 --- a/tests/functional/Test.h +++ /dev/null @@ -1,135 +0,0 @@ - -/* - * Copyright 2021 Huawei Technologies Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LPF_TESTS_FUNCTIONAL_TEST_H -#define LPF_TESTS_FUNCTIONAL_TEST_H - -#include -#include -#include - -#include "assert.hpp" - -#define EXPECT_EQ( format, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( (expected) != (actual) ) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected (%s) which evaluates to " format ", but\n" \ - " actual (%s) which evaluates to " format ".\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#define EXPECT_NE( format, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( (expected) == (actual) ) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected (%s) which evaluates to " format " to be different from\n" \ - " actual (%s) which evaluates to " format ".\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#define EXPECT_LE( format, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( !( (expected) <= (actual)) ) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected that (%s) which evaluates to " format ", is less than\n" \ - " or equal to (%s) which evaluates to " format ".\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#define EXPECT_GE( format, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( !( (expected) >= (actual) )) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected that (%s) which evaluates to " format ", is greater than\n" \ - " or equal to (%s) which evaluates to " format ".\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#define EXPECT_LT( format, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( !( (expected) < (actual)) ) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected that (%s) which evaluates to " format ", is less than\n" \ - " (%s) which evaluates to " format ".\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#define EXPECT_GT( format, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( !( (expected) > (actual) )) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected that (%s) which evaluates to " format ", is greater than\n" \ - " (%s) which evaluates to " format ".\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#define EXPECT_STREQ( N, expected, actual ) \ - do { LPFLIB_IGNORE_TAUTOLOGIES \ - if ( strncmp( (expected), (actual), (N) ) != 0 ) { \ - fprintf(stderr, "TEST FAILURE in " __FILE__ ":%d\n" \ - " Expected (%s) which evaluates to %s, but\n" \ - " actual (%s) which evaluates to %s.\n", __LINE__, \ - #expected, (expected), #actual, (actual) ); \ - abort(); } \ - LPFLIB_RESTORE_WARNINGS } while(0) - -#ifdef __GNUC__ - #define UNUSED __attribute__((unused)) -#else - #define UNUSED -#endif - -/** \mainpage Test documentation - * - * This documentation lists the tests of the LPF implementation - * - \ref APITests - * - */ - -/** \defgroup APITests API Tests - * A set of small programs to test the LPF API. - */ - -#ifdef DOXYGEN -#define TEST( name ) \ - /** \ingroup APITests */ \ - int name( lpf_pid_t P ) - -#else - -#define TEST( name ) \ - /** \ingroup APITests */ \ - int name(int argc, char ** argv); \ - \ - int main(int argc, char ** argv) \ - { \ - (void) argc; (void) argv; \ - return name (argc, argv); \ - } \ - \ - int name(int argc UNUSED, char ** argv UNUSED) - -#endif - -#endif diff --git a/tests/functional/c99/CMakeLists.txt b/tests/functional/c99/CMakeLists.txt deleted file mode 100644 index 584acb59..00000000 --- a/tests/functional/c99/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ - -# -# Copyright 2021 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -foreach(LPF_IMPL_ID ${ENGINES}) -foreach(debug ON OFF) - set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) - - set(mode) - if (debug) - set(mode "_debug") - endif() - - file(GLOB TestSources "*.c") - foreach(testSource ${TestSources}) - string(REGEX REPLACE ".c$" "" exeName ${testSource}) - get_filename_component(exeName ${testSource} NAME_WE ) - set(exeName "${exeName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") - - set(corelib "lpf_core_univ_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}") - set(hllib "lpf_hl${mode}") - set(debuglib "lpf_debug") - add_executable(${exeName} ${testSource}) - target_link_exe_with_core(${exeName} ${LPF_IMPL_ID}) - target_link_libraries(${exeName} ${hllib}) - set_target_properties(${exeName} PROPERTIES - C_STANDARD 99 - C_STANDARD_REQUIRED YES - ) - target_compile_flags(${exeName} PRIVATE ${hllib}) - if (debug) - target_link_libraries(${exeName} ${debuglib}) - target_include_directories( ${exeName} BEFORE PRIVATE ../../../include/debug ) - endif() - endforeach() -endforeach(debug) -endforeach(LPF_IMPL_ID) - diff --git a/tests/functional/collectives/CMakeLists.txt b/tests/functional/collectives/CMakeLists.txt new file mode 100644 index 00000000..14edce9d --- /dev/null +++ b/tests/functional/collectives/CMakeLists.txt @@ -0,0 +1,58 @@ + +# +# Copyright 2021 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +set(c99_tests_sources + func_lpf_allcombine.cpp + func_lpf_allgather.cpp + func_lpf_allgather_overlapped.cpp + func_lpf_allreduce.cpp + func_lpf_alltoall.cpp + func_lpf_broadcast.cpp + func_lpf_broadcast_prime_size_object.cpp + func_lpf_broadcast_small_prime_size_object.cpp + func_lpf_collectives_init.cpp + func_lpf_collectives_init_overflow.cpp + func_lpf_combine.cpp + func_lpf_gather.cpp + func_lpf_reduce.cpp + func_lpf_scatter.cpp +) + +foreach (LPF_IMPL_ID ${ENGINES}) + set(debug ON) + set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) + + set(mode) + if (debug) + set(mode "_debug") + endif(debug) + + # add all source files except the ones we don't want + foreach(testSource ${c99_tests_sources}) + string(REGEX REPLACE "(.${LPF_IMPL_ID})?.cpp$" "" baseName ${testSource}) + get_filename_component(baseName ${testSource} NAME_WE ) + set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") + + add_gtest(${exeName} ${LPF_IMPL_ID} ${debug} "${CMAKE_CURRENT_SOURCE_DIR}/${testSource}") + + string(REGEX REPLACE "(.${LPF_IMPL_ID})?.cpp$" "" baseName ${testSource}) + get_filename_component(baseName ${testSource} NAME_WE ) + set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") + + endforeach(testSource) +endforeach(LPF_IMPL_ID) diff --git a/tests/functional/c99/func_lpf_allcombine.c b/tests/functional/collectives/func_lpf_allcombine.cpp similarity index 78% rename from tests/functional/c99/func_lpf_allcombine.c rename to tests/functional/collectives/func_lpf_allcombine.cpp index bdbc5d71..6e7c20e8 100644 --- a/tests/functional/c99/func_lpf_allcombine.c +++ b/tests/functional/collectives/func_lpf_allcombine.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -37,47 +37,47 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg lpf_err_t rc; rc = lpf_resize_message_queue( ctx, 2*p ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const size_t byte_size = (1 << 19) / sizeof(double); const size_t size = byte_size / sizeof(double); - double * data = malloc( byte_size ); - EXPECT_NE( "%p", NULL, data ); + double * data = new double[size]; + EXPECT_NE( nullptr, data ); for( size_t i = 0; i < size; ++i ) { data[ i ] = s; } rc = lpf_register_global( ctx, data, byte_size, &data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, byte_size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_allcombine( coll, data, data_slot, size, sizeof(double), &elementwise_add ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( size_t i = 0; i < size; ++i ) { const double num = (double)(coll.P) / 2.0; const double max = (double)(coll.P-1); - EXPECT_EQ( "%lf", num * max, data[i] ); + EXPECT_EQ( num * max, data[i] ); } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -85,10 +85,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_allcombine ) +TEST(COLL, func_lpf_allcombine ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS ); - EXPECT_EQ("%d", LPF_SUCCESS, rc); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc); } diff --git a/tests/functional/c99/func_lpf_allgather.c b/tests/functional/collectives/func_lpf_allgather.cpp similarity index 71% rename from tests/functional/c99/func_lpf_allgather.c rename to tests/functional/collectives/func_lpf_allgather.cpp index ced82f8a..9a82b701 100644 --- a/tests/functional/c99/func_lpf_allgather.c +++ b/tests/functional/collectives/func_lpf_allgather.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) @@ -31,66 +31,66 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, 2*p); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 3 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - char * src = malloc( size ); - EXPECT_NE( "%p", NULL, src ); + char * src = new char[size] ; + EXPECT_NE( nullptr, src ); - char * dst = malloc( p * size ); - EXPECT_NE( "%p", NULL, dst ); + char * dst = new char[p * size]; + EXPECT_NE( nullptr, dst ); for( size_t i = 0; i < size; ++i ) { src[ i ] = (char)s; } rc = lpf_register_global( ctx, src, size, &src_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); for( size_t i = 0; i < p * size; ++i ) { dst[ i ] = -1; } rc = lpf_register_global( ctx, dst, p * size, &dst_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, p * size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_allgather( coll, src_slot, dst_slot, size, true ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( size_t i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char)s, src[ i ] ); + EXPECT_EQ( (char)s, src[ i ] ); } for( lpf_pid_t k = 0; k < p; ++k ) { for( size_t i = 0; i < size; ++i ) { const size_t index = k * size + i; if( k == s ) { - EXPECT_EQ( "%c", (char) -1, dst[ index ] ); + EXPECT_EQ( (char) -1, dst[ index ] ); } else { - EXPECT_EQ( "%c", (char)k, dst[ index ] ); + EXPECT_EQ( (char)k, dst[ index ] ); } } } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, src_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, dst_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( src ); - free( dst ); + delete[] src; + delete[] dst; } /** @@ -98,10 +98,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_allgather ) +TEST(COLL, func_lpf_allgather ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc); } diff --git a/tests/functional/c99/func_lpf_allgather_overlapped.c b/tests/functional/collectives/func_lpf_allgather_overlapped.cpp similarity index 75% rename from tests/functional/c99/func_lpf_allgather_overlapped.c rename to tests/functional/collectives/func_lpf_allgather_overlapped.cpp index a3a475c4..f4ad2e21 100644 --- a/tests/functional/c99/func_lpf_allgather_overlapped.c +++ b/tests/functional/collectives/func_lpf_allgather_overlapped.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) @@ -31,15 +31,15 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, 2*p); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 3); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - char * data = malloc( p * size ); - EXPECT_NE( "%p", NULL, data ); + char * data = new char[ p * size]; + EXPECT_NE( nullptr, data ); for( lpf_pid_t k = 0; k < p; ++k ) { for( size_t i = 0; i < size; ++i ) { @@ -51,37 +51,37 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } } rc = lpf_register_global( ctx, data, p * size, &data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( ctx, data + s * size, size, &src_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, p * size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_allgather( coll, src_slot, data_slot, size, true ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( lpf_pid_t k = 0; k < p; ++k ) { for( size_t i = 0; i < size; ++i ) { const size_t index = k * size + i; - EXPECT_EQ( "%c", (char)k, data[ index ] ); + EXPECT_EQ( (char)k, data[ index ] ); } } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, src_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -89,10 +89,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_allgather_overlapped ) +TEST( COLL, func_lpf_allgather_overlapped ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_allreduce.c b/tests/functional/collectives/func_lpf_allreduce.cpp similarity index 78% rename from tests/functional/c99/func_lpf_allreduce.c rename to tests/functional/collectives/func_lpf_allreduce.cpp index c7d65b78..7c707c29 100644 --- a/tests/functional/c99/func_lpf_allreduce.c +++ b/tests/functional/collectives/func_lpf_allreduce.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -40,45 +40,45 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg lpf_err_t rc; rc = lpf_resize_message_queue( ctx, 2*p - 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); double reduced_value = INFINITY; const size_t byte_size = (1 << 19) / sizeof(double); const size_t size = byte_size / sizeof(double); - double * data = malloc( byte_size ); - EXPECT_NE( "%p", NULL, data ); + double * data = new double[size]; + EXPECT_NE( nullptr, data ); for( size_t i = 0; i < size; ++i ) { data[ i ] = s * size + i; } rc = lpf_register_global( ctx, &reduced_value, sizeof(double), &elem_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, sizeof(double), 0, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); min( size, data, &reduced_value ); rc = lpf_allreduce( coll, &reduced_value, elem_slot, sizeof(double), &min ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%lf", 0.0, reduced_value ); + EXPECT_EQ( 0.0, reduced_value ); rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, elem_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -86,10 +86,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_allreduce ) +TEST( COLL, func_lpf_allreduce ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_alltoall.c b/tests/functional/collectives/func_lpf_alltoall.cpp similarity index 70% rename from tests/functional/c99/func_lpf_alltoall.c rename to tests/functional/collectives/func_lpf_alltoall.cpp index 157056db..8589146d 100644 --- a/tests/functional/c99/func_lpf_alltoall.c +++ b/tests/functional/collectives/func_lpf_alltoall.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) @@ -31,18 +31,18 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, 2 * p - 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 3 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - char * src = malloc( p * size ); - EXPECT_NE( "%p", NULL, src ); + char * src = new char[p * size]; + EXPECT_NE( nullptr, src ); - char * dst = malloc( p * size ); - EXPECT_NE( "%p", NULL, dst ); + char * dst = new char[p * size]; + EXPECT_NE( nullptr, dst ); for( size_t i = 0; i < p * size; ++i ) { src[ i ] = (char)s; @@ -50,46 +50,46 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } rc = lpf_register_global( ctx, src, p * size, &src_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( ctx, dst, p * size, &dst_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_alltoall( coll, src_slot, dst_slot, size ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( size_t i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char)s, src[ i ] ); + EXPECT_EQ( (char)s, src[ i ] ); } for( lpf_pid_t k = 0; k < p; ++k ) { for( size_t i = 0; i < size; ++i ) { const size_t index = k * size + i; if( k == s ) { - EXPECT_EQ( "%c", (char) (-s), dst[ index ] ); + EXPECT_EQ( (char) (-s), dst[ index ] ); } else { - EXPECT_EQ( "%c", (char)k, dst[ index ] ); + EXPECT_EQ( (char)k, dst[ index ] ); } } } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, src_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, dst_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( src ); - free( dst ); + delete[] src; + delete[] dst; } /** @@ -97,10 +97,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_alltoall ) +TEST( COLL, func_lpf_alltoall ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_broadcast.c b/tests/functional/collectives/func_lpf_broadcast.cpp similarity index 76% rename from tests/functional/c99/func_lpf_broadcast.c rename to tests/functional/collectives/func_lpf_broadcast.cpp index 77e4664d..33bce636 100644 --- a/tests/functional/c99/func_lpf_broadcast.c +++ b/tests/functional/collectives/func_lpf_broadcast.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" long max( long a, long b) { return a < b ? b : a; } @@ -30,16 +30,16 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, max( p+1, 2*((long)p)-3)); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const long size = (1 << 19); - char * data = malloc( size ); - EXPECT_NE( "%p", NULL, data ); + char * data = new char[size]; + EXPECT_NE( nullptr, data ); if( s == p / 2 ) { for( long i = 0; i < size; ++i ) { @@ -52,28 +52,28 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } rc = lpf_register_global( ctx, data, size, &data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, (1<<19), &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_broadcast( coll, data_slot, data_slot, size, p/2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( long i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char) -1, data[i] ); + EXPECT_EQ( (char) -1, data[i] ); } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -81,10 +81,9 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_broadcast ) +TEST( COLL, func_lpf_broadcast ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_broadcast_prime_size_object.c b/tests/functional/collectives/func_lpf_broadcast_prime_size_object.cpp similarity index 75% rename from tests/functional/c99/func_lpf_broadcast_prime_size_object.c rename to tests/functional/collectives/func_lpf_broadcast_prime_size_object.cpp index 6869063c..06114d52 100644 --- a/tests/functional/c99/func_lpf_broadcast_prime_size_object.c +++ b/tests/functional/collectives/func_lpf_broadcast_prime_size_object.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" long max( long a, long b) { return a < b ? b : a; } @@ -30,16 +30,16 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, max( p+1, 2*((long)p)-3)); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const long size = 197; - char * data = malloc( size ); - EXPECT_NE( "%p", NULL, data ); + char * data = new char[size]; + EXPECT_NE( nullptr, data ); if( s == p / 2 ) { for( long i = 0; i < size; ++i ) { @@ -52,28 +52,28 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } rc = lpf_register_global( ctx, data, size, &data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_broadcast( coll, data_slot, data_slot, size, p/2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( long i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char) -1, data[i] ); + EXPECT_EQ( (char) -1, data[i] ); } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -81,10 +81,9 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_broadcast_prime_size_object ) +TEST( COLL, func_lpf_broadcast_prime_size_object ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_broadcast_small_prime_size_object.c b/tests/functional/collectives/func_lpf_broadcast_small_prime_size_object.cpp similarity index 76% rename from tests/functional/c99/func_lpf_broadcast_small_prime_size_object.c rename to tests/functional/collectives/func_lpf_broadcast_small_prime_size_object.cpp index 3b043cb3..416a9046 100644 --- a/tests/functional/c99/func_lpf_broadcast_small_prime_size_object.c +++ b/tests/functional/collectives/func_lpf_broadcast_small_prime_size_object.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" long max( long a, long b) { return a < b ? b : a; } @@ -30,16 +30,16 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, max( p+1, 2*((long)p)-3)); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const long size = 11; - char * data = malloc( size ); - EXPECT_NE( "%p", NULL, data ); + char * data = new char[size]; + EXPECT_NE( nullptr, data ); if( s == p / 2 ) { for( long i = 0; i < size; ++i ) { @@ -52,28 +52,28 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } rc = lpf_register_global( ctx, data, size, &data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_broadcast( coll, data_slot, data_slot, size, p/2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for( long i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char) -1, data[i] ); + EXPECT_EQ( (char) -1, data[i] ); } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -81,10 +81,9 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_broadcast_small_prime_size_object ) +TEST( COLL, func_lpf_broadcast_small_prime_size_object ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_collectives_init.c b/tests/functional/collectives/func_lpf_collectives_init.cpp similarity index 75% rename from tests/functional/c99/func_lpf_collectives_init.c rename to tests/functional/collectives/func_lpf_collectives_init.cpp index 0e504f08..5d7e2d9e 100644 --- a/tests/functional/c99/func_lpf_collectives_init.c +++ b/tests/functional/collectives/func_lpf_collectives_init.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args) @@ -28,34 +28,34 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args) lpf_err_t rc; rc = lpf_resize_memory_register( ctx, 4 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, 0, &coll1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 8, 0, &coll2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, (1<<7), 0, (1<<19), &coll3 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, (1<<4), 8, (1<<25), &coll4 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_destroy( coll1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_destroy( coll2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_destroy( coll3 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_destroy( coll4 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -63,10 +63,9 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_collectives_init ) +TEST( COLL, func_lpf_collectives_init ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_collectives_init_overflow.c b/tests/functional/collectives/func_lpf_collectives_init_overflow.cpp similarity index 82% rename from tests/functional/c99/func_lpf_collectives_init_overflow.c rename to tests/functional/collectives/func_lpf_collectives_init_overflow.cpp index 7b74da8e..fc1e5e12 100644 --- a/tests/functional/c99/func_lpf_collectives_init_overflow.c +++ b/tests/functional/collectives/func_lpf_collectives_init_overflow.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,14 +29,14 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args) lpf_err_t rc; rc = lpf_resize_memory_register( ctx, 5 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); //make sure the base case is OK rc = lpf_collectives_init( ctx, s, p, (1<<7), (1<<7), (1<<7), &coll1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); //now let us create some overflows const size_t tooBig = (size_t)(-1); @@ -44,34 +44,34 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args) //overflow in the number of calls: may or may not be encountered by an implementation: const lpf_err_t rc1 = lpf_collectives_init( ctx, s, p, tooBig, (1<<7), (1<<7), &coll2 ); bool success = (rc1 == LPF_SUCCESS) || (rc1 == LPF_ERR_OUT_OF_MEMORY); - EXPECT_EQ( "%d", true, success ); + EXPECT_EQ( true, success ); //overflow in the element size required for reduction buffers: an implementation MUST detect this: rc = lpf_collectives_init( ctx, s, p, (1<<7), tooBig, (1<<7), &coll3 ); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY, rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY, rc ); //overflow in the collective buffer size: may or may not be encountered by an implementation: const lpf_err_t rc2 = lpf_collectives_init( ctx, s, p, (1<<7), (1<<7), tooBig, &coll4 ); success = (rc2 == LPF_SUCCESS) || (rc2 == LPF_ERR_OUT_OF_MEMORY); - EXPECT_EQ( "%d", true, success ); + EXPECT_EQ( true, success ); //overflow that if not detected would lead to a very small buffer: an implementation MUST detect this: if( p > 1 ) { rc = lpf_collectives_init( ctx, s, p, (1<<7), tooBig / p + 1, (1<<7), &coll5 ); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY, rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY, rc ); } rc = lpf_collectives_destroy( coll1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if( rc1 == LPF_SUCCESS ) { rc = lpf_collectives_destroy( coll2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } if( rc2 == LPF_SUCCESS ) { rc = lpf_collectives_destroy( coll4 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } @@ -80,10 +80,9 @@ void spmd( lpf_t ctx, lpf_pid_t s, lpf_pid_t p, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_collectives_init_overflow ) +TEST( COLL, func_lpf_collectives_init_overflow ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_combine.c b/tests/functional/collectives/func_lpf_combine.cpp similarity index 79% rename from tests/functional/c99/func_lpf_combine.c rename to tests/functional/collectives/func_lpf_combine.cpp index a3ebc808..8bb5b1e7 100644 --- a/tests/functional/c99/func_lpf_combine.c +++ b/tests/functional/collectives/func_lpf_combine.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -38,51 +38,51 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg lpf_err_t rc; rc = lpf_resize_message_queue( ctx, 2*p ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const size_t byte_size = (1 << 19) / sizeof(double); const size_t size = byte_size / sizeof(double); - double * data = malloc( byte_size ); - EXPECT_NE( "%p", NULL, data ); + double * data = new double[size]; + EXPECT_NE( nullptr, data ); for( size_t i = 0; i < size; ++i ) { data[ i ] = s; } rc = lpf_register_global( ctx, data, byte_size, &data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, byte_size, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_combine( coll, data, data_slot, size, sizeof(double), &elementwise_add, p / 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if( s == p / 2 ) { for( size_t i = 0; i < size; ++i ) { const double num = (double)(coll.P) / 2.0; const double max = (double)(coll.P-1); - EXPECT_EQ( "%lf", num * max, data[i] ); + EXPECT_EQ( num * max, data[i] ); } } else { //standard declares contents of data as undefined } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -90,10 +90,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_combine ) +TEST( COLL, func_lpf_combine ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_gather.c b/tests/functional/collectives/func_lpf_gather.cpp similarity index 74% rename from tests/functional/c99/func_lpf_gather.c rename to tests/functional/collectives/func_lpf_gather.cpp index 7f3b95cf..c4c7e6b1 100644 --- a/tests/functional/c99/func_lpf_gather.c +++ b/tests/functional/collectives/func_lpf_gather.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) @@ -29,21 +29,21 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, p-1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const size_t size = (1 << 19); - char * data = NULL; + char * data = nullptr; if( s == p / 2 ) { - data = malloc( size * p ); + data = new char[size * p]; } else { - data = malloc( size ); + data = new char[size]; } - EXPECT_NE( "%p", NULL, data ); + EXPECT_NE( nullptr, data ); if( s == p / 2 ) { for( size_t i = 0; i < size * p; ++i ) { @@ -56,41 +56,41 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } rc = lpf_register_global( ctx, data, size, &data_slot ); } - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, (1<<19), &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_gather( coll, data_slot, data_slot, size, p / 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if( s == p / 2 ) { for( lpf_pid_t source = 0; source < p; ++source ) { for( size_t i = 0; i < size; ++i ) { const size_t index = source * size + i; if( source == s ) { - EXPECT_EQ( "%c", (char) -1, data[ index ] ); + EXPECT_EQ( (char) -1, data[ index ] ); } else { - EXPECT_EQ( "%c", (char) source, data[ index ] ); + EXPECT_EQ( (char) source, data[ index ] ); } } } } else { for( size_t i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char) s, data[i] ); + EXPECT_EQ( (char) s, data[i] ); } } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -98,10 +98,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_gather ) +TEST( COLL, func_lpf_gather ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_reduce.c b/tests/functional/collectives/func_lpf_reduce.cpp similarity index 77% rename from tests/functional/c99/func_lpf_reduce.c rename to tests/functional/collectives/func_lpf_reduce.cpp index 404e8f8c..ac970aeb 100644 --- a/tests/functional/c99/func_lpf_reduce.c +++ b/tests/functional/collectives/func_lpf_reduce.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -40,50 +40,50 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg lpf_err_t rc; rc = lpf_resize_message_queue( ctx, p - 1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); double reduced_value = INFINITY; const size_t byte_size = (1 << 19) / sizeof(double); const size_t size = byte_size / sizeof(double); - double * data = malloc( byte_size ); - EXPECT_NE( "%p", NULL, data ); + double * data = new double[size]; + EXPECT_NE( nullptr, data ); for( size_t i = 0; i < size; ++i ) { data[ i ] = s * size + i; } rc = lpf_register_global( ctx, &reduced_value, sizeof(double), &element_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, sizeof(double), 0, &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); min( size, data, &reduced_value ); const double local_reduce_value = reduced_value; rc = lpf_reduce( coll, &reduced_value, element_slot, sizeof(double), &min, p / 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if( s == p / 2 ) { - EXPECT_EQ( "%lf", 0.0, reduced_value ); + EXPECT_EQ( 0.0, reduced_value ); } else { - EXPECT_EQ( "%lf", local_reduce_value, reduced_value ); + EXPECT_EQ( local_reduce_value, reduced_value ); } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, element_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -91,10 +91,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const lpf_args_t arg * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_reduce ) +TEST( COLL, func_lpf_reduce ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/c99/func_lpf_scatter.c b/tests/functional/collectives/func_lpf_scatter.cpp similarity index 75% rename from tests/functional/c99/func_lpf_scatter.c rename to tests/functional/collectives/func_lpf_scatter.cpp index ade4fbab..96f3f9fe 100644 --- a/tests/functional/c99/func_lpf_scatter.c +++ b/tests/functional/collectives/func_lpf_scatter.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) @@ -29,21 +29,21 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) lpf_err_t rc; rc = lpf_resize_message_queue( ctx, p-1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); const size_t size = (1 << 19); char * data = NULL; if( s == p / 2 ) { - data = malloc( size * p ); + data = new char[size * p ]; } else { - data = malloc( size ); + data = new char[size]; } - EXPECT_NE( "%p", NULL, data ); + EXPECT_NE( nullptr, data ); if( s == p / 2 ) { for( size_t i = 0; i < size * p; ++i ) { @@ -56,34 +56,34 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) } rc = lpf_register_global( ctx, data, size, &data_slot ); } - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_collectives_init( ctx, s, p, 1, 0, (1<<19), &coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_scatter( coll, data_slot, data_slot, size, p / 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if( s == p / 2 ) { for( size_t i = 0; i < size * p; ++i ) { - EXPECT_EQ( "%c", (char)i, data[i] ); + EXPECT_EQ( (char)i, data[i] ); } } else { for( size_t i = 0; i < size; ++i ) { - EXPECT_EQ( "%c", (char)(s * size + i), data[i] ); + EXPECT_EQ( (char)(s * size + i), data[i] ); } } rc = lpf_collectives_destroy( coll ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( ctx, data_slot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - free( data ); + delete[] data; } /** @@ -91,10 +91,9 @@ void spmd( lpf_t ctx, const lpf_pid_t s, lpf_pid_t p, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_scatter ) +TEST( COLL, func_lpf_scatter ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/CMakeLists.txt b/tests/functional/debug/CMakeLists.txt index e9b8e5c7..e160d1a3 100644 --- a/tests/functional/debug/CMakeLists.txt +++ b/tests/functional/debug/CMakeLists.txt @@ -14,35 +14,94 @@ # See the License for the specific language governing permissions and # limitations under the License. # +set(debug_test_sources + func_lpf_debug_deregister_non_existing_slot.cpp + func_lpf_debug_exec_null_f_symbols.cpp + func_lpf_debug_exec_null_input.cpp + func_lpf_debug_exec_null_output.cpp + func_lpf_debug_exec_null_spmd.cpp + func_lpf_debug_get_local_src_slot.cpp + func_lpf_debug_get_overflow_dst_offset.cpp + func_lpf_debug_get_overflow_src_offset.cpp + func_lpf_debug_get_read_past_source_memory_global_known_at_sync.cpp + func_lpf_debug_get_read_past_source_memory_global_known_before_sync.cpp + func_lpf_debug_get_too_many_requests.cpp + func_lpf_debug_get_too_many_requests_remote.cpp + func_lpf_debug_get_too_many_requests_self.cpp + func_lpf_debug_get_unknown_dest_slot.cpp + func_lpf_debug_get_unknown_source_pid.cpp + func_lpf_debug_get_unknown_source_slot.cpp + func_lpf_debug_get_write_past_dest_memory_global.cpp + func_lpf_debug_get_write_past_dest_memory_local.cpp + func_lpf_debug_global_deregister_mismatch.cpp + func_lpf_debug_global_deregister_order_mismatch.cpp + func_lpf_debug_global_deregister_unequal.cpp + func_lpf_debug_global_register_null_memreg.cpp + func_lpf_debug_local_register_null_memreg.cpp + func_lpf_debug_put_after_deregister_dest_after_sync.cpp + func_lpf_debug_put_after_deregister_dest.cpp + func_lpf_debug_put_after_deregister_source_after_sync.cpp + func_lpf_debug_put_after_deregister_source.cpp + func_lpf_debug_put_get_too_many_requests.cpp + func_lpf_debug_put_get_too_many_requests_remote.cpp + func_lpf_debug_put_local_dest_slot.cpp + func_lpf_debug_put_overflow_dst_offset.cpp + func_lpf_debug_put_overflow_src_offset.cpp + func_lpf_debug_put_read_past_source_memory_global.cpp + func_lpf_debug_put_read_past_source_memory_local.cpp + func_lpf_debug_put_read_write_conflict_among_many.cpp + func_lpf_debug_put_read_write_conflict.cpp + func_lpf_debug_put_too_many_requests.cpp + func_lpf_debug_put_too_many_requests_remote.cpp + func_lpf_debug_put_too_many_requests_self.cpp + func_lpf_debug_put_unknown_dest_pid.cpp + func_lpf_debug_put_unknown_dest_slot.cpp + func_lpf_debug_put_unknown_source_slot.cpp + func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.cpp + func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.cpp + func_lpf_debug_register_global_dst_unsynced.cpp + func_lpf_debug_register_global_src_unsynced.cpp + func_lpf_debug_register_global_unequal.cpp + func_lpf_debug_rehook_null_f_symbols.cpp + func_lpf_debug_rehook_null_input.cpp + func_lpf_debug_rehook_null_output.cpp + func_lpf_debug_rehook_null_spmd.cpp + func_lpf_debug_resize_memory_register_with_size_max_minus_three.cpp + ) -# All test sources have file names as bla.c -file(GLOB AllTestSources "*.c" ) -# All test sources which are specific to some engine are of the form -# bla.pthread.c -file(GLOB AllSpecificTestSources "*.*.c") -# All generic test sources don't have the two dots in their name -file(GLOB AllGenericTestSources "*.c") -list(REMOVE_ITEM AllGenericTestSources ${AllSpecificTestSources}) -foreach(LPF_IMPL_ID ${ENGINES}) - set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) +set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) +set(debug ON) +set(LPF_IMPL_CONFIG ${LPFLIB_CONFIG_NAME}) +set(mode) +if (debug) + set(mode "_debug") +endif(debug) +foreach (LPF_IMPL_ID ${ENGINES}) + foreach(testSource ${debug_test_sources}) - file(GLOB ThisEngineSources "*.${LPF_IMPL_ID}.c") - - # add all source files except the ones we don't want - foreach(testSource ${AllGenericTestSources} ${ThisEngineSources}) - string(REGEX REPLACE ".c$" "" baseName ${testSource}) + string(REGEX REPLACE "(.${LPF_IMPL_ID})?.cpp$" "" baseName ${testSource}) get_filename_component(baseName ${testSource} NAME_WE ) - set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}") - set(corelib "lpf_core_univ_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}") - set(debuglib "lpf_debug") + set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") + + add_gtest(${exeName} ${LPF_IMPL_ID} ${debug} "${CMAKE_CURRENT_SOURCE_DIR}/${testSource}" ) - add_executable(${exeName} ${testSource}) - target_include_directories( ${exeName} BEFORE PRIVATE ../../../include/debug ) - target_link_libraries(${exeName} ${debuglib}) - target_link_exe_with_core(${exeName} ${LPF_IMPL_ID}) - target_compile_flags(${exeName} PRIVATE "-DLPF_CORE_IMPL_ID=${LPF_IMPL_ID}" ) - endforeach() + string(REGEX REPLACE "(.${LPF_IMPL_ID})?.cpp$" "" baseName ${CMAKE_CURRENT_SOURCE_DIR}/${testSource}) + get_filename_component(baseName ${testSource} NAME_WE ) + set(exeName "${baseName}_${LPF_IMPL_ID}_${LPF_IMPL_CONFIG}${mode}") + endforeach(testSource) endforeach(LPF_IMPL_ID) +add_gtest(func_lpf_debug_hook_f_symbols_pthread "pthread" ON + ${CMAKE_CURRENT_SOURCE_DIR}/func_lpf_debug_hook_null_f_symbols.pthread.cpp) + +add_gtest(func_lpf_debug_hook_null_input_pthread "pthread" ON + ${CMAKE_CURRENT_SOURCE_DIR}/func_lpf_debug_hook_null_input.pthread.cpp) + +add_gtest(func_lpf_debug_hook_null_output_pthread "pthread" ON + ${CMAKE_CURRENT_SOURCE_DIR}/func_lpf_debug_hook_null_output.pthread.cpp) + +add_gtest(func_lpf_debug_hook_null_spmd_pthread "pthread" ON + ${CMAKE_CURRENT_SOURCE_DIR}/func_lpf_debug_hook_null_spmd.pthread.cpp) + diff --git a/tests/functional/debug/func_lpf_debug_deregister_non_existing_slot.c b/tests/functional/debug/func_lpf_debug_deregister_non_existing_slot.cpp similarity index 90% rename from tests/functional/debug/func_lpf_debug_deregister_non_existing_slot.c rename to tests/functional/debug/func_lpf_debug_deregister_non_existing_slot.cpp index 7bf36563..5afa95a2 100644 --- a/tests/functional/debug/func_lpf_debug_deregister_non_existing_slot.c +++ b/tests/functional/debug/func_lpf_debug_deregister_non_existing_slot.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -34,10 +34,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid attempt to deregister a memory slot, because it has not been registered before * \return Exit code: 6 */ -TEST( func_lpf_debug_deregister_non_existing_slot ) +TEST(API, func_lpf_debug_deregister_non_existing_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ(LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_exec_null_f_symbols.c b/tests/functional/debug/func_lpf_debug_exec_null_f_symbols.cpp similarity index 84% rename from tests/functional/debug/func_lpf_debug_exec_null_f_symbols.c rename to tests/functional/debug/func_lpf_debug_exec_null_f_symbols.cpp index ac7d0ac7..80aad5b8 100644 --- a/tests/functional/debug/func_lpf_debug_exec_null_f_symbols.c +++ b/tests/functional/debug/func_lpf_debug_exec_null_f_symbols.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t a, lpf_pid_t b, lpf_pid_t c, lpf_args_t d) { @@ -30,9 +30,8 @@ void spmd( lpf_t a, lpf_pid_t b, lpf_pid_t c, lpf_args_t d) * \return Message: NULL f_symbols argument while f_size is non-zero * \return Exit code: 6 */ -TEST( func_lpf_debug_exec_null_f_symbols ) +TEST(API, func_lpf_debug_exec_null_f_symbols ) { - lpf_err_t rc = LPF_SUCCESS; lpf_args_t args; args.input = NULL; args.input_size = 0; @@ -40,7 +39,5 @@ TEST( func_lpf_debug_exec_null_f_symbols ) args.output_size = 0; args.f_symbols = NULL; args.f_size = 4; - rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ(lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ), LPF_SUCCESS); } diff --git a/tests/functional/debug/func_lpf_debug_exec_null_input.c b/tests/functional/debug/func_lpf_debug_exec_null_input.cpp similarity index 87% rename from tests/functional/debug/func_lpf_debug_exec_null_input.c rename to tests/functional/debug/func_lpf_debug_exec_null_input.cpp index fdc246f3..8b49a423 100644 --- a/tests/functional/debug/func_lpf_debug_exec_null_input.c +++ b/tests/functional/debug/func_lpf_debug_exec_null_input.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t a, lpf_pid_t b, lpf_pid_t c, lpf_args_t d) { @@ -31,7 +31,7 @@ void spmd( lpf_t a, lpf_pid_t b, lpf_pid_t c, lpf_args_t d) * \return Message: NULL input argument while input_size is non-zero * \return Exit code: 6 */ -TEST( func_lpf_debug_exec_null_input ) +TEST( API, func_lpf_debug_exec_null_input ) { lpf_err_t rc = LPF_SUCCESS; lpf_args_t args; @@ -41,7 +41,6 @@ TEST( func_lpf_debug_exec_null_input ) args.output_size = 0; args.f_symbols = NULL; args.f_size = 0; - rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ(lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ), rc); + FAIL(); } diff --git a/tests/functional/debug/func_lpf_debug_exec_null_output.c b/tests/functional/debug/func_lpf_debug_exec_null_output.cpp similarity index 87% rename from tests/functional/debug/func_lpf_debug_exec_null_output.c rename to tests/functional/debug/func_lpf_debug_exec_null_output.cpp index cdd09557..dff1181d 100644 --- a/tests/functional/debug/func_lpf_debug_exec_null_output.c +++ b/tests/functional/debug/func_lpf_debug_exec_null_output.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t a, lpf_pid_t b, lpf_pid_t c, lpf_args_t d) { @@ -31,7 +31,7 @@ void spmd( lpf_t a, lpf_pid_t b, lpf_pid_t c, lpf_args_t d) * \return Message: NULL output argument while output_size is non-zero * \return Exit code: 6 */ -TEST( func_lpf_debug_exec_null_output ) +TEST( API, func_lpf_debug_exec_null_output ) { lpf_err_t rc = LPF_SUCCESS; lpf_args_t args; @@ -41,7 +41,6 @@ TEST( func_lpf_debug_exec_null_output ) args.output_size = 10; args.f_symbols = NULL; args.f_size = 0; - rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ(lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ), rc); + FAIL(); } diff --git a/tests/functional/debug/func_lpf_debug_exec_null_spmd.c b/tests/functional/debug/func_lpf_debug_exec_null_spmd.cpp similarity index 83% rename from tests/functional/debug/func_lpf_debug_exec_null_spmd.c rename to tests/functional/debug/func_lpf_debug_exec_null_spmd.cpp index a58a868b..d8cd995f 100644 --- a/tests/functional/debug/func_lpf_debug_exec_null_spmd.c +++ b/tests/functional/debug/func_lpf_debug_exec_null_spmd.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" /** @@ -26,10 +26,9 @@ * \return Message: NULL spmd argument * \return Exit code: 6 */ -TEST( func_lpf_debug_exec_null_spmd ) +TEST( API, func_lpf_debug_exec_null_spmd ) { lpf_err_t rc = LPF_SUCCESS; - rc = lpf_exec( LPF_ROOT, LPF_MAX_P, NULL, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ(lpf_exec( LPF_ROOT, LPF_MAX_P, NULL, LPF_NO_ARGS ), rc); + FAIL(); } diff --git a/tests/functional/debug/func_lpf_debug_get_local_src_slot.c b/tests/functional/debug/func_lpf_debug_get_local_src_slot.cpp similarity index 71% rename from tests/functional/debug/func_lpf_debug_get_local_src_slot.c rename to tests/functional/debug/func_lpf_debug_get_local_src_slot.cpp index 391e84db..99b94740 100644 --- a/tests/functional/debug/func_lpf_debug_get_local_src_slot.c +++ b/tests/functional/debug/func_lpf_debug_get_local_src_slot.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); - rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ), rc); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +56,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory must be globally registered. Instead, it was registered only locally * \return Exit code: 6 */ -TEST( func_lpf_debug_get_local_src_slot ) +TEST( API, func_lpf_debug_get_local_src_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_overflow_dst_offset.c b/tests/functional/debug/func_lpf_debug_get_overflow_dst_offset.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_overflow_dst_offset.c rename to tests/functional/debug/func_lpf_debug_get_overflow_dst_offset.cpp index ff397d6e..f6062667 100644 --- a/tests/functional/debug/func_lpf_debug_get_overflow_dst_offset.c +++ b/tests/functional/debug/func_lpf_debug_get_overflow_dst_offset.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 2, -1, LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: numerical overflow while computing dst_offset * \return Exit code: 6 */ -TEST( func_lpf_debug_get_overflow_dst_offset ) +TEST( API, func_lpf_debug_get_overflow_dst_offset ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_overflow_src_offset.c b/tests/functional/debug/func_lpf_debug_get_overflow_src_offset.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_overflow_src_offset.c rename to tests/functional/debug/func_lpf_debug_get_overflow_src_offset.cpp index 01e66483..0e70005e 100644 --- a/tests/functional/debug/func_lpf_debug_get_overflow_src_offset.c +++ b/tests/functional/debug/func_lpf_debug_get_overflow_src_offset.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 2, ySlot, 0, -1, LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: numerical overflow while computing src_offset * \return Exit code: 6 */ -TEST( func_lpf_debug_get_overflow_src_offset ) +TEST( API, func_lpf_debug_get_overflow_src_offset ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_at_sync.c b/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_at_sync.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_at_sync.c rename to tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_at_sync.cpp index 5336977b..dc17a89c 100644 --- a/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_at_sync.c +++ b/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_at_sync.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,31 +27,31 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 3, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // the write error will be detected at this sync rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( 3, y ); } /** @@ -60,10 +60,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory .* is read past the end by 3 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_get_read_past_source_memory_global_known_at_sync ) +TEST( API, func_lpf_debug_get_read_past_source_memory_global_known_at_sync ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_before_sync.c b/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_before_sync.cpp similarity index 70% rename from tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_before_sync.c rename to tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_before_sync.cpp index 11244431..c5b84679 100644 --- a/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_before_sync.c +++ b/tests/functional/debug/func_lpf_debug_get_read_past_source_memory_global_known_before_sync.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 1, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + lpf_get( lpf, (pid+1)%nprocs, xSlot, 1, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory .* is read past the end by 1 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_get_read_past_source_memory_global_known_before_sync ) +TEST( API, func_lpf_debug_get_read_past_source_memory_global_known_before_sync ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_too_many_requests.c b/tests/functional/debug/func_lpf_debug_get_too_many_requests.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_too_many_requests.c rename to tests/functional/debug/func_lpf_debug_get_too_many_requests.cpp index 740fbf41..895260c9 100644 --- a/tests/functional/debug/func_lpf_debug_get_too_many_requests.c +++ b/tests/functional/debug/func_lpf_debug_get_too_many_requests.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_get( lpf, (pid+2)%nprocs, xSlot, sizeof(int), ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); + rc = lpf_get( lpf, (pid+2)%nprocs, xSlot, sizeof(int), ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ(LPF_SUCCESS, rc ); - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ(3, y[0] ); + EXPECT_EQ(4, y[1] ); } /** @@ -64,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: This is the 2-th message, while space for only 1 has been reserved * \return Exit code: 6 */ -TEST( func_lpf_debug_get_too_many_requests ) +TEST( API, func_lpf_debug_get_too_many_requests ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_too_many_requests_remote.c b/tests/functional/debug/func_lpf_debug_get_too_many_requests_remote.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_get_too_many_requests_remote.c rename to tests/functional/debug/func_lpf_debug_get_too_many_requests_remote.cpp index 4adf89b0..c197a749 100644 --- a/tests/functional/debug/func_lpf_debug_get_too_many_requests_remote.c +++ b/tests/functional/debug/func_lpf_debug_get_too_many_requests_remote.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,38 +28,38 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if (pid % 2 == 0 && pid != 0) { rc = lpf_get( lpf, 0, xSlot, 0, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } if (pid % 2 == 1) { rc = lpf_get( lpf, 0, xSlot, sizeof(int), ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( 3, y[0] ); + EXPECT_EQ( 4, y[1] ); } /** @@ -68,10 +68,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Too many messages on pid 0. Reserved was 1 while there were actually * \return Exit code: 6 */ -TEST( func_lpf_debug_get_too_many_requests_remote ) +TEST( API, func_lpf_debug_get_too_many_requests_remote ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_too_many_requests_self.c b/tests/functional/debug/func_lpf_debug_get_too_many_requests_self.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_get_too_many_requests_self.c rename to tests/functional/debug/func_lpf_debug_get_too_many_requests_self.cpp index 29718213..9a75dc77 100644 --- a/tests/functional/debug/func_lpf_debug_get_too_many_requests_self.c +++ b/tests/functional/debug/func_lpf_debug_get_too_many_requests_self.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,31 +28,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); + rc = lpf_get( lpf, 0, xSlot, 0, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); } /** @@ -62,10 +61,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Too many messages on pid 0. Reserved was 1 while there were actually 2 in total * \return Exit code: 6 */ -TEST( func_lpf_debug_get_too_many_requests_self ) +TEST( API, func_lpf_debug_get_too_many_requests_self ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_unknown_dest_slot.c b/tests/functional/debug/func_lpf_debug_get_unknown_dest_slot.cpp similarity index 76% rename from tests/functional/debug/func_lpf_debug_get_unknown_dest_slot.c rename to tests/functional/debug/func_lpf_debug_get_unknown_dest_slot.cpp index 3e0af8ed..eb543ef0 100644 --- a/tests/functional/debug/func_lpf_debug_get_unknown_dest_slot.c +++ b/tests/functional/debug/func_lpf_debug_get_unknown_dest_slot.cpp @@ -17,37 +17,33 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) args; int x = 3, y = 6; + (void) y; // this test purposefully tests for the (erroneous) not-use of y lpf_memslot_t xSlot = LPF_INVALID_MEMSLOT; lpf_memslot_t ySlot = xSlot + 2; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + FAIL(); } /** @@ -56,10 +52,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory slot does not exist * \return Exit code: 6 */ -TEST( func_lpf_debug_get_unknown_dest_slot ) +TEST( API, func_lpf_debug_get_unknown_dest_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_unknown_source_pid.c b/tests/functional/debug/func_lpf_debug_get_unknown_source_pid.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_unknown_source_pid.c rename to tests/functional/debug/func_lpf_debug_get_unknown_source_pid.cpp index f143ec2a..a356339d 100644 --- a/tests/functional/debug/func_lpf_debug_get_unknown_source_pid.c +++ b/tests/functional/debug/func_lpf_debug_get_unknown_source_pid.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,31 +28,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, 6 , xSlot, 0, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); } /** @@ -62,10 +57,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: unknown process ID 6 for data source * \return Exit code: 6 */ -TEST( func_lpf_debug_get_unknown_source_pid ) +TEST( API, func_lpf_debug_get_unknown_source_pid ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_unknown_source_slot.c b/tests/functional/debug/func_lpf_debug_get_unknown_source_slot.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_unknown_source_slot.c rename to tests/functional/debug/func_lpf_debug_get_unknown_source_slot.cpp index 92753779..b80ccc51 100644 --- a/tests/functional/debug/func_lpf_debug_get_unknown_source_slot.c +++ b/tests/functional/debug/func_lpf_debug_get_unknown_source_slot.cpp @@ -17,37 +17,33 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) args; int x = 3, y = 6; + (void) y; // this test purposefully tests for the (erroneous) not-use of y lpf_memslot_t xSlot = LPF_INVALID_MEMSLOT; lpf_memslot_t ySlot = xSlot + 2; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, ySlot, 0, xSlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + FAIL(); } /** @@ -56,10 +52,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory slot does not exist * \return Exit code: 6 */ -TEST( func_lpf_debug_get_unknown_source_slot ) +TEST( API, func_lpf_debug_get_unknown_source_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_global.c b/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_global.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_global.c rename to tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_global.cpp index f7491522..c0fbfcb7 100644 --- a/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_global.c +++ b/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_global.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,25 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 1, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + FAIL(); } /** @@ -59,10 +54,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory .* is written past the end by 1 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_get_write_past_dest_memory_global ) +TEST( API, func_lpf_debug_get_write_past_dest_memory_global ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_local.c b/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_local.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_local.c rename to tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_local.cpp index b5bab7c5..26f76f34 100644 --- a/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_local.c +++ b/tests/functional/debug/func_lpf_debug_get_write_past_dest_memory_local.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,25 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 2, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + FAIL(); } /** @@ -59,10 +54,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory .* is written past the end by 2 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_get_write_past_dest_memory_local ) +TEST( API, func_lpf_debug_get_write_past_dest_memory_local ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_global_deregister_mismatch.c b/tests/functional/debug/func_lpf_debug_global_deregister_mismatch.cpp similarity index 78% rename from tests/functional/debug/func_lpf_debug_global_deregister_mismatch.c rename to tests/functional/debug/func_lpf_debug_global_deregister_mismatch.cpp index 29b2836b..661cc266 100644 --- a/tests/functional/debug/func_lpf_debug_global_deregister_mismatch.c +++ b/tests/functional/debug/func_lpf_debug_global_deregister_mismatch.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,28 +28,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, pid == 0 ? xSlot : ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - + EXPECT_EQ( LPF_SUCCESS, rc ); + rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); } /** @@ -58,10 +58,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: global deregistration mismatches * \return Exit code: 6 */ -TEST( func_lpf_debug_global_deregister_mismatch ) +TEST( API, func_lpf_debug_global_deregister_mismatch ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_global_deregister_order_mismatch.c b/tests/functional/debug/func_lpf_debug_global_deregister_order_mismatch.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_global_deregister_order_mismatch.c rename to tests/functional/debug/func_lpf_debug_global_deregister_order_mismatch.cpp index 90e12664..ee9727de 100644 --- a/tests/functional/debug/func_lpf_debug_global_deregister_order_mismatch.c +++ b/tests/functional/debug/func_lpf_debug_global_deregister_order_mismatch.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,31 +28,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, pid == 0 ? xSlot : ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, pid == 0 ? ySlot : xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); } /** @@ -61,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: global deregistration mismatches * \return Exit code: 6 */ -TEST( func_lpf_debug_global_deregister_order_mismatch ) +TEST( API, func_lpf_debug_global_deregister_order_mismatch ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_global_deregister_unequal.c b/tests/functional/debug/func_lpf_debug_global_deregister_unequal.cpp similarity index 79% rename from tests/functional/debug/func_lpf_debug_global_deregister_unequal.c rename to tests/functional/debug/func_lpf_debug_global_deregister_unequal.cpp index 9ae4ea00..6b0433ee 100644 --- a/tests/functional/debug/func_lpf_debug_global_deregister_unequal.c +++ b/tests/functional/debug/func_lpf_debug_global_deregister_unequal.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,30 +28,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if (pid == 0) { rc = lpf_deregister( lpf, xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); } /** @@ -60,10 +60,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Number of deregistrations of global slots does not match. * \return Exit code: 6 */ -TEST( func_lpf_debug_deregister_global_unequal ) +TEST( API, func_lpf_debug_deregister_global_unequal ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_global_register_null_memreg.c b/tests/functional/debug/func_lpf_debug_global_register_null_memreg.cpp similarity index 90% rename from tests/functional/debug/func_lpf_debug_global_register_null_memreg.c rename to tests/functional/debug/func_lpf_debug_global_register_null_memreg.cpp index 25f4641a..f20f405a 100644 --- a/tests/functional/debug/func_lpf_debug_global_register_null_memreg.c +++ b/tests/functional/debug/func_lpf_debug_global_register_null_memreg.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -25,6 +25,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) int x = 0; lpf_memslot_t xSlot = LPF_INVALID_MEMSLOT; lpf_register_global( lpf, &x, sizeof(x), &xSlot ); + FAIL(); } /** @@ -33,10 +34,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid global memory registration, which would have taken the 1-th slot, while only space for 0 slots has been reserved * \return Exit code: 6 */ -TEST( func_lpf_debug_global_register_null_memreg ) +TEST( API, func_lpf_debug_global_register_null_memreg ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_hook_null_f_symbols.pthread.c b/tests/functional/debug/func_lpf_debug_hook_null_f_symbols.pthread.cpp similarity index 81% rename from tests/functional/debug/func_lpf_debug_hook_null_f_symbols.pthread.c rename to tests/functional/debug/func_lpf_debug_hook_null_f_symbols.pthread.cpp index ecaad199..51eb6a5e 100644 --- a/tests/functional/debug/func_lpf_debug_hook_null_f_symbols.pthread.c +++ b/tests/functional/debug/func_lpf_debug_hook_null_f_symbols.pthread.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -32,7 +32,7 @@ void lpf_spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) ctx; (void) pid; (void) nprocs; (void) args; } void * pthread_spmd( void * _data ) { - EXPECT_NE( "%p", _data, NULL ); + EXPECT_NE( _data, nullptr); const struct thread_local_data data = * ((struct thread_local_data*) _data); const int pts_rc = pthread_setspecific( pid_key, _data ); @@ -46,61 +46,63 @@ void * pthread_spmd( void * _data ) { lpf_init_t init; lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ( "%d", pts_rc, 0 ); + EXPECT_EQ( pts_rc, 0 ); rc = lpf_pthread_initialize( (lpf_pid_t)data.s, (lpf_pid_t)data.P, &init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_hook( init, &lpf_spmd, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_pthread_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); return NULL; } +// the below tests for return code 134 as this is what aborted programs return +// as an error code on modern systems + /** * \test Tests lpf_hook on pthread implementation with NULL f_symbols * \pre P <= 1 * \pre P >= 1 * \return Message: NULL f_symbols argument while f_size is non-zero - * \return Exit code: 6 + * \return Exit code: 134 */ -TEST( func_lpf_hook_null_f_symbols ) +TEST( API, func_lpf_hook_null_f_symbols ) { long k = 0; const long P = sysconf( _SC_NPROCESSORS_ONLN ); const int ptc_rc = pthread_key_create( &pid_key, NULL ); - EXPECT_EQ( "%d", ptc_rc, 0 ); + EXPECT_EQ( ptc_rc, 0 ); pthread_t * const threads = (pthread_t*) malloc( P * sizeof(pthread_t) ); - EXPECT_NE( "%p", threads, NULL ); + EXPECT_NE( threads, nullptr ); struct thread_local_data * const data = (struct thread_local_data*) malloc( P * sizeof(struct thread_local_data) ); - EXPECT_NE( "%p", data, NULL ); + EXPECT_NE( data, nullptr ); for( k = 0; k < P; ++k ) { data[ k ].P = P; data[ k ].s = k; const int rval = pthread_create( threads + k, NULL, &pthread_spmd, data + k ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } for( k = 0; k < P; ++k ) { const int rval = pthread_join( threads[ k ], NULL ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } const int ptd_rc = pthread_key_delete( pid_key ); - EXPECT_EQ( "%d", ptd_rc, 0 ); + EXPECT_EQ( ptd_rc, 0 ); - return 0; } diff --git a/tests/functional/debug/func_lpf_debug_hook_null_input.pthread.c b/tests/functional/debug/func_lpf_debug_hook_null_input.pthread.cpp similarity index 80% rename from tests/functional/debug/func_lpf_debug_hook_null_input.pthread.c rename to tests/functional/debug/func_lpf_debug_hook_null_input.pthread.cpp index 04c7c355..051f8542 100644 --- a/tests/functional/debug/func_lpf_debug_hook_null_input.pthread.c +++ b/tests/functional/debug/func_lpf_debug_hook_null_input.pthread.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -32,7 +32,7 @@ void lpf_spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) ctx; (void) pid; (void) nprocs; (void) args; } void * pthread_spmd( void * _data ) { - EXPECT_NE( "%p", _data, NULL ); + EXPECT_NE( _data, (void*)NULL ); const struct thread_local_data data = * ((struct thread_local_data*) _data); const int pts_rc = pthread_setspecific( pid_key, _data ); @@ -46,61 +46,62 @@ void * pthread_spmd( void * _data ) { lpf_init_t init; lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ( "%d", pts_rc, 0 ); + EXPECT_EQ( pts_rc, 0 ); rc = lpf_pthread_initialize( (lpf_pid_t)data.s, (lpf_pid_t)data.P, &init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_hook( init, &lpf_spmd, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_pthread_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); return NULL; } +// the below tests for return code 134 as this is what aborted programs return +// as an error code on modern systems + /** * \test Tests lpf_hook on pthread implementation with NULL input * \pre P <= 1 * \pre P >= 1 * \return Message: NULL input argument while input_size is non-zero - * \return Exit code: 6 + * \return Exit code: 134 */ -TEST( func_lpf_hook_null_input ) +TEST( API, func_lpf_hook_null_input ) { long k = 0; const long P = sysconf( _SC_NPROCESSORS_ONLN ); const int ptc_rc = pthread_key_create( &pid_key, NULL ); - EXPECT_EQ( "%d", ptc_rc, 0 ); + EXPECT_EQ( ptc_rc, 0 ); pthread_t * const threads = (pthread_t*) malloc( P * sizeof(pthread_t) ); - EXPECT_NE( "%p", threads, NULL ); + EXPECT_NE( threads, (pthread_t*)NULL ); struct thread_local_data * const data = (struct thread_local_data*) malloc( P * sizeof(struct thread_local_data) ); - EXPECT_NE( "%p", data, NULL ); + EXPECT_NE( data, (struct thread_local_data*)NULL ); for( k = 0; k < P; ++k ) { data[ k ].P = P; data[ k ].s = k; const int rval = pthread_create( threads + k, NULL, &pthread_spmd, data + k ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } for( k = 0; k < P; ++k ) { const int rval = pthread_join( threads[ k ], NULL ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } const int ptd_rc = pthread_key_delete( pid_key ); - EXPECT_EQ( "%d", ptd_rc, 0 ); - - return 0; + EXPECT_EQ( ptd_rc, 0 ); } diff --git a/tests/functional/debug/func_lpf_debug_hook_null_output.pthread.c b/tests/functional/debug/func_lpf_debug_hook_null_output.pthread.cpp similarity index 80% rename from tests/functional/debug/func_lpf_debug_hook_null_output.pthread.c rename to tests/functional/debug/func_lpf_debug_hook_null_output.pthread.cpp index 02268258..eec3be9a 100644 --- a/tests/functional/debug/func_lpf_debug_hook_null_output.pthread.c +++ b/tests/functional/debug/func_lpf_debug_hook_null_output.pthread.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -32,7 +32,7 @@ void lpf_spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) ctx; (void) pid; (void) nprocs; (void) args; } void * pthread_spmd( void * _data ) { - EXPECT_NE( "%p", _data, NULL ); + EXPECT_NE( _data, (void*)NULL ); const struct thread_local_data data = * ((struct thread_local_data*) _data); const int pts_rc = pthread_setspecific( pid_key, _data ); @@ -46,61 +46,62 @@ void * pthread_spmd( void * _data ) { lpf_init_t init; lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ( "%d", pts_rc, 0 ); + EXPECT_EQ( pts_rc, 0 ); rc = lpf_pthread_initialize( (lpf_pid_t)data.s, (lpf_pid_t)data.P, &init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_hook( init, &lpf_spmd, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_pthread_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); return NULL; } +// the below tests for return code 134 as this is what aborted programs return +// as an error code on modern systems + /** * \test Tests lpf_hook on pthread implementation with NULL output * \pre P <= 1 * \pre P >= 1 * \return Message: NULL output argument while output_size is non-zero - * \return Exit code: 6 + * \return Exit code: 134 */ -TEST( func_lpf_hook_null_output ) +TEST( API, func_lpf_hook_null_output ) { long k = 0; const long P = sysconf( _SC_NPROCESSORS_ONLN ); const int ptc_rc = pthread_key_create( &pid_key, NULL ); - EXPECT_EQ( "%d", ptc_rc, 0 ); + EXPECT_EQ( ptc_rc, 0 ); pthread_t * const threads = (pthread_t*) malloc( P * sizeof(pthread_t) ); - EXPECT_NE( "%p", threads, NULL ); + EXPECT_NE( threads, (pthread_t *)NULL ); struct thread_local_data * const data = (struct thread_local_data*) malloc( P * sizeof(struct thread_local_data) ); - EXPECT_NE( "%p", data, NULL ); + EXPECT_NE( data, (struct thread_local_data*)NULL ); for( k = 0; k < P; ++k ) { data[ k ].P = P; data[ k ].s = k; const int rval = pthread_create( threads + k, NULL, &pthread_spmd, data + k ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } for( k = 0; k < P; ++k ) { const int rval = pthread_join( threads[ k ], NULL ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } const int ptd_rc = pthread_key_delete( pid_key ); - EXPECT_EQ( "%d", ptd_rc, 0 ); - - return 0; + EXPECT_EQ( ptd_rc, 0 ); } diff --git a/tests/functional/debug/func_lpf_debug_hook_null_spmd.pthread.c b/tests/functional/debug/func_lpf_debug_hook_null_spmd.pthread.cpp similarity index 78% rename from tests/functional/debug/func_lpf_debug_hook_null_spmd.pthread.c rename to tests/functional/debug/func_lpf_debug_hook_null_spmd.pthread.cpp index 20209c16..00bcc0c7 100644 --- a/tests/functional/debug/func_lpf_debug_hook_null_spmd.pthread.c +++ b/tests/functional/debug/func_lpf_debug_hook_null_spmd.pthread.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -30,7 +30,7 @@ struct thread_local_data { void * pthread_spmd( void * _data ) { - EXPECT_NE( "%p", _data, NULL ); + EXPECT_NE( _data, (void*)NULL ); const struct thread_local_data data = * ((struct thread_local_data*) _data); const int pts_rc = pthread_setspecific( pid_key, _data ); @@ -44,61 +44,62 @@ void * pthread_spmd( void * _data ) { lpf_init_t init; lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ( "%d", pts_rc, 0 ); + EXPECT_EQ( pts_rc, 0 ); rc = lpf_pthread_initialize( (lpf_pid_t)data.s, (lpf_pid_t)data.P, &init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_hook( init, NULL, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_pthread_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); return NULL; } +// the below tests for return code 134 as this is what aborted programs return +// as an error code on modern systems + /** * \test Tests lpf_hook on pthread implementation with NULL spmd * \pre P <= 1 * \pre P >= 1 * \return Message: NULL spmd argument - * \return Exit code: 6 + * \return Exit code: 134 */ -TEST( func_lpf_hook_null_spmd ) +TEST( API, func_lpf_hook_null_spmd ) { long k = 0; const long P = sysconf( _SC_NPROCESSORS_ONLN ); const int ptc_rc = pthread_key_create( &pid_key, NULL ); - EXPECT_EQ( "%d", ptc_rc, 0 ); + EXPECT_EQ( ptc_rc, 0 ); pthread_t * const threads = (pthread_t*) malloc( P * sizeof(pthread_t) ); - EXPECT_NE( "%p", threads, NULL ); + EXPECT_NE( threads, (pthread_t*)NULL ); struct thread_local_data * const data = (struct thread_local_data*) malloc( P * sizeof(struct thread_local_data) ); - EXPECT_NE( "%p", data, NULL ); + EXPECT_NE( data, (struct thread_local_data *)NULL ); for( k = 0; k < P; ++k ) { data[ k ].P = P; data[ k ].s = k; const int rval = pthread_create( threads + k, NULL, &pthread_spmd, data + k ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } for( k = 0; k < P; ++k ) { const int rval = pthread_join( threads[ k ], NULL ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } const int ptd_rc = pthread_key_delete( pid_key ); - EXPECT_EQ( "%d", ptd_rc, 0 ); - - return 0; + EXPECT_EQ( ptd_rc, 0 ); } diff --git a/tests/functional/debug/func_lpf_debug_local_register_null_memreg.c b/tests/functional/debug/func_lpf_debug_local_register_null_memreg.cpp similarity index 84% rename from tests/functional/debug/func_lpf_debug_local_register_null_memreg.c rename to tests/functional/debug/func_lpf_debug_local_register_null_memreg.cpp index b4fd8ea1..74638e10 100644 --- a/tests/functional/debug/func_lpf_debug_local_register_null_memreg.c +++ b/tests/functional/debug/func_lpf_debug_local_register_null_memreg.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -33,10 +33,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid local memory registration, which would have taken the 1-th slot, while only space for 0 slots has been reserved * \return Exit code: 6 */ -TEST( func_lpf_debug_local_register_null_memreg ) +TEST( API, func_lpf_debug_local_register_null_memreg ) { - lpf_err_t rc = LPF_SUCCESS; - rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); + FAIL(); } diff --git a/tests/functional/debug/func_lpf_debug_put_after_deregister_dest_after_sync.c b/tests/functional/debug/func_lpf_debug_put_after_deregister_dest.cpp similarity index 73% rename from tests/functional/debug/func_lpf_debug_put_after_deregister_dest_after_sync.c rename to tests/functional/debug/func_lpf_debug_put_after_deregister_dest.cpp index 1374428d..d48877e9 100644 --- a/tests/functional/debug/func_lpf_debug_put_after_deregister_dest_after_sync.c +++ b/tests/functional/debug/func_lpf_debug_put_after_deregister_dest.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -64,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid attempt to deregister a memory slot, because it is in use * \return Exit code: 6 */ -TEST( func_lpf_debug_put_after_deregister_dest_after_sync ) +TEST( API, func_lpf_debug_put_after_deregister_dest ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_after_deregister_dest.c b/tests/functional/debug/func_lpf_debug_put_after_deregister_dest_after_sync.cpp similarity index 74% rename from tests/functional/debug/func_lpf_debug_put_after_deregister_dest.c rename to tests/functional/debug/func_lpf_debug_put_after_deregister_dest_after_sync.cpp index 8862f3ef..e86c3a46 100644 --- a/tests/functional/debug/func_lpf_debug_put_after_deregister_dest.c +++ b/tests/functional/debug/func_lpf_debug_put_after_deregister_dest_after_sync.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -64,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid attempt to deregister a memory slot, because it is in use * \return Exit code: 6 */ -TEST( func_lpf_debug_put_after_deregister_dest ) +TEST( API, func_lpf_debug_put_after_deregister_dest_after_sync ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_after_deregister_source.c b/tests/functional/debug/func_lpf_debug_put_after_deregister_source.cpp similarity index 74% rename from tests/functional/debug/func_lpf_debug_put_after_deregister_source.c rename to tests/functional/debug/func_lpf_debug_put_after_deregister_source.cpp index b6283b00..cf40895c 100644 --- a/tests/functional/debug/func_lpf_debug_put_after_deregister_source.c +++ b/tests/functional/debug/func_lpf_debug_put_after_deregister_source.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -64,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid attempt to deregister a memory slot, because it is in use * \return Exit code: 6 */ -TEST( func_lpf_debug_put_after_deregister_source ) +TEST( API, func_lpf_debug_put_after_deregister_source ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_after_deregister_source_after_sync.c b/tests/functional/debug/func_lpf_debug_put_after_deregister_source_after_sync.cpp similarity index 73% rename from tests/functional/debug/func_lpf_debug_put_after_deregister_source_after_sync.c rename to tests/functional/debug/func_lpf_debug_put_after_deregister_source_after_sync.cpp index bbfd5abc..ae24d981 100644 --- a/tests/functional/debug/func_lpf_debug_put_after_deregister_source_after_sync.c +++ b/tests/functional/debug/func_lpf_debug_put_after_deregister_source_after_sync.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -64,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Invalid attempt to deregister a memory slot, because it is in use * \return Exit code: 6 */ -TEST( func_lpf_debug_put_after_deregister_source_after_sync ) +TEST( API, func_lpf_debug_put_after_deregister_source_after_sync ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_get_too_many_requests.c b/tests/functional/debug/func_lpf_debug_put_get_too_many_requests.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_put_get_too_many_requests.c rename to tests/functional/debug/func_lpf_debug_put_get_too_many_requests.cpp index cba34714..317e8749 100644 --- a/tests/functional/debug/func_lpf_debug_put_get_too_many_requests.c +++ b/tests/functional/debug/func_lpf_debug_put_get_too_many_requests.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,31 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+2)%nprocs, xSlot, sizeof(int), ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + FAIL(); } /** @@ -64,10 +61,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: This is the 2-th message, while space for only 1 has been reserved * \return Exit code: 6 */ -TEST( func_lpf_debug_put_get_too_many_requests ) +TEST( API, func_lpf_debug_put_get_too_many_requests ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_get_too_many_requests_remote.c b/tests/functional/debug/func_lpf_debug_put_get_too_many_requests_remote.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_put_get_too_many_requests_remote.c rename to tests/functional/debug/func_lpf_debug_put_get_too_many_requests_remote.cpp index b8c78d74..f3bcc52d 100644 --- a/tests/functional/debug/func_lpf_debug_put_get_too_many_requests_remote.c +++ b/tests/functional/debug/func_lpf_debug_put_get_too_many_requests_remote.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,38 +28,35 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if (pid % 2 == 0) { rc = lpf_put( lpf, xSlot, 0, 0, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } if (pid % 2 == 1 ) { rc = lpf_get( lpf, 0, xSlot, sizeof(int), ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); } /** @@ -68,10 +65,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Too many messages on pid 0. Reserved was 2 while there were actually * \return Exit code: 6 */ -TEST( func_lpf_debug_put_get_too_many_requests_remote ) +TEST( API, func_lpf_debug_put_get_too_many_requests_remote ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_local_dest_slot.c b/tests/functional/debug/func_lpf_debug_put_local_dest_slot.cpp similarity index 76% rename from tests/functional/debug/func_lpf_debug_put_local_dest_slot.c rename to tests/functional/debug/func_lpf_debug_put_local_dest_slot.cpp index 4bca087f..0e25ccfa 100644 --- a/tests/functional/debug/func_lpf_debug_put_local_dest_slot.c +++ b/tests/functional/debug/func_lpf_debug_put_local_dest_slot.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +56,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory must be globally registered. Instead, it was only locally registered * \return Exit code: 6 */ -TEST( func_lpf_debug_put_local_dest_slot ) +TEST( API, func_lpf_debug_put_local_dest_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_overflow_dst_offset.c b/tests/functional/debug/func_lpf_debug_put_overflow_dst_offset.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_put_overflow_dst_offset.c rename to tests/functional/debug/func_lpf_debug_put_overflow_dst_offset.cpp index 210e8828..ec6ea4e5 100644 --- a/tests/functional/debug/func_lpf_debug_put_overflow_dst_offset.c +++ b/tests/functional/debug/func_lpf_debug_put_overflow_dst_offset.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 2, -1, LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +58,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: numerical overflow while computing dst_offset * \return Exit code: 6 */ -TEST( func_lpf_debug_put_overflow_dst_offset ) +TEST( API, func_lpf_debug_put_overflow_dst_offset ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_overflow_src_offset.c b/tests/functional/debug/func_lpf_debug_put_overflow_src_offset.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_put_overflow_src_offset.c rename to tests/functional/debug/func_lpf_debug_put_overflow_src_offset.cpp index 58c92f55..7507f417 100644 --- a/tests/functional/debug/func_lpf_debug_put_overflow_src_offset.c +++ b/tests/functional/debug/func_lpf_debug_put_overflow_src_offset.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 2, (pid+1)%nprocs, ySlot, 0, -1, LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); } /** @@ -59,10 +56,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: numerical overflow while computing src_offset * \return Exit code: 6 */ -TEST( func_lpf_debug_put_overflow_src_offset ) +TEST( API, func_lpf_debug_put_overflow_src_offset ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_global.c b/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_global.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_put_read_past_source_memory_global.c rename to tests/functional/debug/func_lpf_debug_put_read_past_source_memory_global.cpp index ecb33959..9fd15ff2 100644 --- a/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_global.c +++ b/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_global.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 1, (pid+1)%nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -59,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory .* is read past the end by 1 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_put_read_past_source_memory_global ) +TEST( API, func_lpf_debug_put_read_past_source_memory_global ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_local.c b/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_local.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_put_read_past_source_memory_local.c rename to tests/functional/debug/func_lpf_debug_put_read_past_source_memory_local.cpp index beba4d76..77a124aa 100644 --- a/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_local.c +++ b/tests/functional/debug/func_lpf_debug_put_read_past_source_memory_local.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 2, (pid+1)%nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -59,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory .* is read past the end by 2 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_put_read_past_source_memory_local ) +TEST( API, func_lpf_debug_put_read_past_source_memory_local ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_read_write_conflict.c b/tests/functional/debug/func_lpf_debug_put_read_write_conflict.cpp similarity index 74% rename from tests/functional/debug/func_lpf_debug_put_read_write_conflict.c rename to tests/functional/debug/func_lpf_debug_put_read_write_conflict.cpp index bbd979fa..d237995e 100644 --- a/tests/functional/debug/func_lpf_debug_put_read_write_conflict.c +++ b/tests/functional/debug/func_lpf_debug_put_read_write_conflict.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,36 +27,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, pid%2?&y:&x, sizeof(x), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // ySlot and xSlot are aliases of 'x' // The following put will have a read-write conflict rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_deregister( lpf, xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_deregister( lpf, ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); } /** @@ -65,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Read-write conflict detected * \return Exit code: 6 */ -TEST( func_lpf_debug_put_read_write_conflict ) +TEST( API, func_lpf_debug_put_read_write_conflict ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_read_write_conflict_among_many.c b/tests/functional/debug/func_lpf_debug_put_read_write_conflict_among_many.cpp similarity index 73% rename from tests/functional/debug/func_lpf_debug_put_read_write_conflict_among_many.c rename to tests/functional/debug/func_lpf_debug_put_read_write_conflict_among_many.cpp index 6430757d..d31498b3 100644 --- a/tests/functional/debug/func_lpf_debug_put_read_write_conflict_among_many.c +++ b/tests/functional/debug/func_lpf_debug_put_read_write_conflict_among_many.cpp @@ -17,57 +17,50 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) args; const int N = 10; - int * xs = calloc( N, sizeof(int)); - int * ys = calloc( N, sizeof(int)); + int * xs = new int[N]; + int * ys = new int[N]; lpf_memslot_t xSlot = LPF_INVALID_MEMSLOT; lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, N+2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, xs, sizeof(int)*N, &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(int)*N, &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); int i; for ( i = 0; i < N/2; ++i) { rc = lpf_put( lpf, xSlot, sizeof(int)*2*i, (pid+1)%nprocs, ySlot, sizeof(int)*i, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } // this causes a read-write conflict on elements xs[1] and xs[2] rc = lpf_get( lpf, (pid+nprocs-1)%nprocs, ySlot, sizeof(int)*(N-3), xSlot, sizeof(int)+2, sizeof(int)*3, LPF_MSG_DEFAULT ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - rc = lpf_deregister( lpf, xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_deregister( lpf, ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - free(xs); - free(ys); } /** @@ -76,10 +69,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Read-write conflict detected * \return Exit code: 6 */ -TEST( func_lpf_debug_put_read_write_conflict_among_many ) +TEST( API, func_lpf_debug_put_read_write_conflict_among_many ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } + + diff --git a/tests/functional/debug/func_lpf_debug_put_too_many_requests.c b/tests/functional/debug/func_lpf_debug_put_too_many_requests.cpp similarity index 75% rename from tests/functional/debug/func_lpf_debug_put_too_many_requests.c rename to tests/functional/debug/func_lpf_debug_put_too_many_requests.cpp index aaa5cda4..35570a89 100644 --- a/tests/functional/debug/func_lpf_debug_put_too_many_requests.c +++ b/tests/functional/debug/func_lpf_debug_put_too_many_requests.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,34 +28,29 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, sizeof(int), (pid+2)%nprocs, ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -64,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: This is the 2-th message, while space for only 1 has been reserved * \return Exit code: 6 */ -TEST( func_lpf_debug_put_too_many_requests ) +TEST( API, func_lpf_debug_put_too_many_requests ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_too_many_requests_remote.c b/tests/functional/debug/func_lpf_debug_put_too_many_requests_remote.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_put_too_many_requests_remote.c rename to tests/functional/debug/func_lpf_debug_put_too_many_requests_remote.cpp index ade556d0..d13150d6 100644 --- a/tests/functional/debug/func_lpf_debug_put_too_many_requests_remote.c +++ b/tests/functional/debug/func_lpf_debug_put_too_many_requests_remote.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,38 +28,35 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if (pid % 2 == 0 ) { rc = lpf_put( lpf, xSlot, 0, (pid+1) % 2, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } if (pid % 2 == 1) { rc = lpf_put( lpf, xSlot, sizeof(int), pid % 2, ySlot, sizeof(int), sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); } /** @@ -68,10 +65,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Too many messages on pid 1. Reserved was 1 while there were actually * \return Exit code: 6 */ -TEST( func_lpf_debug_put_too_many_requests_remote ) +TEST( API, func_lpf_debug_put_too_many_requests_remote ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_too_many_requests_self.c b/tests/functional/debug/func_lpf_debug_put_too_many_requests_self.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_put_too_many_requests_self.c rename to tests/functional/debug/func_lpf_debug_put_too_many_requests_self.cpp index 3e6690e1..c482e88c 100644 --- a/tests/functional/debug/func_lpf_debug_put_too_many_requests_self.c +++ b/tests/functional/debug/func_lpf_debug_put_too_many_requests_self.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,31 +28,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, 0, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + FAIL(); } /** @@ -62,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Too many messages on pid 0. Reserved was 1 while there were actually 2 in total * \return Exit code: 6 */ -TEST( func_lpf_debug_put_too_many_requests_self ) +TEST( API, func_lpf_debug_put_too_many_requests_self ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_unknown_dest_pid.c b/tests/functional/debug/func_lpf_debug_put_unknown_dest_pid.cpp similarity index 77% rename from tests/functional/debug/func_lpf_debug_put_unknown_dest_pid.c rename to tests/functional/debug/func_lpf_debug_put_unknown_dest_pid.cpp index 56142f4f..9c78be73 100644 --- a/tests/functional/debug/func_lpf_debug_put_unknown_dest_pid.c +++ b/tests/functional/debug/func_lpf_debug_put_unknown_dest_pid.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,31 +28,32 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, 6, ySlot, 0, sizeof(int), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + FAIL(); - EXPECT_EQ("%d", 3, y[0] ); - EXPECT_EQ("%d", 4, y[1] ); + EXPECT_EQ( 3, y[0] ); + EXPECT_EQ( 4, y[1] ); } /** @@ -62,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: unknown process ID 6 for data destination * \return Exit code: 6 */ -TEST( func_lpf_debug_put_unknown_dest_pid ) +TEST( API, func_lpf_debug_put_unknown_dest_pid ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_unknown_dest_slot.c b/tests/functional/debug/func_lpf_debug_put_unknown_dest_slot.cpp similarity index 76% rename from tests/functional/debug/func_lpf_debug_put_unknown_dest_slot.c rename to tests/functional/debug/func_lpf_debug_put_unknown_dest_slot.cpp index 153f1177..d26523c1 100644 --- a/tests/functional/debug/func_lpf_debug_put_unknown_dest_slot.c +++ b/tests/functional/debug/func_lpf_debug_put_unknown_dest_slot.cpp @@ -17,37 +17,35 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) args; int x = 3, y = 6; + (void) y; // this field is (erroneously) not used, and the test checks for + // finding precisely that error lpf_memslot_t xSlot = LPF_INVALID_MEMSLOT; lpf_memslot_t ySlot = xSlot + 2; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -56,10 +54,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory slot does not exist * \return Exit code: 6 */ -TEST( func_lpf_debug_put_unknown_dest_slot ) +TEST( API, func_lpf_debug_put_unknown_dest_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_unknown_source_slot.c b/tests/functional/debug/func_lpf_debug_put_unknown_source_slot.cpp similarity index 78% rename from tests/functional/debug/func_lpf_debug_put_unknown_source_slot.c rename to tests/functional/debug/func_lpf_debug_put_unknown_source_slot.cpp index 9b274863..deebdcbd 100644 --- a/tests/functional/debug/func_lpf_debug_put_unknown_source_slot.c +++ b/tests/functional/debug/func_lpf_debug_put_unknown_source_slot.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,27 +27,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = xSlot + 2; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, ySlot, 0, (pid+1)%nprocs, xSlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( 3, y ); } /** @@ -56,10 +56,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory slot does not exist * \return Exit code: 6 */ -TEST( func_lpf_debug_put_unknown_source_slot ) +TEST(API, func_lpf_debug_put_unknown_source_slot ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.c b/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.cpp similarity index 73% rename from tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.c rename to tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.cpp index 38771cbb..d07059a3 100644 --- a/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.c +++ b/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_at_sync.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,31 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 3, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - // the write error will be detected at this sync - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -60,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory .* is written past the end by 3 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_put_write_past_dest_memory_global_known_at_sync ) +TEST( API, func_lpf_debug_put_write_past_dest_memory_global_known_at_sync ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.c b/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.cpp similarity index 74% rename from tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.c rename to tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.cpp index e98cb529..5aad9441 100644 --- a/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.c +++ b/tests/functional/debug/func_lpf_debug_put_write_past_dest_memory_global_known_before_sync.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,30 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xSlot, 0, (pid+1)%nprocs, ySlot, 1, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -59,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory .* is written past the end by 1 bytes * \return Exit code: 6 */ -TEST( func_lpf_debug_put_write_past_dest_memory_global_known_before_sync ) +TEST( API, func_lpf_debug_put_write_past_dest_memory_global_known_before_sync ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_register_global_dst_unsynced.c b/tests/functional/debug/func_lpf_debug_register_global_dst_unsynced.cpp similarity index 76% rename from tests/functional/debug/func_lpf_debug_register_global_dst_unsynced.c rename to tests/functional/debug/func_lpf_debug_register_global_dst_unsynced.cpp index 8a4ec260..93741937 100644 --- a/tests/functional/debug/func_lpf_debug_register_global_dst_unsynced.c +++ b/tests/functional/debug/func_lpf_debug_register_global_dst_unsynced.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,27 +27,23 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &y, sizeof(x), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, ySlot, 0, (pid+1)%nprocs, xSlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -56,10 +52,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: destination memory slot was not yet active * \return Exit code: 6 */ -TEST( func_lpf_debug_put_unknown_source_slot ) +TEST( API, func_lpf_debug_register_global_dst_unsynced ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_register_global_src_unsynced.c b/tests/functional/debug/func_lpf_debug_register_global_src_unsynced.cpp similarity index 76% rename from tests/functional/debug/func_lpf_debug_register_global_src_unsynced.c rename to tests/functional/debug/func_lpf_debug_register_global_src_unsynced.cpp index 79ddcdff..796bab73 100644 --- a/tests/functional/debug/func_lpf_debug_register_global_src_unsynced.c +++ b/tests/functional/debug/func_lpf_debug_register_global_src_unsynced.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -27,27 +27,23 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &y, sizeof(x), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_get( lpf, (pid+1)%nprocs, xSlot, 0, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - - EXPECT_EQ("%d", 3, y ); + EXPECT_EQ( LPF_SUCCESS, rc ); + FAIL(); } /** @@ -56,10 +52,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: source memory slot was not yet active * \return Exit code: 6 */ -TEST( func_lpf_debug_put_unknown_source_slot ) +TEST( API, func_lpf_debug_register_global_src_unsynced ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_register_global_unequal.c b/tests/functional/debug/func_lpf_debug_register_global_unequal.cpp similarity index 81% rename from tests/functional/debug/func_lpf_debug_register_global_unequal.c rename to tests/functional/debug/func_lpf_debug_register_global_unequal.cpp index 4efeadef..d5d186c9 100644 --- a/tests/functional/debug/func_lpf_debug_register_global_unequal.c +++ b/tests/functional/debug/func_lpf_debug_register_global_unequal.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -28,24 +28,24 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; lpf_err_t rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, 1 ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &x, sizeof(x), &xSlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if (pid != 0) { rc = lpf_register_global( lpf, &y, sizeof(y), &ySlot ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -54,10 +54,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \return Message: Number of global registrations does not match. * \return Exit code: 6 */ -TEST( func_lpf_debug_register_global_unequal ) +TEST( API, func_lpf_debug_register_global_unequal ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_rehook_null_f_symbols.c b/tests/functional/debug/func_lpf_debug_rehook_null_f_symbols.cpp similarity index 89% rename from tests/functional/debug/func_lpf_debug_rehook_null_f_symbols.c rename to tests/functional/debug/func_lpf_debug_rehook_null_f_symbols.cpp index 8ee0e0cb..a958fa37 100644 --- a/tests/functional/debug/func_lpf_debug_rehook_null_f_symbols.c +++ b/tests/functional/debug/func_lpf_debug_rehook_null_f_symbols.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) { @@ -31,7 +31,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) args.f_symbols = NULL; args.f_size = 2; rc = lpf_rehook( lpf, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -40,10 +40,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) * \return Message: NULL f_symbols argument while f_size is non-zero * \return Exit code: 6 */ -TEST( func_lpf_debug_rehook_null_f_symbols ) +TEST( API, func_lpf_debug_rehook_null_f_symbols ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_rehook_null_input.c b/tests/functional/debug/func_lpf_debug_rehook_null_input.cpp similarity index 89% rename from tests/functional/debug/func_lpf_debug_rehook_null_input.c rename to tests/functional/debug/func_lpf_debug_rehook_null_input.cpp index ad265bdd..aa800029 100644 --- a/tests/functional/debug/func_lpf_debug_rehook_null_input.c +++ b/tests/functional/debug/func_lpf_debug_rehook_null_input.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) { @@ -31,7 +31,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) args.f_symbols = NULL; args.f_size = 0; rc = lpf_rehook( lpf, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -40,10 +40,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) * \return Message: NULL input argument while input_size is non-zero * \return Exit code: 6 */ -TEST( func_lpf_debug_rehook_null_input ) +TEST( API, func_lpf_debug_rehook_null_input ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_rehook_null_output.c b/tests/functional/debug/func_lpf_debug_rehook_null_output.cpp similarity index 89% rename from tests/functional/debug/func_lpf_debug_rehook_null_output.c rename to tests/functional/debug/func_lpf_debug_rehook_null_output.cpp index f809c4d6..504e0fc5 100644 --- a/tests/functional/debug/func_lpf_debug_rehook_null_output.c +++ b/tests/functional/debug/func_lpf_debug_rehook_null_output.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) { @@ -31,7 +31,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) args.f_symbols = NULL; args.f_size = 0; rc = lpf_rehook( lpf, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -40,10 +40,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) * \return Message: NULL output argument while output_size is non-zero * \return Exit code: 6 */ -TEST( func_lpf_debug_rehook_null_output ) +TEST( API, func_lpf_debug_rehook_null_output ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_rehook_null_spmd.c b/tests/functional/debug/func_lpf_debug_rehook_null_spmd.cpp similarity index 87% rename from tests/functional/debug/func_lpf_debug_rehook_null_spmd.c rename to tests/functional/debug/func_lpf_debug_rehook_null_spmd.cpp index eafc39b7..d3d00a72 100644 --- a/tests/functional/debug/func_lpf_debug_rehook_null_spmd.c +++ b/tests/functional/debug/func_lpf_debug_rehook_null_spmd.cpp @@ -17,14 +17,14 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) { (void) pid; (void) nprocs; (void) a; lpf_err_t rc = LPF_SUCCESS; rc = lpf_rehook( lpf, NULL, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -33,10 +33,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t a) * \return Message: NULL spmd argument * \return Exit code: 6 */ -TEST( func_lpf_debug_rehook_null_spmd ) +TEST( API, func_lpf_debug_rehook_null_spmd ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/debug/func_lpf_debug_resize_memory_register_with_size_max_minus_three.c b/tests/functional/debug/func_lpf_debug_resize_memory_register_with_size_max_minus_three.cpp similarity index 85% rename from tests/functional/debug/func_lpf_debug_resize_memory_register_with_size_max_minus_three.c rename to tests/functional/debug/func_lpf_debug_resize_memory_register_with_size_max_minus_three.cpp index 05c21b8f..04159041 100644 --- a/tests/functional/debug/func_lpf_debug_resize_memory_register_with_size_max_minus_three.c +++ b/tests/functional/debug/func_lpf_debug_resize_memory_register_with_size_max_minus_three.cpp @@ -17,14 +17,14 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) pid; (void) nprocs; (void) args; lpf_err_t rc = LPF_SUCCESS; rc = lpf_resize_memory_register( lpf, ((size_t) -1) - 3 ); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY , rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY , rc ); } /** @@ -32,10 +32,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_debug_resize_memory_register_with_size_max_minus_three ) +TEST( API, func_lpf_debug_resize_memory_register_with_size_max_minus_three ) { lpf_err_t rc = LPF_SUCCESS; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/exception_list b/tests/functional/exception_list deleted file mode 100644 index c7590fc1..00000000 --- a/tests/functional/exception_list +++ /dev/null @@ -1,5 +0,0 @@ -func_lpf_put_parallel_bad_pattern_.* -func_lpf_hook_tcp_mpi..._[^_]*_mvapich2 -func_lpf_hook_tcp_mpi..._[^_]*_openmpi_gcc_64_1_10_7 -func_lpf_hook_tcp_timeout_mpi..._[^_]*_openmpi_gcc_64_1_10_7 -func_lpf_hook_tcp_mpi..._[^_]*_mpich_ge_gcc_64_3_2rc2 diff --git a/tests/functional/func_bsplib_example_lpf_sum.c b/tests/functional/func_bsplib_example_lpf_sum.cpp similarity index 78% rename from tests/functional/func_bsplib_example_lpf_sum.c rename to tests/functional/func_bsplib_example_lpf_sum.cpp index 68677450..91cf356e 100644 --- a/tests/functional/func_bsplib_example_lpf_sum.c +++ b/tests/functional/func_bsplib_example_lpf_sum.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i, j; int n = 5; @@ -46,29 +46,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) result += xs[j]; rc = bsplib_push_reg(bsplib, &result, sizeof( result ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < p; ++i ) { rc = bsplib_hpget(bsplib, i, &result, 0, &local_sums[i], sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); result = 0; for ( i = 0; i < p; ++i ) result += local_sums[i]; rc = bsplib_pop_reg(bsplib, &result ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", - p * ( n - 1 ) * n / 2 + n * ( p - 1 ) * p / 2, - result ); + EXPECT_EQ( p * ( n - 1 ) * n / 2 + n * ( p - 1 ) * p / 2, result ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -76,10 +74,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_example_bsp_sum) +TEST(API, func_bsplib_example_bsp_sum) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_example_lpf_sum_unsafemode.c b/tests/functional/func_bsplib_example_lpf_sum_unsafemode.cpp similarity index 78% rename from tests/functional/func_bsplib_example_lpf_sum_unsafemode.c rename to tests/functional/func_bsplib_example_lpf_sum_unsafemode.cpp index e81c1576..8e433085 100644 --- a/tests/functional/func_bsplib_example_lpf_sum_unsafemode.c +++ b/tests/functional/func_bsplib_example_lpf_sum_unsafemode.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 2, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i, j; int n = 5; @@ -46,29 +46,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) result += xs[j]; rc = bsplib_push_reg(bsplib, &result, sizeof( result ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < p; ++i ) { rc = bsplib_hpget(bsplib, i, &result, 0, &local_sums[i], sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); result = 0; for ( i = 0; i < p; ++i ) result += local_sums[i]; rc = bsplib_pop_reg(bsplib, &result ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", - p * ( n - 1 ) * n / 2 + n * ( p - 1 ) * p / 2, + EXPECT_EQ( p * ( n - 1 ) * n / 2 + n * ( p - 1 ) * p / 2, result ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -76,10 +75,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_example_bsp_sum_unsafemode ) +TEST( API, func_bsplib_example_bsp_sum_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_example_put_array.c b/tests/functional/func_bsplib_example_put_array.cpp similarity index 78% rename from tests/functional/func_bsplib_example_put_array.c rename to tests/functional/func_bsplib_example_put_array.cpp index 3d448091..4d494156 100644 --- a/tests/functional/func_bsplib_example_put_array.c +++ b/tests/functional/func_bsplib_example_put_array.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,7 +27,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int n = 5 * bsplib_nprocs(bsplib); int i, dst_pid, dst_idx, p = bsplib_nprocs(bsplib), n_over_p = n / p; @@ -38,11 +38,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) xs[i] = n - ( i + bsplib_pid(bsplib) * n_over_p ) - 1; } - EXPECT_EQ("%d", 0, n % p ); + EXPECT_EQ( 0, n % p ); rc = bsplib_push_reg(bsplib, xs, n_over_p * sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n_over_p; ++i ) { @@ -51,21 +51,21 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = bsplib_put(bsplib, dst_pid, &xs[i], xs, dst_idx * sizeof( int ), sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, xs ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n_over_p; ++i ) { - EXPECT_EQ("%d", i + (int) bsplib_pid(bsplib) * n_over_p, xs[i] ); + EXPECT_EQ(i + (int) bsplib_pid(bsplib) * n_over_p, xs[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -73,10 +73,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_put_array) +TEST(API, func_bsplib_put_array) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_example_put_array_unsafemode.c b/tests/functional/func_bsplib_example_put_array_unsafemode.cpp similarity index 78% rename from tests/functional/func_bsplib_example_put_array_unsafemode.c rename to tests/functional/func_bsplib_example_put_array_unsafemode.cpp index e4adb988..29e45a3b 100644 --- a/tests/functional/func_bsplib_example_put_array_unsafemode.c +++ b/tests/functional/func_bsplib_example_put_array_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,7 +27,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int n = 5 * bsplib_nprocs(bsplib); int i, dst_pid, dst_idx, p = bsplib_nprocs(bsplib), n_over_p = n / p; @@ -38,11 +38,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) xs[i] = n - ( i + bsplib_pid(bsplib) * n_over_p ) - 1; } - EXPECT_EQ("%d", 0, n % p ); + EXPECT_EQ( 0, n % p ); rc = bsplib_push_reg(bsplib, xs, n_over_p * sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n_over_p; ++i ) { @@ -51,21 +51,21 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = bsplib_put(bsplib, dst_pid, &xs[i], xs, dst_idx * sizeof( int ), sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, xs ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n_over_p; ++i ) { - EXPECT_EQ("%d", i + (int) bsplib_pid(bsplib) * n_over_p, xs[i] ); + EXPECT_EQ( i + (int) bsplib_pid(bsplib) * n_over_p, xs[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -73,10 +73,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_put_array_unsafemode ) +TEST( API, func_bsplib_put_array_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_example_reverse.c b/tests/functional/func_bsplib_example_reverse.cpp similarity index 73% rename from tests/functional/func_bsplib_example_reverse.c rename to tests/functional/func_bsplib_example_reverse.cpp index d170bccf..eb155f1f 100644 --- a/tests/functional/func_bsplib_example_reverse.c +++ b/tests/functional/func_bsplib_example_reverse.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,31 +27,31 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); lpf_pid_t x = bsplib_pid(bsplib); rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, bsplib_nprocs(bsplib) - bsplib_pid(bsplib) - 1, &x, &x, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%u", bsplib_pid(bsplib), x ); + EXPECT_EQ( bsplib_pid(bsplib), x ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, &x ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%u", bsplib_nprocs(bsplib) - bsplib_pid(bsplib) - 1, x ); + EXPECT_EQ( bsplib_nprocs(bsplib) - bsplib_pid(bsplib) - 1, x ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -59,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_exampl_reverse ) +TEST(API, func_bsplib_exampl_reverse ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_example_reverse_unsafemode.c b/tests/functional/func_bsplib_example_reverse_unsafemode.cpp similarity index 73% rename from tests/functional/func_bsplib_example_reverse_unsafemode.c rename to tests/functional/func_bsplib_example_reverse_unsafemode.cpp index 09d338b8..a33d5ae1 100644 --- a/tests/functional/func_bsplib_example_reverse_unsafemode.c +++ b/tests/functional/func_bsplib_example_reverse_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,31 +27,31 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); lpf_pid_t x = bsplib_pid(bsplib); rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, bsplib_nprocs(bsplib) - bsplib_pid(bsplib) - 1, &x, &x, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%u", bsplib_pid(bsplib), x ); + EXPECT_EQ( bsplib_pid(bsplib), x ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, &x ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%u", bsplib_nprocs(bsplib) - bsplib_pid(bsplib) - 1, x ); + EXPECT_EQ( bsplib_nprocs(bsplib) - bsplib_pid(bsplib) - 1, x ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -59,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_exampl_reverse_unsafemode ) +TEST(API, func_bsplib_exampl_reverse_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_get_exceptions.c b/tests/functional/func_bsplib_get_exceptions.cpp similarity index 74% rename from tests/functional/func_bsplib_get_exceptions.c rename to tests/functional/func_bsplib_get_exceptions.cpp index 4fa597e8..89779139 100644 --- a/tests/functional/func_bsplib_get_exceptions.c +++ b/tests/functional/func_bsplib_get_exceptions.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,33 +27,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char a = 'a'; char b = 'b'; rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get( bsplib, bsplib_nprocs( bsplib ) + 1, &a, 0, &b, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_PID_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_PID_OUT_OF_RANGE, rc ); rc = bsplib_get( bsplib, -1, &a, 0, &b, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_PID_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_PID_OUT_OF_RANGE, rc ); rc = bsplib_get( bsplib, 0, &a, 1, &b, sizeof(a) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); rc = bsplib_get( bsplib, 0, &a, 0, &b, 2*sizeof(a) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -61,10 +61,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_get_exceptions ) +TEST(API, func_bsplib_get_exceptions ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_get_normal.c b/tests/functional/func_bsplib_get_normal.cpp similarity index 79% rename from tests/functional/func_bsplib_get_normal.c rename to tests/functional/func_bsplib_get_normal.cpp index 71299665..c08b3a3f 100644 --- a/tests/functional/func_bsplib_get_normal.c +++ b/tests/functional/func_bsplib_get_normal.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,7 +27,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i; int p = bsplib_nprocs(bsplib); @@ -41,9 +41,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = bsplib_push_reg(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < p; ++i ) { @@ -53,21 +53,21 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = bsplib_get(bsplib, srcPid, a, srcOffset * sizeof( a[0] ), b + i, sizeof( a[0] ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_pop_reg(bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < p; ++i ) { - EXPECT_EQ( "%d", i * i, b[i] ); + EXPECT_EQ( i * i, b[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -75,10 +75,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_get_normal) +TEST(API, func_bsplib_get_normal) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_get_normal_unsafemode.c b/tests/functional/func_bsplib_get_normal_unsafemode.cpp similarity index 79% rename from tests/functional/func_bsplib_get_normal_unsafemode.c rename to tests/functional/func_bsplib_get_normal_unsafemode.cpp index e7377df1..7a214d07 100644 --- a/tests/functional/func_bsplib_get_normal_unsafemode.c +++ b/tests/functional/func_bsplib_get_normal_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,7 +27,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i; int p = bsplib_nprocs(bsplib); @@ -41,9 +41,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = bsplib_push_reg(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < p; ++i ) { @@ -53,21 +53,21 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = bsplib_get(bsplib, srcPid, a, srcOffset * sizeof( a[0] ), b + i, sizeof( a[0] ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_pop_reg(bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < p; ++i ) { - EXPECT_EQ( "%d", i * i, b[i] ); + EXPECT_EQ( i * i, b[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -75,10 +75,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_get_normal_unsafemode ) +TEST( API, func_bsplib_get_normal_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_get_twice_on_same_remote.c b/tests/functional/func_bsplib_get_twice_on_same_remote.cpp similarity index 66% rename from tests/functional/func_bsplib_get_twice_on_same_remote.c rename to tests/functional/func_bsplib_get_twice_on_same_remote.cpp index d57efaa3..229ce1de 100644 --- a/tests/functional/func_bsplib_get_twice_on_same_remote.c +++ b/tests/functional/func_bsplib_get_twice_on_same_remote.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,7 +29,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; @@ -37,30 +37,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) char z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &y, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 0 ) rc = bsplib_get(bsplib, 1, &x, 0, &y, sizeof( x ) ); else if ( bsplib_pid(bsplib) == 1 ) rc = bsplib_get(bsplib, 0, &y, 0, &z, sizeof( y ) ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'x' : 'y', y ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 1 ? 'y' : 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'x' : 'y', y ); + EXPECT_EQ( bsplib_pid(bsplib) == 1 ? 'y' : 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // redo the previous but now the order of pid 0 and 1 reversed @@ -69,30 +69,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &y, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 1 ) rc = bsplib_get(bsplib, 0, &x, 0, &y, sizeof( x ) ); else if ( bsplib_pid(bsplib) == 0 ) rc = bsplib_get(bsplib, 1, &y, 0, &z, sizeof( y ) ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 1 ? 'x' : 'y', y ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'y' : 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( bsplib_pid(bsplib) == 1 ? 'x' : 'y', y ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'y' : 'z', z ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -100,10 +100,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_get_twice_on_same_remote ) +TEST(API, func_bsplib_get_twice_on_same_remote ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_get_twice_on_same_remote_unsafemode.c b/tests/functional/func_bsplib_get_twice_on_same_remote_unsafemode.cpp similarity index 66% rename from tests/functional/func_bsplib_get_twice_on_same_remote_unsafemode.c rename to tests/functional/func_bsplib_get_twice_on_same_remote_unsafemode.cpp index 0553d7f7..f7b1ea83 100644 --- a/tests/functional/func_bsplib_get_twice_on_same_remote_unsafemode.c +++ b/tests/functional/func_bsplib_get_twice_on_same_remote_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,7 +29,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; @@ -37,30 +37,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) char z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &y, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 0 ) rc = bsplib_get(bsplib, 1, &x, 0, &y, sizeof( x ) ); else if ( bsplib_pid(bsplib) == 1 ) rc = bsplib_get(bsplib, 0, &y, 0, &z, sizeof( y ) ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'x' : 'y', y ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 1 ? 'y' : 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'x' : 'y', y ); + EXPECT_EQ( bsplib_pid(bsplib) == 1 ? 'y' : 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // redo the previous but now the order of pid 0 and 1 reversed @@ -69,30 +69,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &y, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 1 ) rc = bsplib_get(bsplib, 0, &x, 0, &y, sizeof( x ) ); else if ( bsplib_pid(bsplib) == 0 ) rc = bsplib_get(bsplib, 1, &y, 0, &z, sizeof( y ) ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 1 ? 'x' : 'y', y ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'y' : 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( bsplib_pid(bsplib) == 1 ? 'x' : 'y', y ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'y' : 'z', z ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -100,10 +100,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_get_twice_on_same_remote_unsafemode ) +TEST( API, func_bsplib_get_twice_on_same_remote_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_getput_same_dest.c b/tests/functional/func_bsplib_getput_same_dest.cpp similarity index 69% rename from tests/functional/func_bsplib_getput_same_dest.c rename to tests/functional/func_bsplib_getput_same_dest.cpp index d4915613..d48e1054 100644 --- a/tests/functional/func_bsplib_getput_same_dest.c +++ b/tests/functional/func_bsplib_getput_same_dest.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,37 +27,37 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 2, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; char y = 'y'; char z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &z, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &x, 0, &z, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &y, &z, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'y' : 'x', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'y' : 'x', z ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -65,10 +65,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_getput_same_dest ) +TEST( API, func_bsplib_getput_same_dest ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_getput_same_dest_unsafemode.c b/tests/functional/func_bsplib_getput_same_dest_unsafemode.cpp similarity index 68% rename from tests/functional/func_bsplib_getput_same_dest_unsafemode.c rename to tests/functional/func_bsplib_getput_same_dest_unsafemode.cpp index 05a62af2..01bd5e20 100644 --- a/tests/functional/func_bsplib_getput_same_dest_unsafemode.c +++ b/tests/functional/func_bsplib_getput_same_dest_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,37 +27,37 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; char y = 'y'; char z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &z, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &x, 0, &z, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &y, &z, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'y' : 'x', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'y' : 'x', z ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -65,10 +65,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_getput_same_dest_unsafemode ) +TEST( API, func_bsplib_getput_same_dest_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_getput_same_remote.c b/tests/functional/func_bsplib_getput_same_remote.cpp similarity index 69% rename from tests/functional/func_bsplib_getput_same_remote.c rename to tests/functional/func_bsplib_getput_same_remote.cpp index 8c796925..416bc2c5 100644 --- a/tests/functional/func_bsplib_getput_same_remote.c +++ b/tests/functional/func_bsplib_getput_same_remote.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,35 +27,35 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, -1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; char y = 'y'; char z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &x, 0, &z, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &z, &x, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'z' : 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'x', z ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'z' : 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'x', z ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -63,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_getput_same_remote ) +TEST( API, func_bsplib_getput_same_remote ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_getput_same_remote_unsafemode.c b/tests/functional/func_bsplib_getput_same_remote_unsafemode.cpp similarity index 69% rename from tests/functional/func_bsplib_getput_same_remote_unsafemode.c rename to tests/functional/func_bsplib_getput_same_remote_unsafemode.cpp index fb8eb18e..8b8f9a2e 100644 --- a/tests/functional/func_bsplib_getput_same_remote_unsafemode.c +++ b/tests/functional/func_bsplib_getput_same_remote_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,35 +27,35 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; char y = 'y'; char z = 'z'; rc = bsplib_push_reg(bsplib, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &x, 0, &z, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &z, &x, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'z', z ); + EXPECT_EQ( 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'z', z ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", bsplib_pid(bsplib) == 0 ? 'z' : 'x', x ); - EXPECT_EQ( "%c", 'y', y ); - EXPECT_EQ( "%c", 'x', z ); + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 'z' : 'x', x ); + EXPECT_EQ( 'y', y ); + EXPECT_EQ( 'x', z ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -63,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_getput_same_remote_unsafemode ) +TEST( API, func_bsplib_getput_same_remote_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_getput_zero_bytes.c b/tests/functional/func_bsplib_getput_zero_bytes.cpp similarity index 72% rename from tests/functional/func_bsplib_getput_zero_bytes.c rename to tests/functional/func_bsplib_getput_zero_bytes.cpp index 4403462c..7297fd81 100644 --- a/tests/functional/func_bsplib_getput_zero_bytes.c +++ b/tests/functional/func_bsplib_getput_zero_bytes.cpp @@ -16,7 +16,8 @@ */ #include -#include "Test.h" + +#include "gtest/gtest.h" #include @@ -28,7 +29,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 3, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; char y = 'y'; @@ -40,44 +41,44 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // the following puts and gets are no-ops, despite some // other illegal arguments, because they all write zero bytes rc = bsplib_put(bsplib, 0, &y, NULL, 10, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &y, &x, -5, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &y, &y, 0, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put(bsplib, 0, &y, &x, sizeof(x)+1, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpput(bsplib, 0, &y, NULL, 10, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpput(bsplib, 0, &y, &x, -5, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpput(bsplib, 0, &y, &y, 0, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpput(bsplib, 0, &y, &x, sizeof(x)+1, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, NULL, 10, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &x, -5, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &y, 0, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_get(bsplib, 0, &x, sizeof(x)+1, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpget(bsplib, 0, NULL, 10, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpget(bsplib, 0, &x, -5, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpget(bsplib, 0, &y, 0, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_hpget(bsplib, 0, &x, sizeof(x)+1, &y, zero_bytes); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -85,10 +86,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_getput_zero_bytes ) +TEST( API, func_bsplib_getput_zero_bytes ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_hpget_many.c b/tests/functional/func_bsplib_hpget_many.cpp similarity index 75% rename from tests/functional/func_bsplib_hpget_many.c rename to tests/functional/func_bsplib_hpget_many.cpp index d46bb231..3b387bd0 100644 --- a/tests/functional/func_bsplib_hpget_many.c +++ b/tests/functional/func_bsplib_hpget_many.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,16 +29,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i, j; - const int m = 1000; + const int m = 100; const int n = m*(m+1)/2; - uint32_t * memory = malloc( 2 + n *sizeof(uint32_t) ); + uint32_t * memory = (uint32_t *) malloc( 2 + n *sizeof(uint32_t) ); uint32_t *array = memory + 2; uint32_t value[m]; rc = bsplib_push_reg(bsplib, value, sizeof(value)); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { @@ -51,7 +51,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for (i = 1, j=0; i <= m; j += i, ++i) { @@ -59,33 +59,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), value, 0, array + j, i*sizeof( uint32_t ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_pop_reg(bsplib, value ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { if ( i < 2) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } else { - EXPECT_EQ( "%u", 0x12345678u, memory[i] ); + EXPECT_EQ( 0x12345678u, memory[i] ); } } for ( i = 0; i < m; ++i ) { - EXPECT_EQ( "%u", 0x12345678u, value[i] ); + EXPECT_EQ( 0x12345678u, value[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); free(memory); } @@ -95,10 +95,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_hpget_many) +TEST(API, func_bsplib_hpget_many) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_hpput_many.c b/tests/functional/func_bsplib_hpput_many.cpp similarity index 75% rename from tests/functional/func_bsplib_hpput_many.c rename to tests/functional/func_bsplib_hpput_many.cpp index 8c92a5ec..8284178a 100644 --- a/tests/functional/func_bsplib_hpput_many.c +++ b/tests/functional/func_bsplib_hpput_many.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,15 +29,15 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 10, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i, j; - const int m = 1000; + const int m = 100; const int n = m*(m+1)/2; - uint32_t * memory = malloc( 2 + n *sizeof(uint32_t) ); + uint32_t * memory = (uint32_t *) malloc( 2 + n *sizeof(uint32_t) ); uint32_t *array = memory + 2; rc = bsplib_push_reg(bsplib, array, n*sizeof(uint32_t)); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { @@ -51,7 +51,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for (i = 1, j=0; i <= m; j += i, ++i) { @@ -59,33 +59,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), value, array, j*sizeof(uint32_t), i*sizeof( uint32_t ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_pop_reg(bsplib, array ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { if ( i < 2) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } else { - EXPECT_EQ( "%u", 0x12345678u, memory[i] ); + EXPECT_EQ( 0x12345678u, memory[i] ); } } for ( i = 0; i < m; ++i ) { - EXPECT_EQ( "%u", 0x12345678u, value[i] ); + EXPECT_EQ( 0x12345678u, value[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); free(memory); } @@ -95,10 +95,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_hpput_many) +TEST( API, func_bsplib_hpput_many) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_hpsend_many.c b/tests/functional/func_bsplib_hpsend_many.cpp similarity index 76% rename from tests/functional/func_bsplib_hpsend_many.c rename to tests/functional/func_bsplib_hpsend_many.cpp index fc1f5089..d531eea8 100644 --- a/tests/functional/func_bsplib_hpsend_many.c +++ b/tests/functional/func_bsplib_hpsend_many.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -33,24 +33,22 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const int pthread = 1, mpirma = 2, mpimsg = 3, hybrid = 4, ibverbs=5; (void) pthread; (void) mpirma; (void) mpimsg; (void) hybrid; (void) ibverbs; - LPFLIB_IGNORE_TAUTOLOGIES if (LPF_CORE_IMPL_ID == mpirma ) { maxhpregs = 10; // because MPI RMA only supports a limited number // of memory registrations } - LPFLIB_RESTORE_WARNINGS rc = bsplib_create( lpf, pid, nprocs, 1, maxhpregs, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i, j; size_t size; - const int m = 1000; + const int m = 100; const int n = m*(m+1)/2; - uint32_t * memory = malloc( 2 + n *sizeof(uint32_t) ); + uint32_t * memory = (uint32_t *) malloc( 2 + n *sizeof(uint32_t) ); uint32_t *array = memory + 2; - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { @@ -64,55 +62,55 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } size = bsplib_set_tagsize( bsplib, sizeof(j)); - EXPECT_EQ( "%zu", (size_t) 0, size); + EXPECT_EQ( (size_t) 0, size); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for (i = 1, j=0; i <= m; j += i, ++i) { rc = bsplib_hpsend(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &j, value, i*sizeof( uint32_t ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); const void * tag, *payload; for ( i = 1; i <= m; ++i) { size = bsplib_hpmove( bsplib, &tag, &payload); - EXPECT_NE("%zu", (size_t) -1, size ); + EXPECT_NE( (size_t) -1, size ); memcpy( &j, tag, sizeof(j)); double size_approx = (1 + sqrt(1 + 8*j))/2; size_t k = (size_t) (size_approx + 0.5*(1.0 - 1e-15)); - EXPECT_EQ("%zu", k*sizeof(uint32_t), size ); + EXPECT_EQ( k*sizeof(uint32_t), size ); memcpy( array + j, payload, sizeof(uint32_t)*k); } size =bsplib_hpmove( bsplib, &tag, &payload); - EXPECT_EQ( "%zu", (size_t) -1, size ); + EXPECT_EQ( (size_t) -1, size ); for ( i = 0; i < n; ++i ) { if ( i < 2) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } else { - EXPECT_EQ( "%u", 0x12345678u, memory[i] ); + EXPECT_EQ( 0x12345678u, memory[i] ); } } for ( i = 0; i < m; ++i ) { - EXPECT_EQ( "%u", 0x12345678u, value[i] ); + EXPECT_EQ( 0x12345678u, value[i] ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); free(memory); } @@ -122,10 +120,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_hpsend_many) +TEST( API, func_bsplib_hpsend_many) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_nprocs.c b/tests/functional/func_bsplib_nprocs.cpp similarity index 83% rename from tests/functional/func_bsplib_nprocs.c rename to tests/functional/func_bsplib_nprocs.cpp index 441123ee..ceca6c66 100644 --- a/tests/functional/func_bsplib_nprocs.c +++ b/tests/functional/func_bsplib_nprocs.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,13 +27,13 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 10, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); lpf_pid_t nprocs2 = bsplib_nprocs( bsplib ); - EXPECT_EQ( "%u", nprocs, nprocs2); + EXPECT_EQ( nprocs, nprocs2); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -41,10 +41,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_nprocs ) +TEST(API, func_bsplib_nprocs ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pid.c b/tests/functional/func_bsplib_pid.cpp similarity index 84% rename from tests/functional/func_bsplib_pid.c rename to tests/functional/func_bsplib_pid.cpp index c4b40958..ae9a0617 100644 --- a/tests/functional/func_bsplib_pid.c +++ b/tests/functional/func_bsplib_pid.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,13 +27,13 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); lpf_pid_t pid2 = bsplib_pid( bsplib ); - EXPECT_EQ( "%u", pid, pid2); + EXPECT_EQ( pid, pid2); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -41,10 +41,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pid ) +TEST( API, func_bsplib_pid ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_ambiguous.c b/tests/functional/func_bsplib_pushpopreg_ambiguous.cpp similarity index 77% rename from tests/functional/func_bsplib_pushpopreg_ambiguous.c rename to tests/functional/func_bsplib_pushpopreg_ambiguous.cpp index fc1c44f6..5c51bea5 100644 --- a/tests/functional/func_bsplib_pushpopreg_ambiguous.c +++ b/tests/functional/func_bsplib_pushpopreg_ambiguous.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,7 +27,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // This example is a variation of an example in @@ -35,27 +35,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) int a, b; rc = bsplib_push_reg(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 0 ) { rc = bsplib_push_reg(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } else { rc = bsplib_push_reg(bsplib, &b, sizeof( b ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_ERR_POPREG_MISMATCH, rc ); + EXPECT_EQ( BSPLIB_ERR_POPREG_MISMATCH, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -63,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_ambiguous ) +TEST( API, func_bsplib_pushpopreg_ambiguous ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_different_variables.c b/tests/functional/func_bsplib_pushpopreg_different_variables.cpp similarity index 76% rename from tests/functional/func_bsplib_pushpopreg_different_variables.c rename to tests/functional/func_bsplib_pushpopreg_different_variables.cpp index 086ceac7..684b444f 100644 --- a/tests/functional/func_bsplib_pushpopreg_different_variables.c +++ b/tests/functional/func_bsplib_pushpopreg_different_variables.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,32 +27,32 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 10, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // This example comes from the BSPlib paper (Hill et al. 1998) int a, b; rc = bsplib_push_reg(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg(bsplib, &b, sizeof( b ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 0 ) { rc = bsplib_pop_reg(bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } else { rc = bsplib_pop_reg(bsplib, &b ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_ERR_POPREG_MISMATCH, rc ); + EXPECT_EQ( BSPLIB_ERR_POPREG_MISMATCH, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -60,10 +60,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_different_variables) +TEST( API, func_bsplib_pushpopreg_different_variables) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_exceptions.c b/tests/functional/func_bsplib_pushpopreg_exceptions.cpp similarity index 73% rename from tests/functional/func_bsplib_pushpopreg_exceptions.c rename to tests/functional/func_bsplib_pushpopreg_exceptions.cpp index 16b469cb..97f63398 100644 --- a/tests/functional/func_bsplib_pushpopreg_exceptions.c +++ b/tests/functional/func_bsplib_pushpopreg_exceptions.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,38 +27,38 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, (size_t) -1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a; // Use of variable without definition rc = bsplib_put( bsplib, 0, &a, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); // Tests use of put directly after registration before sync rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put( bsplib, 0, &a, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put( bsplib, 0, &a, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // Tests detection of NULL ptr rc = bsplib_push_reg( bsplib, NULL, 1); - EXPECT_EQ( "%d", BSPLIB_ERR_NULL_POINTER, rc ); + EXPECT_EQ( BSPLIB_ERR_NULL_POINTER, rc ); // Tests deregistration of non-existent registration rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -66,10 +66,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_exception ) +TEST( API, func_bsplib_pushpopreg_exception ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_many_same.c b/tests/functional/func_bsplib_pushpopreg_many_same.cpp similarity index 79% rename from tests/functional/func_bsplib_pushpopreg_many_same.c rename to tests/functional/func_bsplib_pushpopreg_many_same.cpp index d478cd4a..5f47e5b8 100644 --- a/tests/functional/func_bsplib_pushpopreg_many_same.c +++ b/tests/functional/func_bsplib_pushpopreg_many_same.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -36,11 +36,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) while (1) { rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { rc = bsplib_push_reg( bsplib, a, i ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync( bsplib ); @@ -53,7 +53,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { // reinitialize BSPlib rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // reduce number of registers n /= 2; @@ -63,21 +63,21 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) break; } } - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_NOT_REGISTERED, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -85,10 +85,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_many_same) +TEST( API, func_bsplib_pushpopreg_many_same) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_normal.c b/tests/functional/func_bsplib_pushpopreg_normal.cpp similarity index 68% rename from tests/functional/func_bsplib_pushpopreg_normal.c rename to tests/functional/func_bsplib_pushpopreg_normal.cpp index 905b5c79..778a8a58 100644 --- a/tests/functional/func_bsplib_pushpopreg_normal.c +++ b/tests/functional/func_bsplib_pushpopreg_normal.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,41 +27,41 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a = 0; int c = -1; rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg( bsplib, &c, sizeof( c ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int b = 2; rc = bsplib_put( bsplib, 0, &b, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", 0, a ); - EXPECT_EQ( "%d", 2, b ); - EXPECT_EQ( "%d", -1, c ); + EXPECT_EQ( 0, a ); + EXPECT_EQ( 2, b ); + EXPECT_EQ( -1, c ); rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, &c ); // non-stack order! - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); - EXPECT_EQ( "%d", 2, b ); - EXPECT_EQ( "%d", -1, c ); + EXPECT_EQ( bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); + EXPECT_EQ( 2, b ); + EXPECT_EQ( -1, c ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -69,10 +69,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_normal ) +TEST( API, func_bsplib_pushpopreg_normal ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_normal_unsafemode.c b/tests/functional/func_bsplib_pushpopreg_normal_unsafemode.cpp similarity index 68% rename from tests/functional/func_bsplib_pushpopreg_normal_unsafemode.c rename to tests/functional/func_bsplib_pushpopreg_normal_unsafemode.cpp index 8ffac504..f55b6df4 100644 --- a/tests/functional/func_bsplib_pushpopreg_normal_unsafemode.c +++ b/tests/functional/func_bsplib_pushpopreg_normal_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,41 +27,41 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a = 0; int c = -1; rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg( bsplib, &c, sizeof( c ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int b = 2; rc = bsplib_put( bsplib, 0, &b, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", 0, a ); - EXPECT_EQ( "%d", 2, b ); - EXPECT_EQ( "%d", -1, c ); + EXPECT_EQ( 0, a ); + EXPECT_EQ( 2, b ); + EXPECT_EQ( -1, c ); rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, &c ); // non-stack order! - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); - EXPECT_EQ( "%d", 2, b ); - EXPECT_EQ( "%d", -1, c ); + EXPECT_EQ( bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); + EXPECT_EQ( 2, b ); + EXPECT_EQ( -1, c ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -69,10 +69,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_normal_unsafemode ) +TEST( API, func_bsplib_pushpopreg_normal_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_null.c b/tests/functional/func_bsplib_pushpopreg_null.cpp similarity index 67% rename from tests/functional/func_bsplib_pushpopreg_null.c rename to tests/functional/func_bsplib_pushpopreg_null.cpp index 51370136..4191225d 100644 --- a/tests/functional/func_bsplib_pushpopreg_null.c +++ b/tests/functional/func_bsplib_pushpopreg_null.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,38 +27,38 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // register NULL once rc = bsplib_push_reg( bsplib, NULL, 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, NULL ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // register NULL twice rc = bsplib_push_reg( bsplib, NULL, 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg( bsplib, NULL, 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, NULL ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, NULL ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // use of NULL with comm primitives @@ -67,41 +67,41 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) char *p = bsplib_pid(bsplib) == 0 ? &x : NULL; rc = bsplib_push_reg(bsplib, p, bsplib_pid(bsplib) == 0 ? 1 : 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 1 ) { rc = bsplib_put(bsplib, 0, &y, p, 0, 1 ); - EXPECT_EQ( "%d", BSPLIB_ERR_NULL_POINTER , rc ); + EXPECT_EQ( BSPLIB_ERR_NULL_POINTER , rc ); rc = bsplib_hpput(bsplib, 0, &y, p, 0, 1 ); - EXPECT_EQ( "%d", BSPLIB_ERR_NULL_POINTER , rc ); + EXPECT_EQ( BSPLIB_ERR_NULL_POINTER , rc ); rc = bsplib_get(bsplib, 0, p, 0, &y, 1 ); - EXPECT_EQ( "%d", BSPLIB_ERR_NULL_POINTER , rc ); + EXPECT_EQ( BSPLIB_ERR_NULL_POINTER , rc ); rc = bsplib_hpget(bsplib, 0, p, 0, &y, 1 ); - EXPECT_EQ( "%d", BSPLIB_ERR_NULL_POINTER , rc ); + EXPECT_EQ( BSPLIB_ERR_NULL_POINTER , rc ); } if ( bsplib_pid(bsplib) == 0 ) { - EXPECT_EQ( "%c", 'x', *p ); + EXPECT_EQ( 'x', *p ); rc = bsplib_put(bsplib, 0, &y, p, 0, 1 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid(bsplib) == 0 ) { - EXPECT_EQ( "%c", 'y', *p ); + EXPECT_EQ( 'y', *p ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -109,10 +109,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_null ) +TEST( API, func_bsplib_pushpopreg_null ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_pop_before_put.c b/tests/functional/func_bsplib_pushpopreg_pop_before_put.cpp similarity index 71% rename from tests/functional/func_bsplib_pushpopreg_pop_before_put.c rename to tests/functional/func_bsplib_pushpopreg_pop_before_put.cpp index c9733fc4..45e99624 100644 --- a/tests/functional/func_bsplib_pushpopreg_pop_before_put.c +++ b/tests/functional/func_bsplib_pushpopreg_pop_before_put.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,33 +27,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, (size_t) -1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a = 0; rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int b = 2; rc = bsplib_put( bsplib, 0, &b, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", 0, a ); - EXPECT_EQ( "%d", 2, b ); + EXPECT_EQ( 0, a ); + EXPECT_EQ( 2, b ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); - EXPECT_EQ( "%d", 2, b ); + EXPECT_EQ( bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); + EXPECT_EQ( 2, b ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -61,10 +61,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_pop_before_put ) +TEST( API, func_bsplib_pushpopreg_pop_before_put ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_pop_before_put_unsafemode.c b/tests/functional/func_bsplib_pushpopreg_pop_before_put_unsafemode.cpp similarity index 71% rename from tests/functional/func_bsplib_pushpopreg_pop_before_put_unsafemode.c rename to tests/functional/func_bsplib_pushpopreg_pop_before_put_unsafemode.cpp index 9d901e13..3a1a1a65 100644 --- a/tests/functional/func_bsplib_pushpopreg_pop_before_put_unsafemode.c +++ b/tests/functional/func_bsplib_pushpopreg_pop_before_put_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,33 +27,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 2, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a = 0; rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int b = 2; rc = bsplib_put( bsplib, 0, &b, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", 0, a ); - EXPECT_EQ( "%d", 2, b ); + EXPECT_EQ( 0, a ); + EXPECT_EQ( 2, b ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); - EXPECT_EQ( "%d", 2, b ); + EXPECT_EQ( bsplib_pid( bsplib ) == 0 ? 2 : 0, a ); + EXPECT_EQ( 2, b ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -61,10 +61,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_pop_before_put_unsafemode ) +TEST( API, func_bsplib_pushpopreg_pop_before_put_unsafemode ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_pop_on_one_process.c b/tests/functional/func_bsplib_pushpopreg_pop_on_one_process.cpp similarity index 77% rename from tests/functional/func_bsplib_pushpopreg_pop_on_one_process.c rename to tests/functional/func_bsplib_pushpopreg_pop_on_one_process.cpp index 62c121f7..68bf2599 100644 --- a/tests/functional/func_bsplib_pushpopreg_pop_on_one_process.c +++ b/tests/functional/func_bsplib_pushpopreg_pop_on_one_process.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,26 +27,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a; rc = bsplib_push_reg( bsplib, &a, sizeof(a) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if ( bsplib_pid( bsplib ) != 0 ) { rc = bsplib_pop_reg( bsplib, &a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_ERR_POPREG_MISMATCH, rc ); + EXPECT_EQ( BSPLIB_ERR_POPREG_MISMATCH, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -54,10 +54,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_pop_on_one_process ) +TEST( API, func_bsplib_pushpopreg_pop_on_one_process ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_push_on_one_process.c b/tests/functional/func_bsplib_pushpopreg_push_on_one_process.cpp similarity index 81% rename from tests/functional/func_bsplib_pushpopreg_push_on_one_process.c rename to tests/functional/func_bsplib_pushpopreg_push_on_one_process.cpp index 617c843d..cad70fda 100644 --- a/tests/functional/func_bsplib_pushpopreg_push_on_one_process.c +++ b/tests/functional/func_bsplib_pushpopreg_push_on_one_process.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,21 +27,21 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int a; if ( bsplib_pid( bsplib ) != 0 ) { rc = bsplib_push_reg( bsplib, &a, sizeof(a) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_ERR_PUSHREG_MISMATCH, rc ); + EXPECT_EQ( BSPLIB_ERR_PUSHREG_MISMATCH, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -49,10 +49,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_on_one_process ) +TEST( API, func_bsplib_pushpopreg_on_one_process ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_same_growing_memory.c b/tests/functional/func_bsplib_pushpopreg_same_growing_memory.cpp similarity index 66% rename from tests/functional/func_bsplib_pushpopreg_same_growing_memory.c rename to tests/functional/func_bsplib_pushpopreg_same_growing_memory.cpp index fc13c316..5ac4321f 100644 --- a/tests/functional/func_bsplib_pushpopreg_same_growing_memory.c +++ b/tests/functional/func_bsplib_pushpopreg_same_growing_memory.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,65 +27,65 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, (size_t) -1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // first register a bit of memory char memory[10]; memset( memory, 0, sizeof( memory ) ); rc = bsplib_push_reg( bsplib, &memory[0], 3 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; rc = bsplib_put( bsplib, ( bsplib_pid( bsplib ) + 1 ) % bsplib_nprocs( bsplib ), &x, memory, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", '\0', memory[0] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( '\0', memory[0] ); + EXPECT_EQ( 'x', x ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", 'x', memory[0] ); - EXPECT_EQ( "%d", 'x', x ); + EXPECT_EQ( 'x', memory[0] ); + EXPECT_EQ( 'x', x ); - EXPECT_EQ( "%d", '\0', memory[4] ); + EXPECT_EQ( '\0', memory[4] ); rc = bsplib_put( bsplib, ( bsplib_pid( bsplib ) + 1 ) % bsplib_nprocs( bsplib ), &x, memory, 4, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); - EXPECT_EQ( "%c", '\0', memory[4] ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( '\0', memory[4] ); // now register the memory again, but with larger extent rc = bsplib_push_reg( bsplib, &memory[0], 5 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put( bsplib, ( bsplib_pid( bsplib ) + 1 ) % bsplib_nprocs( bsplib ), &x, memory, 4, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", '\0', memory[4] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( '\0', memory[4] ); + EXPECT_EQ( 'x', x ); rc = bsplib_pop_reg( bsplib, &memory[0] ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, &memory[0] ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', memory[4] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( 'x', memory[4] ); + EXPECT_EQ( 'x', x ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -93,10 +93,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_same_growing_memory) +TEST( API, func_bsplib_pushpopreg_same_growing_memory) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_same_shrinking_memory.c b/tests/functional/func_bsplib_pushpopreg_same_shrinking_memory.cpp similarity index 66% rename from tests/functional/func_bsplib_pushpopreg_same_shrinking_memory.c rename to tests/functional/func_bsplib_pushpopreg_same_shrinking_memory.cpp index f6a0ef56..6d9fb24f 100644 --- a/tests/functional/func_bsplib_pushpopreg_same_shrinking_memory.c +++ b/tests/functional/func_bsplib_pushpopreg_same_shrinking_memory.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,45 +27,45 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 2, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // first register a bit of memory char memory[10]; memset( memory, 0, sizeof( memory ) ); rc = bsplib_push_reg(bsplib, &memory[0], 8 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char x = 'x'; rc = bsplib_put(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &x, memory, 0, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", '\0', memory[0] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( '\0', memory[0] ); + EXPECT_EQ( 'x', x ); rc = bsplib_put(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &x, memory, 4, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", '\0', memory[4] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( '\0', memory[4] ); + EXPECT_EQ( 'x', x ); rc = bsplib_sync(bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', memory[0] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( 'x', memory[0] ); + EXPECT_EQ( 'x', x ); - EXPECT_EQ( "%c", 'x', memory[4] ); - EXPECT_EQ( "%c", 'x', x ); + EXPECT_EQ( 'x', memory[4] ); + EXPECT_EQ( 'x', x ); // now register the memory again, but with smaller extent rc = bsplib_push_reg(bsplib, &memory[0], 2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib ); @@ -74,34 +74,34 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = bsplib_put(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &x, memory, 4, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); - EXPECT_EQ( "%c", 'x', memory[4] ); - EXPECT_EQ( "%c", 'a', x ); + EXPECT_EQ( 'x', memory[4] ); + EXPECT_EQ( 'a', x ); rc = bsplib_pop_reg(bsplib, &memory[0] ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // Stack order of registering the same memory! rc = bsplib_put(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &x, memory, 4, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, &memory[0] ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'x', memory[4] ); + EXPECT_EQ( 'x', memory[4] ); rc = bsplib_sync(bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%c", 'a', x ); - EXPECT_EQ( "%c", 'a', memory[4] ); + EXPECT_EQ( 'a', x ); + EXPECT_EQ( 'a', memory[4] ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -109,10 +109,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_same_shrinking_memory) +TEST( API, func_bsplib_pushpopreg_same_shrinking_memory) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_pushpopreg_two_pops_before_two_puts.c b/tests/functional/func_bsplib_pushpopreg_two_pops_before_two_puts.cpp similarity index 68% rename from tests/functional/func_bsplib_pushpopreg_two_pops_before_two_puts.c rename to tests/functional/func_bsplib_pushpopreg_two_pops_before_two_puts.cpp index 29cdea32..1df12587 100644 --- a/tests/functional/func_bsplib_pushpopreg_two_pops_before_two_puts.c +++ b/tests/functional/func_bsplib_pushpopreg_two_pops_before_two_puts.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,44 +27,44 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int c[2] = { 0, 0}; int a[2]; memset( a, 0, sizeof(a)); rc = bsplib_push_reg( bsplib, a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_push_reg( bsplib, a, sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg( bsplib, a ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int b = 2; rc = bsplib_put( bsplib, 0, &b, a, 0, sizeof( int ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_put( bsplib, 0, c, a, 0, sizeof( c) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); - EXPECT_EQ( "%d", 0, a[0] ); - EXPECT_EQ( "%d", 2, b ); + EXPECT_EQ( 0, a[0] ); + EXPECT_EQ( 2, b ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", bsplib_pid( bsplib ) == 0 ? 2 : 0, a[0] ); - EXPECT_EQ( "%d", 2, b ); + EXPECT_EQ( bsplib_pid( bsplib ) == 0 ? 2 : 0, a[0] ); + EXPECT_EQ( 2, b ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -72,10 +72,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_pushpopreg_two_pops_before_two_puts ) +TEST( API, func_bsplib_pushpopreg_two_pops_before_two_puts ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_put_exceptions.c b/tests/functional/func_bsplib_put_exceptions.cpp similarity index 76% rename from tests/functional/func_bsplib_put_exceptions.c rename to tests/functional/func_bsplib_put_exceptions.cpp index da7102c7..4d70c972 100644 --- a/tests/functional/func_bsplib_put_exceptions.c +++ b/tests/functional/func_bsplib_put_exceptions.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,26 +26,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_err_t rc = BSPLIB_SUCCESS; bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); char a = 'a'; char b = 'b'; rc = bsplib_push_reg( bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc =bsplib_put( bsplib, 0, &b, &a, 1, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); rc =bsplib_put( bsplib, 0, &b, &a, 0, sizeof( a ) * 2 ); - EXPECT_EQ( "%d", BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_MEMORY_ACCESS_OUT_OF_RANGE, rc ); rc = bsplib_put( bsplib, bsplib_nprocs( bsplib ), &b, &a, 0, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_ERR_PID_OUT_OF_RANGE, rc ); + EXPECT_EQ( BSPLIB_ERR_PID_OUT_OF_RANGE, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -53,10 +53,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_put_exceptions ) +TEST( API, func_bsplib_put_exceptions ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_put_normal.c b/tests/functional/func_bsplib_put_normal.cpp similarity index 73% rename from tests/functional/func_bsplib_put_normal.c rename to tests/functional/func_bsplib_put_normal.cpp index f5a72d3c..4f527919 100644 --- a/tests/functional/func_bsplib_put_normal.c +++ b/tests/functional/func_bsplib_put_normal.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,7 +29,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i; const int n = 10; @@ -37,19 +37,19 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) uint32_t *array = memory + 2; int length = 5; rc = bsplib_push_reg(bsplib, array, length ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); uint32_t value = 0x12345678; rc = bsplib_put(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &value, array, 0, sizeof( value ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, array ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { @@ -58,28 +58,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < n; ++i ) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } - EXPECT_EQ( "%u", 0x12345678u, value ); + EXPECT_EQ( 0x12345678u, value ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { if ( 2 != i ) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } else { - EXPECT_EQ( "%u", 0x12345678u, memory[i] ); + EXPECT_EQ( 0x12345678u, memory[i] ); } } - EXPECT_EQ( "%u", 0x12345678u, value ); + EXPECT_EQ( 0x12345678u, value ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -87,10 +87,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_put_normal) +TEST( API, func_bsplib_put_normal) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_put_normal_unsafemode.c b/tests/functional/func_bsplib_put_normal_unsafemode.cpp similarity index 73% rename from tests/functional/func_bsplib_put_normal_unsafemode.c rename to tests/functional/func_bsplib_put_normal_unsafemode.cpp index ebce8aa7..ec5150b6 100644 --- a/tests/functional/func_bsplib_put_normal_unsafemode.c +++ b/tests/functional/func_bsplib_put_normal_unsafemode.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -29,7 +29,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); int i; const int n = 10; @@ -37,19 +37,19 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) uint32_t *array = memory + 2; int length = 5; rc = bsplib_push_reg(bsplib, array, length ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); uint32_t value = 0x12345678; rc = bsplib_put(bsplib, ( bsplib_pid(bsplib) + 1 ) % bsplib_nprocs(bsplib), &value, array, 0, sizeof( value ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_pop_reg(bsplib, array ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { @@ -58,28 +58,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < n; ++i ) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } - EXPECT_EQ( "%u", 0x12345678u, value ); + EXPECT_EQ( 0x12345678u, value ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); for ( i = 0; i < n; ++i ) { if ( 2 != i ) { - EXPECT_EQ( "%u", 0xAAAAAAAAu, memory[i] ); + EXPECT_EQ( 0xAAAAAAAAu, memory[i] ); } else { - EXPECT_EQ( "%u", 0x12345678u, memory[i] ); + EXPECT_EQ( 0x12345678u, memory[i] ); } } - EXPECT_EQ( "%u", 0x12345678u, value ); + EXPECT_EQ( 0x12345678u, value ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -87,10 +87,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_put_normal_unsafemode) +TEST( API, func_bsplib_put_normal_unsafemode) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_send_empty_tag.c b/tests/functional/func_bsplib_send_empty_tag.cpp similarity index 63% rename from tests/functional/func_bsplib_send_empty_tag.c rename to tests/functional/func_bsplib_send_empty_tag.cpp index 78f64daf..68f5576a 100644 --- a/tests/functional/func_bsplib_send_empty_tag.c +++ b/tests/functional/func_bsplib_send_empty_tag.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = sizeof( int ); size_t oldTagSize = 0; @@ -37,89 +37,89 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // set tag size which go in effect next super-step oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%zu", ( size_t ) 0, oldTagSize ); + EXPECT_EQ( ( size_t ) 0, oldTagSize ); // assert that messages queue is empty rc = bsplib_get_tag(bsplib, &status, NULL ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) - 1, status ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) - 1, status ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) 0, nmsg ); - EXPECT_EQ( "%zu", ( size_t ) 0, bytes ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) 0, nmsg ); + EXPECT_EQ( ( size_t ) 0, bytes ); // send two messages const int x = 0x12345678; const int y = 0x87654321; rc = bsplib_send(bsplib, 0, &x, &y, sizeof( y ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_send(bsplib, 0, &x, &y, 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // message queue is still empty, of course rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) 0, nmsg ); - EXPECT_EQ( "%zu", ( size_t ) 0, bytes ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) 0, nmsg ); + EXPECT_EQ( ( size_t ) 0, bytes ); // Barrier synchronization rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0 ), + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0 ), nmsg ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) * sizeof( y ) : 0 ), bytes ); int z = 0; size_t nMessages = 0; while ( rc = bsplib_get_tag(bsplib, &status, &z ), status != (size_t) -1 ) { - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", 0, z ); - EXPECT_NE( "%zu", ( size_t ) -1, status ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( 0, z ); + EXPECT_NE( ( size_t ) -1, status ); // before the move qsize should return size_t msgs2 = -1; size_t bytes2 = -1; rc = bsplib_qsize(bsplib, &msgs2, &bytes2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", bytes, bytes2 ); - EXPECT_EQ( "%zu", msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( bytes, bytes2 ); + EXPECT_EQ( msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); // dequeue the message int a = -1; rc = bsplib_move(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); ++nMessages; // after the move the values returned by qsize decrease bytes -= status; rc = bsplib_qsize(bsplib, &msgs2, &bytes2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", bytes, bytes2 ); - EXPECT_EQ( "%zu", msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( bytes, bytes2 ); + EXPECT_EQ( msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); if ( status == sizeof( y ) ) { - EXPECT_EQ( "%d", y, a ); + EXPECT_EQ( y, a ); } else { - EXPECT_EQ( "%zu", ( size_t ) 0, status ); - EXPECT_EQ( "%d", -1, a ); + EXPECT_EQ( ( size_t ) 0, status ); + EXPECT_EQ( -1, a ); } } - EXPECT_EQ( "%u", + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0, (lpf_pid_t) nMessages ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -127,10 +127,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_send_empty_tag ) +TEST( API, func_bsplib_send_empty_tag ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_send_non_empty_tag.c b/tests/functional/func_bsplib_send_non_empty_tag.cpp similarity index 61% rename from tests/functional/func_bsplib_send_non_empty_tag.c rename to tests/functional/func_bsplib_send_non_empty_tag.cpp index a003d2c8..c8910d15 100644 --- a/tests/functional/func_bsplib_send_non_empty_tag.c +++ b/tests/functional/func_bsplib_send_non_empty_tag.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = sizeof( int ); size_t oldTagSize = -1; @@ -37,92 +37,91 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // set tag size which go in effect next super-step oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%zu", ( size_t ) 0, oldTagSize ); + EXPECT_EQ( ( size_t ) 0, oldTagSize ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // assert that messages queue is empty rc = bsplib_get_tag(bsplib, &status, NULL ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) - 1, status ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) - 1, status ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) 0, nmsg ); - EXPECT_EQ( "%zu", ( size_t ) 0, bytes ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) 0, nmsg ); + EXPECT_EQ( ( size_t ) 0, bytes ); // send two messages const int x = 0x12345678; const int y = 0x87654321; rc = bsplib_send(bsplib, 0, &x, &y, sizeof( y ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_send(bsplib, 0, &x, &y, 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); // message queue is still empty, of course rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) 0, nmsg ); - EXPECT_EQ( "%zu", ( size_t ) 0, bytes ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) 0, nmsg ); + EXPECT_EQ( ( size_t ) 0, bytes ); // Barrier synchronization rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0 ), + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0 ), nmsg ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) * sizeof( y ) : 0 ), bytes ); int z = 0; size_t nMessages = 0; while ( rc = bsplib_get_tag(bsplib, &status, &z ), status != (size_t) -1 ) { - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", x, z ); - EXPECT_NE( "%zu", ( size_t ) -1, status ); + EXPECT_EQ( x, z ); + EXPECT_NE( ( size_t ) -1, status ); // before the move qsize should return size_t msgs2 = -1; size_t bytes2 = -1; rc = bsplib_qsize(bsplib, &msgs2, &bytes2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", bytes, bytes2 ); - EXPECT_EQ( "%zu", msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( bytes, bytes2 ); + EXPECT_EQ( msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); // dequeue the message int a = -1; rc = bsplib_move(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); ++nMessages; // after the move the values returned by qsize decrease bytes -= status; rc = bsplib_qsize(bsplib, &msgs2, &bytes2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", bytes, bytes2 ); - EXPECT_EQ( "%zu", msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( bytes, bytes2 ); + EXPECT_EQ( msgs2, 2 * bsplib_nprocs(bsplib) - nMessages ); if ( status == sizeof( y ) ) { - EXPECT_EQ( "%d", y, a ); + EXPECT_EQ( y, a ); } else { - EXPECT_EQ( "%zu", ( size_t ) 0, status ); - EXPECT_EQ( "%d", -1, a ); + EXPECT_EQ( ( size_t ) 0, status ); + EXPECT_EQ( -1, a ); } } - EXPECT_EQ( "%u", - bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0, + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? 2 * bsplib_nprocs(bsplib) : 0, (unsigned) nMessages ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -130,10 +129,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_send_non_empty_tag ) +TEST( API, func_bsplib_send_non_empty_tag ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_send_none.c b/tests/functional/func_bsplib_send_none.cpp similarity index 77% rename from tests/functional/func_bsplib_send_none.c rename to tests/functional/func_bsplib_send_none.cpp index 14314afe..3bbd2e7f 100644 --- a/tests/functional/func_bsplib_send_none.c +++ b/tests/functional/func_bsplib_send_none.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = sizeof( int ); size_t nmsg = -1, bytes = -1; @@ -36,18 +36,18 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // set tag size which go in effect next super-step oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%zu", ( size_t ) 0, oldTagSize ); + EXPECT_EQ( ( size_t ) 0, oldTagSize ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", (size_t) 0, nmsg ); - EXPECT_EQ( "%zu", ( size_t ) 0 , bytes ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( (size_t) 0, nmsg ); + EXPECT_EQ( ( size_t ) 0 , bytes ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -55,10 +55,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_send_none) +TEST( API, func_bsplib_send_none) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_send_null.c b/tests/functional/func_bsplib_send_null.cpp similarity index 62% rename from tests/functional/func_bsplib_send_null.c rename to tests/functional/func_bsplib_send_null.cpp index 30bfbda7..19146577 100644 --- a/tests/functional/func_bsplib_send_null.c +++ b/tests/functional/func_bsplib_send_null.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = sizeof( int ); size_t nmsg = -1, bytes = -1; @@ -37,96 +37,96 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // set tag size which go in effect next super-step oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%zu", ( size_t ) 0, oldTagSize ); + EXPECT_EQ( ( size_t ) 0, oldTagSize ); const int x = 0x12345678; //const int y = 0x87654321; const int z = 0x12344321; rc = bsplib_send(bsplib, 0, NULL, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_send(bsplib, 1, &z, NULL, 0 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0 ), + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0 ), nmsg ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) * sizeof( x ) : 0 ), bytes ); int tag = -1; size_t nMessages = 0; while ( rc = bsplib_get_tag(bsplib, &status, &tag ), status != (size_t) -1 ) { - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", -1, tag ); - EXPECT_NE( "%zu", ( size_t ) -1, status ); + EXPECT_EQ( -1, tag ); + EXPECT_NE( ( size_t ) -1, status ); int a = -1; rc = bsplib_move(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); ++nMessages; // after the move the values returned by qsize decrease bytes -= status; size_t msgs2 = -1, bytes2 = -1; rc = bsplib_qsize(bsplib, &msgs2, &bytes2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", bytes, bytes2 ); - EXPECT_EQ( "%zu", msgs2, bsplib_nprocs(bsplib) - nMessages ); - EXPECT_EQ( "%zu", ( size_t ) sizeof( x ), status ); - EXPECT_EQ( "%d", x, a ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( bytes, bytes2 ); + EXPECT_EQ( msgs2, bsplib_nprocs(bsplib) - nMessages ); + EXPECT_EQ( ( size_t ) sizeof( x ), status ); + EXPECT_EQ( x, a ); } - EXPECT_EQ( "%u", + EXPECT_EQ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0, (unsigned) nMessages ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == 1 ? bsplib_nprocs(bsplib) : 0 ), + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 1 ? bsplib_nprocs(bsplib) : 0 ), nmsg ); - EXPECT_EQ( "%zu", ( size_t ) 0, bytes ); + EXPECT_EQ( ( size_t ) 0, bytes ); tag = -1; nMessages = 0; while ( rc = bsplib_get_tag(bsplib, &status, &tag ), status != (size_t) -1 ) { - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%d", z, tag ); - EXPECT_NE( "%zu", ( size_t ) -1, status ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( z, tag ); + EXPECT_NE( ( size_t ) -1, status ); int a = -1; rc = bsplib_move(bsplib, &a, sizeof( a ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); ++nMessages; // after the move the values returned by qsize decrease bytes -= status; size_t msgs2 = -1, bytes2 = -1; rc = bsplib_qsize(bsplib, &msgs2, &bytes2 ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", bytes, bytes2 ); - EXPECT_EQ( "%zu", msgs2, bsplib_nprocs(bsplib) - nMessages ); - EXPECT_EQ( "%zu", ( size_t ) 0, status ); - EXPECT_EQ( "%d", -1, a ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( bytes, bytes2 ); + EXPECT_EQ( msgs2, bsplib_nprocs(bsplib) - nMessages ); + EXPECT_EQ( ( size_t ) 0, status ); + EXPECT_EQ( -1, a ); } - EXPECT_EQ( "%u", + EXPECT_EQ( bsplib_pid(bsplib) == 1 ? bsplib_nprocs(bsplib) : 0, (unsigned) nMessages ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -134,10 +134,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_send_null ) +TEST( API, func_bsplib_send_null ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_send_one.c b/tests/functional/func_bsplib_send_one.cpp similarity index 76% rename from tests/functional/func_bsplib_send_one.c rename to tests/functional/func_bsplib_send_one.cpp index 43dee2fe..4de9ca40 100644 --- a/tests/functional/func_bsplib_send_one.c +++ b/tests/functional/func_bsplib_send_one.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = sizeof( int ); size_t nmsg = -1, bytes = -1; @@ -36,26 +36,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // set tag size which go in effect next super-step oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%zu", ( size_t ) 0, oldTagSize ); + EXPECT_EQ( ( size_t ) 0, oldTagSize ); const int x = 0x12345678; //const int y = 0x87654321; rc = bsplib_send(bsplib, 0, NULL, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0 ), + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0 ), nmsg ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) * sizeof( x ) : 0 ), bytes ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -63,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_send_one) +TEST( API, func_bsplib_send_one) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_send_one_unsafemode.c b/tests/functional/func_bsplib_send_one_unsafemode.cpp similarity index 75% rename from tests/functional/func_bsplib_send_one_unsafemode.c rename to tests/functional/func_bsplib_send_one_unsafemode.cpp index 61b35ac0..985064bf 100644 --- a/tests/functional/func_bsplib_send_one_unsafemode.c +++ b/tests/functional/func_bsplib_send_one_unsafemode.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,7 +28,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 0, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = sizeof( int ); size_t nmsg = -1, bytes = -1; @@ -36,26 +36,26 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // set tag size which go in effect next super-step oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%zu", ( size_t ) 0, oldTagSize ); + EXPECT_EQ( ( size_t ) 0, oldTagSize ); const int x = 0x12345678; //const int y = 0x87654321; rc = bsplib_send(bsplib, 0, NULL, &x, sizeof( x ) ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); rc = bsplib_qsize(bsplib, &nmsg, &bytes ); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0 ), + EXPECT_EQ( BSPLIB_SUCCESS, rc ); + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) : 0 ), nmsg ); - EXPECT_EQ( "%zu", ( size_t ) ( bsplib_pid(bsplib) == + EXPECT_EQ( ( size_t ) ( bsplib_pid(bsplib) == 0 ? bsplib_nprocs(bsplib) * sizeof( x ) : 0 ), bytes ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -63,10 +63,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_send_one_unsafemode) +TEST( API, func_bsplib_send_one_unsafemode) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_set_different_tag_size.c b/tests/functional/func_bsplib_set_different_tag_size.cpp similarity index 83% rename from tests/functional/func_bsplib_set_different_tag_size.c rename to tests/functional/func_bsplib_set_different_tag_size.cpp index 82cc9773..4741fbbf 100644 --- a/tests/functional/func_bsplib_set_different_tag_size.c +++ b/tests/functional/func_bsplib_set_different_tag_size.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,15 +28,15 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 0, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = bsplib_pid( bsplib ); bsplib_set_tagsize( bsplib, tagSize ); rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_ERR_TAGSIZE_MISMATCH, rc ); + EXPECT_EQ( BSPLIB_ERR_TAGSIZE_MISMATCH, rc ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -44,10 +44,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_set_different_tag_size ) +TEST( API, func_bsplib_set_different_tag_size ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_set_tag_size.c b/tests/functional/func_bsplib_set_tag_size.cpp similarity index 78% rename from tests/functional/func_bsplib_set_tag_size.c rename to tests/functional/func_bsplib_set_tag_size.cpp index e64957b8..0d154404 100644 --- a/tests/functional/func_bsplib_set_tag_size.c +++ b/tests/functional/func_bsplib_set_tag_size.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -28,30 +28,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, (size_t) -1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); size_t tagSize = 10, oldTagSize = -1; oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); // test for the default tag size; - EXPECT_EQ( "%lu", (size_t) 0, oldTagSize ); + EXPECT_EQ( (size_t) 0, oldTagSize ); // go back to the normal tag size oldTagSize = bsplib_set_tagsize(bsplib, 0 ); - EXPECT_EQ( "%lu", (size_t) 0, oldTagSize ); + EXPECT_EQ( (size_t) 0, oldTagSize ); tagSize = sizeof( int ); oldTagSize = bsplib_set_tagsize(bsplib, tagSize ); - EXPECT_EQ( "%lu", (size_t) 0, oldTagSize ); + EXPECT_EQ( (size_t) 0, oldTagSize ); rc = bsplib_sync(bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); oldTagSize = bsplib_set_tagsize(bsplib, 0 ); - EXPECT_EQ( "%lu", sizeof( int ), oldTagSize ); + EXPECT_EQ( sizeof( int ), oldTagSize ); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -59,10 +59,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_set_tag_size ) +TEST(API, func_bsplib_set_tag_size ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_sync_except_p0.c b/tests/functional/func_bsplib_sync_except_p0.cpp similarity index 83% rename from tests/functional/func_bsplib_sync_except_p0.c rename to tests/functional/func_bsplib_sync_except_p0.cpp index 2109d141..ac3da1c2 100644 --- a/tests/functional/func_bsplib_sync_except_p0.c +++ b/tests/functional/func_bsplib_sync_except_p0.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,15 +27,15 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 3, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if (pid!=0) { rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_ERR_FATAL, rc ); + EXPECT_EQ( BSPLIB_ERR_FATAL, rc ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_ERR_FATAL, rc ); + EXPECT_EQ( BSPLIB_ERR_FATAL, rc ); } /** @@ -43,10 +43,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_sync_except_p0 ) +TEST(API, func_bsplib_sync_except_p0 ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_bsplib_sync_only_p0.c b/tests/functional/func_bsplib_sync_only_p0.cpp similarity index 83% rename from tests/functional/func_bsplib_sync_only_p0.c rename to tests/functional/func_bsplib_sync_only_p0.cpp index a66e3aa4..5b3416b5 100644 --- a/tests/functional/func_bsplib_sync_only_p0.c +++ b/tests/functional/func_bsplib_sync_only_p0.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,15 +27,15 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, (size_t) -1, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); if (pid==0) { rc = bsplib_sync( bsplib ); - EXPECT_EQ( "%d", BSPLIB_ERR_FATAL, rc ); + EXPECT_EQ( BSPLIB_ERR_FATAL, rc ); } rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_ERR_FATAL, rc ); + EXPECT_EQ( BSPLIB_ERR_FATAL, rc ); } /** @@ -43,10 +43,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_bsplib_sync_only_p0 ) +TEST( API, func_bsplib_sync_only_p0 ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS , rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS , rc ); } diff --git a/tests/functional/func_bsplib_time.c b/tests/functional/func_bsplib_time.cpp similarity index 83% rename from tests/functional/func_bsplib_time.c rename to tests/functional/func_bsplib_time.cpp index fa650d87..fa570db6 100644 --- a/tests/functional/func_bsplib_time.c +++ b/tests/functional/func_bsplib_time.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,15 +27,15 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) bsplib_t bsplib; rc = bsplib_create( lpf, pid, nprocs, 1, 3, &bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); double t0 = bsplib_time( bsplib ); - EXPECT_LT( "%f", 0.0, t0); + EXPECT_LT( 0.0, t0); double t1 = bsplib_time( bsplib ); - EXPECT_LT( "%f", t0, t1); + EXPECT_LT( t0, t1); rc = bsplib_destroy( bsplib); - EXPECT_EQ( "%d", BSPLIB_SUCCESS, rc ); + EXPECT_EQ( BSPLIB_SUCCESS, rc ); } /** @@ -43,10 +43,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_bsplib_time ) +TEST( API, func_bsplib_time ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_deregister_parallel_multiple.c b/tests/functional/func_lpf_deregister_parallel_multiple.cpp similarity index 78% rename from tests/functional/func_lpf_deregister_parallel_multiple.c rename to tests/functional/func_lpf_deregister_parallel_multiple.cpp index c38b75c1..922f5ade 100644 --- a/tests/functional/func_lpf_deregister_parallel_multiple.c +++ b/tests/functional/func_lpf_deregister_parallel_multiple.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,11 +26,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 8 , maxRegs = 4; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); char buffer[8] = "abcd"; lpf_memslot_t slots[4]; @@ -44,28 +44,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < maxRegs; ++i) { rc = lpf_register_global( lpf, &buffer[i*2], sizeof(buffer[0])*2, &slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - EXPECT_STREQ( 4, "abcd", buffer ); + EXPECT_EQ( LPF_SUCCESS, rc ); + EXPECT_STREQ( "abcd", buffer ); for (i = 0; i < maxRegs; ++i) { rc = lpf_put( lpf, slots[i], 0u, (pid+i)%nprocs, slots[i], 1u, sizeof(buffer[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - EXPECT_STREQ( 4, "aacc", buffer ); + EXPECT_EQ( LPF_SUCCESS, rc ); + EXPECT_STREQ( "aacc", buffer ); for ( i = 0 ; i < maxRegs; ++i) { rc = lpf_deregister( lpf, slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } // reset to previous state @@ -80,10 +80,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_deregister_parallel_multiple ) +TEST( API, func_lpf_deregister_parallel_multiple ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_deregister_parallel_single.c b/tests/functional/func_lpf_deregister_parallel_single.cpp similarity index 76% rename from tests/functional/func_lpf_deregister_parallel_single.c rename to tests/functional/func_lpf_deregister_parallel_single.cpp index 80a0addc..6475a17f 100644 --- a/tests/functional/func_lpf_deregister_parallel_single.c +++ b/tests/functional/func_lpf_deregister_parallel_single.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,11 +26,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 4 , maxRegs = 4; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); int x = 1, y = 2, z = 3; lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; @@ -38,27 +38,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) lpf_memslot_t zslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, &x, sizeof(x), &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &y, sizeof(y), &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &z, sizeof(z), &zslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( (pid | 0x1) < nprocs ) { rc = lpf_put( lpf, yslot, 0, pid ^ 0x1, zslot, 0, sizeof(y), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", (pid|0x1) < nprocs ? 2 : 3, z ); + EXPECT_EQ( (pid|0x1) < nprocs ? 2 : 3, z ); lpf_deregister( lpf, yslot ); lpf_deregister( lpf, zslot ); @@ -69,9 +69,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_deregister_parallel_single ) +TEST( API, func_lpf_deregister_parallel_single ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_exec_multiple_call_single_arg_dual_proc.c b/tests/functional/func_lpf_exec_multiple_call_single_arg_dual_proc.cpp similarity index 60% rename from tests/functional/func_lpf_exec_multiple_call_single_arg_dual_proc.c rename to tests/functional/func_lpf_exec_multiple_call_single_arg_dual_proc.cpp index 569eed93..f584fd9a 100644 --- a/tests/functional/func_lpf_exec_multiple_call_single_arg_dual_proc.c +++ b/tests/functional/func_lpf_exec_multiple_call_single_arg_dual_proc.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void function_1(void) {} void function_2(int a, long b, double c, float d) @@ -28,50 +28,50 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_EQ( "%d", nprocs, 2 ); + EXPECT_EQ( nprocs, 2 ); if (0 == pid) { - EXPECT_EQ( "%zd", sizeof(int), args.input_size ); - EXPECT_EQ( "%zd", sizeof(int), args.output_size ); + EXPECT_EQ( sizeof(int), args.input_size ); + EXPECT_EQ( sizeof(int), args.output_size ); int n = (* (int *) args.input); - EXPECT_EQ( "%d", 4, n ); + EXPECT_EQ( 4, n ); * (int * ) args.output = 1 ; } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } - EXPECT_EQ( "%zd", (size_t) 1 , args.f_size ); - EXPECT_EQ( "%p", (lpf_func_t) function_1, args.f_symbols[0] ); //note: function pointers cannot be formatted in ANSI C + EXPECT_EQ( (size_t) 1 , args.f_size ); + EXPECT_EQ( (lpf_func_t) function_1, args.f_symbols[0] ); //note: function pointers cannot be formatted in ANSI C } void spmd2( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_EQ( "%d", nprocs, 2 ); + EXPECT_EQ( nprocs, 2 ); if (0 == pid) { - EXPECT_EQ( "%zd", sizeof(int), args.input_size ); - EXPECT_EQ( "%zd", sizeof(int), args.output_size ); + EXPECT_EQ( sizeof(int), args.input_size ); + EXPECT_EQ( sizeof(int), args.output_size ); int n = (* (int *) args.input) ; - EXPECT_EQ( "%d", 3, n ); + EXPECT_EQ( 3, n ); * (int * ) args.output = 2; } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } - EXPECT_EQ( "%zd", (size_t) 1 , args.f_size ); - EXPECT_EQ( "%p", (lpf_func_t) function_2, args.f_symbols[0] ); //note: function pointers cannot be formatted in ANSI C + EXPECT_EQ( (size_t) 1 , args.f_size ); + EXPECT_EQ( (lpf_func_t) function_2, args.f_symbols[0] ); //note: function pointers cannot be formatted in ANSI C } @@ -82,7 +82,7 @@ void spmd2( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_exec_multiple_call_single_arg_dual_proc ) +TEST( API, func_lpf_exec_multiple_call_single_arg_dual_proc ) { int input[2] = { 4, 3}; int output[2] = { -1, -1 }; @@ -97,7 +97,7 @@ TEST( func_lpf_exec_multiple_call_single_arg_dual_proc ) args.f_size = 1; rc = lpf_exec( LPF_ROOT, 2, &spmd1, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); args.input = &input[1]; args.input_size = sizeof(int); @@ -107,15 +107,14 @@ TEST( func_lpf_exec_multiple_call_single_arg_dual_proc ) args.f_size = 1; rc = lpf_exec( LPF_ROOT, 2, &spmd2, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); int i; for (i = 0; i < 2; ++i) { int m = input[i]; - EXPECT_EQ( "%d", 4-i, m ); + EXPECT_EQ( 4-i, m ); int n = output[i]; - EXPECT_EQ( "%d", i+1, n ); + EXPECT_EQ( i+1, n ); } - return 0; } diff --git a/tests/functional/func_lpf_exec_nested_call_single_arg_dual_proc.c b/tests/functional/func_lpf_exec_nested_call_single_arg_dual_proc.cpp similarity index 58% rename from tests/functional/func_lpf_exec_nested_call_single_arg_dual_proc.c rename to tests/functional/func_lpf_exec_nested_call_single_arg_dual_proc.cpp index ac74b5fb..a0fc8db5 100644 --- a/tests/functional/func_lpf_exec_nested_call_single_arg_dual_proc.c +++ b/tests/functional/func_lpf_exec_nested_call_single_arg_dual_proc.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void function_1() {} void function_2() {} @@ -27,61 +27,61 @@ void spmd2( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_LE( "%d", nprocs, 2); + EXPECT_LE( nprocs, 2); if ( 0 == pid ) { - EXPECT_EQ( "%zd", sizeof(int), args.input_size ); - EXPECT_EQ( "%zd", sizeof(int), args.output_size ); + EXPECT_EQ( sizeof(int), args.input_size ); + EXPECT_EQ( sizeof(int), args.output_size ); int n = * (int * ) args.input; - EXPECT_LE( "%d", 10, n ); - EXPECT_LT( "%d", n, 10 + 2); + EXPECT_LE( 10, n ); + EXPECT_LT( n, 10 + 2); * (int * ) args.output = 9; } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ((void *) NULL, args.input ); + EXPECT_EQ((void *) NULL, args.output ); } - EXPECT_EQ( "%zd", (size_t) 2, args.f_size ); - EXPECT_EQ( "%p", &function_2, args.f_symbols[0] ); - EXPECT_EQ( "%p", &function_3, args.f_symbols[1] ); + EXPECT_EQ( (size_t) 2, args.f_size ); + EXPECT_EQ( &function_2, args.f_symbols[0] ); + EXPECT_EQ( &function_3, args.f_symbols[1] ); } void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { - EXPECT_LE( "%d", nprocs, 2); + EXPECT_LE( nprocs, 2); if ( 0 == pid ) { - EXPECT_EQ( "%zd", sizeof(int), args.input_size ); - EXPECT_EQ( "%zd", sizeof(int), args.output_size ); + EXPECT_EQ( sizeof(int), args.input_size ); + EXPECT_EQ( sizeof(int), args.output_size ); int n = * (int * ) args.input; - EXPECT_EQ( "%d", 3, n ); - EXPECT_EQ( "%d", -1, * (int *) args.output); + EXPECT_EQ( 3, n ); + EXPECT_EQ( -1, * (int *) args.output); * (int * ) args.output = 7; } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } - EXPECT_EQ( "%zd", (size_t) 3, args.f_size ); - EXPECT_EQ( "%p", &function_1, args.f_symbols[0] ); - EXPECT_EQ( "%p", &function_2, args.f_symbols[1] ); - EXPECT_EQ( "%p", &function_3, args.f_symbols[2] ); + EXPECT_EQ( (size_t) 3, args.f_size ); + EXPECT_EQ( &function_1, args.f_symbols[0] ); + EXPECT_EQ( &function_2, args.f_symbols[1] ); + EXPECT_EQ( &function_3, args.f_symbols[2] ); int x = 10 + pid; lpf_args_t newArgs; @@ -94,9 +94,9 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) newArgs.f_size = args.f_size - 1; lpf_err_t rc = lpf_exec( lpf, 2, &spmd2, newArgs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", 9, number ); + EXPECT_EQ( 9, number ); } @@ -106,7 +106,7 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_exec_nested_call_single_arg_dual_proc ) +TEST( API, func_lpf_exec_nested_call_single_arg_dual_proc ) { lpf_err_t rc = LPF_SUCCESS; int three = 3; @@ -121,7 +121,6 @@ TEST( func_lpf_exec_nested_call_single_arg_dual_proc ) args.f_size = sizeof(function_pointers)/sizeof(function_pointers[0]); rc = lpf_exec( LPF_ROOT, 2, &spmd1, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", number, 7 ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); + EXPECT_EQ( number, 7 ); } diff --git a/tests/functional/func_lpf_exec_single_call_no_arg_max_proc.c b/tests/functional/func_lpf_exec_single_call_no_arg_max_proc.cpp similarity index 70% rename from tests/functional/func_lpf_exec_single_call_no_arg_max_proc.c rename to tests/functional/func_lpf_exec_single_call_no_arg_max_proc.cpp index 7b1ecf6d..a4b470af 100644 --- a/tests/functional/func_lpf_exec_single_call_no_arg_max_proc.c +++ b/tests/functional/func_lpf_exec_single_call_no_arg_max_proc.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" @@ -25,12 +25,12 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_LE( "%u", (lpf_pid_t) 1, nprocs ); - EXPECT_LE( "%u", (lpf_pid_t) 0, pid ); - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_LE( (lpf_pid_t) 1, nprocs ); + EXPECT_LE( (lpf_pid_t) 0, pid ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } @@ -39,10 +39,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_exec_single_call_no_arg_max_proc ) +TEST( API, func_lpf_exec_single_call_no_arg_max_proc ) { lpf_err_t rc = LPF_SUCCESS ; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_exec_single_call_no_arg_single_proc.c b/tests/functional/func_lpf_exec_single_call_no_arg_single_proc.cpp similarity index 70% rename from tests/functional/func_lpf_exec_single_call_no_arg_single_proc.c rename to tests/functional/func_lpf_exec_single_call_no_arg_single_proc.cpp index d5b433a1..aaa6ab15 100644 --- a/tests/functional/func_lpf_exec_single_call_no_arg_single_proc.c +++ b/tests/functional/func_lpf_exec_single_call_no_arg_single_proc.cpp @@ -17,19 +17,19 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_LE( "%ud", (lpf_pid_t) 1, nprocs ); - EXPECT_LE( "%ud", (lpf_pid_t) 0, pid ); - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_LE( (lpf_pid_t) 1, nprocs ); + EXPECT_LE( (lpf_pid_t) 0, pid ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } @@ -38,10 +38,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_exec_single_call_no_arg_single_proc ) +TEST( API, func_lpf_exec_single_call_no_arg_single_proc ) { lpf_err_t rc = LPF_SUCCESS ; rc = lpf_exec( LPF_ROOT, 1, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_exec_single_call_single_arg_dual_proc.c b/tests/functional/func_lpf_exec_single_call_single_arg_dual_proc.cpp similarity index 73% rename from tests/functional/func_lpf_exec_single_call_single_arg_dual_proc.c rename to tests/functional/func_lpf_exec_single_call_single_arg_dual_proc.cpp index ce0dc926..c46bf918 100644 --- a/tests/functional/func_lpf_exec_single_call_single_arg_dual_proc.c +++ b/tests/functional/func_lpf_exec_single_call_single_arg_dual_proc.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" @@ -25,18 +25,18 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_EQ( "%d", 2, nprocs ); + EXPECT_EQ( 2, nprocs ); if ( 0 == pid ) { - EXPECT_EQ( "%d", 1, * (int *) args.input ); + EXPECT_EQ( 1, * (int *) args.input ); *(int *) args.output = 1; } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } } @@ -46,7 +46,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_exec_single_call_single_arg_dual_proc ) +TEST( API, func_lpf_exec_single_call_single_arg_dual_proc ) { lpf_err_t rc = LPF_SUCCESS; int input = 1; @@ -59,8 +59,7 @@ TEST( func_lpf_exec_single_call_single_arg_dual_proc ) args.f_size = 0; args.f_symbols = NULL; rc = lpf_exec( LPF_ROOT, 2, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", 1, output ); - return 0; + EXPECT_EQ( 1, output ); } diff --git a/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.c b/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.cpp similarity index 66% rename from tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.c rename to tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.cpp index 131297e9..5b11470e 100644 --- a/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.c +++ b/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_one.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" @@ -25,53 +25,54 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable lpf_err_t rc = LPF_SUCCESS; - int a[2] = { pid, -1 }; + lpf_pid_t a[2] = { pid, LPF_MAX_P }; lpf_memslot_t aSlot = LPF_INVALID_MEMSLOT; - EXPECT_LE( "%d", 2, nprocs ); + EXPECT_LE( 2, nprocs ); + EXPECT_LT( pid, LPF_MAX_P ); if ( 0 == pid ) { - EXPECT_EQ( "%zd", (size_t) sizeof(int), args.input_size ); - EXPECT_EQ( "%zd", (size_t) sizeof(int), args.output_size ); - EXPECT_EQ( "%d", 1, * (int *) args.input ); + EXPECT_EQ( (size_t) sizeof(int), args.input_size ); + EXPECT_EQ( (size_t) sizeof(int), args.output_size ); + EXPECT_EQ( 1, * (int *) args.input ); } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ(( void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); } // perform a simple communication rc = lpf_resize_message_queue( lpf, 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf , LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &a, sizeof(a), &aSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf , LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, aSlot, 0, (pid+1) % nprocs, aSlot, sizeof(a[0]), sizeof(a[0]), LPF_MSG_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf , LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", a[0], (int) pid ); - EXPECT_EQ( "%d", a[1], (int) ((pid+nprocs-1) % nprocs) ); + EXPECT_EQ( a[0], (int) pid ); + EXPECT_EQ( a[1], (int) ((pid+nprocs-1) % nprocs) ); rc = lpf_deregister( lpf, aSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // now, all other processes except 'one' perform an extra sync. if ( 1 != pid ) { rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_ERR_FATAL, rc ); + EXPECT_EQ( LPF_ERR_FATAL, rc ); } // It is still possible to send output through the args @@ -87,7 +88,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_exec_single_call_single_arg_max_proc_early_exit_one ) +TEST( API, func_lpf_exec_single_call_single_arg_max_proc_early_exit_one ) { lpf_err_t rc = LPF_SUCCESS; int input = 1; @@ -100,8 +101,7 @@ TEST( func_lpf_exec_single_call_single_arg_max_proc_early_exit_one ) args.f_size = 0; args.f_symbols = NULL; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ); - EXPECT_EQ( "%d", LPF_ERR_FATAL , rc ); + EXPECT_EQ( LPF_ERR_FATAL , rc ); - EXPECT_EQ( "%d", 2, output ); - return 0; + EXPECT_EQ( 2, output ); } diff --git a/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.c b/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.cpp similarity index 68% rename from tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.c rename to tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.cpp index d84b77ad..40e1afee 100644 --- a/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.c +++ b/tests/functional/func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" @@ -25,23 +25,23 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_LE( "%d", 2, nprocs ); + EXPECT_LE( 2, nprocs ); if ( 0 == pid ) { - EXPECT_EQ( "%zd", (size_t) sizeof(int), args.input_size ); - EXPECT_EQ( "%zd", (size_t) sizeof(int), args.output_size ); - EXPECT_EQ( "%d", 1, * (int *) args.input ); + EXPECT_EQ( (size_t) sizeof(int), args.input_size ); + EXPECT_EQ( (size_t) sizeof(int), args.output_size ); + EXPECT_EQ( 1, * (int *) args.input ); *(int *) args.output = 2; } else { - EXPECT_EQ( "%zd", (size_t) 0, args.input_size ); - EXPECT_EQ( "%zd", (size_t) 0, args.output_size ); - EXPECT_EQ( "%p", (void *) NULL, args.input ); - EXPECT_EQ( "%p", (void *) NULL, args.output ); + EXPECT_EQ( (size_t) 0, args.input_size ); + EXPECT_EQ( (size_t) 0, args.output_size ); + EXPECT_EQ( (void *) NULL, args.input ); + EXPECT_EQ( (void *) NULL, args.output ); lpf_err_t rc = lpf_sync(lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_ERR_FATAL, rc ); + EXPECT_EQ( LPF_ERR_FATAL, rc ); } } @@ -51,7 +51,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero ) +TEST( API, func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero ) { lpf_err_t rc = LPF_SUCCESS; int input = 1; @@ -64,8 +64,7 @@ TEST( func_lpf_exec_single_call_single_arg_max_proc_early_exit_zero ) args.f_size = 0; args.f_symbols = NULL; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ); - EXPECT_EQ( "%d", LPF_ERR_FATAL, rc ); + EXPECT_EQ( LPF_ERR_FATAL, rc ); - EXPECT_EQ( "%d", 2, output ); - return 0; + EXPECT_EQ( 2, output ); } diff --git a/tests/functional/func_lpf_exec_single_call_single_arg_single_proc.c b/tests/functional/func_lpf_exec_single_call_single_arg_single_proc.cpp similarity index 79% rename from tests/functional/func_lpf_exec_single_call_single_arg_single_proc.c rename to tests/functional/func_lpf_exec_single_call_single_arg_single_proc.cpp index 93493e9b..b1d9491b 100644 --- a/tests/functional/func_lpf_exec_single_call_single_arg_single_proc.c +++ b/tests/functional/func_lpf_exec_single_call_single_arg_single_proc.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #define SAMPLE_INPUT_ARG "This is an input argument" #define SAMPLE_INPUT_ARG_LENGTH 10 @@ -29,10 +29,10 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) lpf; // ignore lpf context variable - EXPECT_EQ( "%d", 1, (int) nprocs ); - EXPECT_EQ( "%d", 0, (int) pid); + EXPECT_EQ( 1, (int) nprocs ); + EXPECT_EQ( 0, (int) pid); - EXPECT_EQ( "%d", 0, memcmp( args.input, SAMPLE_INPUT_ARG, SAMPLE_INPUT_ARG_LENGTH ) ); + EXPECT_EQ( 0, memcmp( args.input, SAMPLE_INPUT_ARG, SAMPLE_INPUT_ARG_LENGTH ) ); memcpy( args.output, SAMPLE_OUTPUT_ARG, SAMPLE_OUTPUT_ARG_LENGTH ); } @@ -42,7 +42,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_exec_single_call_single_arg_single_proc ) +TEST( API, func_lpf_exec_single_call_single_arg_single_proc ) { lpf_err_t rc = LPF_SUCCESS; char input_arg[] = SAMPLE_INPUT_ARG; @@ -56,8 +56,7 @@ TEST( func_lpf_exec_single_call_single_arg_single_proc ) args.f_size = 0; rc = lpf_exec( LPF_ROOT, 1, &spmd, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); - EXPECT_EQ( "%d", 0, memcmp( args.output, SAMPLE_OUTPUT_ARG, SAMPLE_OUTPUT_ARG_LENGTH ) ); - return 0; + EXPECT_EQ( 0, memcmp( args.output, SAMPLE_OUTPUT_ARG, SAMPLE_OUTPUT_ARG_LENGTH ) ); } diff --git a/tests/functional/func_lpf_get_parallel_alltoall.c b/tests/functional/func_lpf_get_parallel_alltoall.cpp similarity index 73% rename from tests/functional/func_lpf_get_parallel_alltoall.c rename to tests/functional/func_lpf_get_parallel_alltoall.cpp index 4166a705..2bb96d12 100644 --- a/tests/functional/func_lpf_get_parallel_alltoall.c +++ b/tests/functional/func_lpf_get_parallel_alltoall.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,8 +26,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const int n = nprocs; int i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i; @@ -35,28 +35,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, 2*nprocs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", i, xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( i, xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // Do an all-to-all which is like transposing a matrix @@ -66,24 +66,24 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_get( lpf, i, xslot, sizeof(xs[0])*pid, yslot, sizeof(ys[0])*i, sizeof(xs[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", i, xs[i] ); - EXPECT_EQ( "%d", (int) pid, ys[i] ); + EXPECT_EQ( i, xs[i] ); + EXPECT_EQ( (int) pid, ys[i] ); } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -91,9 +91,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_get_parallel_alltoall ) +TEST( API, func_lpf_get_parallel_alltoall ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_get_parallel_huge.c b/tests/functional/func_lpf_get_parallel_huge.cpp similarity index 73% rename from tests/functional/func_lpf_get_parallel_huge.c rename to tests/functional/func_lpf_get_parallel_huge.cpp index 3d42b3b4..ce9283d9 100644 --- a/tests/functional/func_lpf_get_parallel_huge.c +++ b/tests/functional/func_lpf_get_parallel_huge.cpp @@ -18,31 +18,31 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { (void) args; // ignore args parameter lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ("%d", 2, nprocs); + EXPECT_EQ( 2, nprocs); size_t maxMsgs = 1 , maxRegs = 2; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); size_t huge = (size_t) 10 + INT_MAX; // if this overflows, it means that // size_t fits in 'int' and so this // test is pointless - int *x = calloc( huge , sizeof(int)); - int *y = calloc( huge, sizeof(int)); + int *x = (int *) calloc( huge , sizeof(int)); + int *y = (int *) calloc( huge, sizeof(int)); - EXPECT_NE( "%p", (int *) NULL, x ); - EXPECT_NE( "%p", (int *) NULL, y ); + EXPECT_NE( (int *) NULL, x ); + EXPECT_NE( (int *) NULL, y ); size_t i; for (i = 0; i -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -27,8 +27,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const int n = nprocs*MTU; int i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*n + pid; @@ -36,28 +36,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, nprocs + 1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) (i*n+pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) (i*n+pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // processor zero gets data from each processor. @@ -68,12 +68,12 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_get( lpf, i, xslot, 0u, yslot, 0u, sizeof(xs[0]) * n, LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { @@ -81,8 +81,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) int delta = ys[0] - xs[0]; for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", delta, ys[i] - xs[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( delta, ys[i] - xs[i] ); } } else @@ -90,16 +90,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // on the other processors nothing has been written for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -107,9 +107,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_get_parallel_overlapping_complete ) +TEST( API, func_lpf_get_parallel_overlapping_complete ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_get_parallel_overlapping_pyramid.c b/tests/functional/func_lpf_get_parallel_overlapping_pyramid.cpp similarity index 74% rename from tests/functional/func_lpf_get_parallel_overlapping_pyramid.c rename to tests/functional/func_lpf_get_parallel_overlapping_pyramid.cpp index 8b10b06b..7c29336f 100644 --- a/tests/functional/func_lpf_get_parallel_overlapping_pyramid.c +++ b/tests/functional/func_lpf_get_parallel_overlapping_pyramid.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,8 +26,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const size_t n = 2*nprocs*MTU; size_t i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*n + pid; @@ -35,28 +35,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, nprocs+1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) (i*n+pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) (i*n+pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // processor zero gets the data from all other processors @@ -69,13 +69,13 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_get( lpf, i, xslot, start*MTU*sizeof(xs[0]), yslot, start*MTU*sizeof(xs[0]), (end-start)*MTU*sizeof(xs[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { @@ -101,19 +101,19 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // check the contents of a block size_t pid1 = ys[i] - xs[i]; size_t pid2 = ys[n-i-1] - xs[n-i-1]; - EXPECT_EQ( "%zu", pid1, pid2 ); - EXPECT_LE( "%zu", pid1, i ); - EXPECT_LE( "%zu", pid1, n-i-1 ); + EXPECT_EQ( pid1, pid2 ); + EXPECT_LE( pid1, i ); + EXPECT_LE( pid1, n-i-1 ); - EXPECT_LE( "%d", (int) pid1, (int) nprocs); + EXPECT_LE( (int) pid1, (int) nprocs); // check that all values in the block are from the same processor size_t j; for (j = 0; j < MTU; ++j) { - EXPECT_EQ( "%d", (int) pid1, ys[i+j] - xs[i+j]); - EXPECT_EQ( "%d", (int) pid1, ys[n-i-1-j] - xs[n-i-1-j] ); + EXPECT_EQ( (int) pid1, ys[i+j] - xs[i+j]); + EXPECT_EQ( (int) pid1, ys[n-i-1-j] - xs[n-i-1-j] ); } } } @@ -122,16 +122,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // on the other processors nothing has changed for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -139,9 +139,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_get_parallel_overlapping_pyramid ) +TEST( API, func_lpf_get_parallel_overlapping_pyramid ) { lpf_err_t rc =lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_get_parallel_overlapping_rooftiling.c b/tests/functional/func_lpf_get_parallel_overlapping_rooftiling.cpp similarity index 74% rename from tests/functional/func_lpf_get_parallel_overlapping_rooftiling.c rename to tests/functional/func_lpf_get_parallel_overlapping_rooftiling.cpp index 865854a7..0e083ee2 100644 --- a/tests/functional/func_lpf_get_parallel_overlapping_rooftiling.c +++ b/tests/functional/func_lpf_get_parallel_overlapping_rooftiling.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -29,8 +29,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const size_t n = 5*nprocs*MTU; size_t i; uint64_t * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (uint64_t *) malloc( sizeof(ys[0]) * n); + xs = (uint64_t *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*nprocs + pid; @@ -38,28 +38,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, nprocs+1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%" PRIu64, (uint64_t) (i*nprocs+pid), xs[i] ); - EXPECT_EQ( "%" PRIu64, (uint64_t) 0, ys[i] ); + EXPECT_EQ( (uint64_t) (i*nprocs+pid), xs[i] ); + EXPECT_EQ( (uint64_t) 0, ys[i] ); } // Each processor copies his row to processor zero. @@ -73,13 +73,13 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_get( lpf, i, xslot, start*sizeof(xs[0])*MTU, yslot, offset*sizeof(xs[0])*MTU, length*sizeof(xs[0])*MTU, LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { @@ -115,32 +115,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) uint64_t fromPid2 = ys[ (4*i+j) * MTU + k] - xs[(4*i+j + offset) * MTU + k]; fromPid2 = (fromPid2 + nprocs*MTU)%nprocs; - EXPECT_EQ( "%" PRIu64, fromPid, fromPid2 ); + EXPECT_EQ( fromPid, fromPid2 ); - if (fromPid == i) - EXPECT_EQ( "%" PRIu64, (5*i+j)*nprocs*MTU + fromPid, ys[(4*i+j)*MTU] ); + if (fromPid == i) { + EXPECT_EQ( (5*i+j)*nprocs*MTU + fromPid, ys[(4*i+j)*MTU] ); + } } if (0 == j && i > 0) { - EXPECT_EQ( "%d", 1, fromPid == i || fromPid == i-1 ); + EXPECT_EQ( 1, fromPid == i || fromPid == i-1 ); } else if (4 == j && i < nprocs-1) { - EXPECT_EQ( "%d", 1, fromPid == i || fromPid == i+1 ); + EXPECT_EQ( 1, fromPid == i || fromPid == i+1 ); } else { - EXPECT_EQ( "%" PRIu64, fromPid, (uint64_t) i ); + EXPECT_EQ( fromPid, (uint64_t) i ); } } offset += 1; } - EXPECT_EQ("%d", (int) nprocs, offset ); + EXPECT_EQ( (int) nprocs, offset ); // the rest of the ys array should be zero for (i = 0; i < (nprocs - 1) * MTU; ++i) { - EXPECT_EQ("%" PRIu64, (uint64_t) 0, ys[n-i-1]); + EXPECT_EQ( (uint64_t) 0, ys[n-i-1]); } } else @@ -148,16 +149,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // on the other processors nothing has changed for (i = 0; i < n; ++i) { - EXPECT_EQ( "%" PRIu64, (uint64_t) ( i*nprocs + pid), xs[i] ); - EXPECT_EQ( "%" PRIu64, (uint64_t) 0, ys[i] ); + EXPECT_EQ( (uint64_t) ( i*nprocs + pid), xs[i] ); + EXPECT_EQ( (uint64_t) 0, ys[i] ); } } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -165,9 +166,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_get_parallel_overlapping_rooftiling ) +TEST( API, func_lpf_get_parallel_overlapping_rooftiling ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_get_parallel_single.c b/tests/functional/func_lpf_get_parallel_single.cpp similarity index 74% rename from tests/functional/func_lpf_get_parallel_single.c rename to tests/functional/func_lpf_get_parallel_single.cpp index 5ab4657c..436ebdd7 100644 --- a/tests/functional/func_lpf_get_parallel_single.c +++ b/tests/functional/func_lpf_get_parallel_single.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,39 +26,39 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 2 , maxRegs = 2; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); int x = 5, y = 10; lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, &x, sizeof(x), &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( lpf, &y, sizeof(y), &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", 10, y); + EXPECT_EQ( 10, y); rc = lpf_get( lpf, (pid+1)%nprocs, xslot, 0, yslot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", 5, y); + EXPECT_EQ( 5, y); rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -66,9 +66,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_get_parallel_single ) +TEST( API, func_lpf_get_parallel_single ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_hook_simple.mpirma.c b/tests/functional/func_lpf_hook_simple.mpirma.cpp similarity index 76% rename from tests/functional/func_lpf_hook_simple.mpirma.c rename to tests/functional/func_lpf_hook_simple.mpirma.cpp index 5dfa7104..81016a39 100644 --- a/tests/functional/func_lpf_hook_simple.mpirma.c +++ b/tests/functional/func_lpf_hook_simple.mpirma.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -28,11 +28,11 @@ void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_err_t rc = LPF_SUCCESS; rc = lpf_resize_message_queue( ctx, 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_sync(ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); int x = 5 - pid; int y = pid; @@ -41,21 +41,21 @@ void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( ctx, &x, sizeof(x), &xSlot ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_register_global( ctx, &y, sizeof(y), &ySlot ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_put( ctx, xSlot, 0, (pid + 1) % nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); - EXPECT_EQ( "%d", x, (int) (5 - pid) ); - EXPECT_EQ( "%d", y, (int) (5 - (pid + nprocs -1) % nprocs) ); + EXPECT_EQ( x, (int) (5 - pid) ); + EXPECT_EQ( y, (int) (5 - (pid + nprocs -1) % nprocs) ); } // disable automatic initialization. @@ -66,7 +66,7 @@ const int LPF_MPI_AUTO_INITIALIZE=0; * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_hook_simple_mpi ) +TEST(API, func_lpf_hook_simple_mpi) { lpf_err_t rc = LPF_SUCCESS; MPI_Init(NULL, NULL); @@ -79,16 +79,15 @@ TEST( func_lpf_hook_simple_mpi ) lpf_init_t init; rc = lpf_mpi_initialize_with_mpicomm( MPI_COMM_WORLD, &init); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_hook( init, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_mpi_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); MPI_Finalize(); - return 0; } diff --git a/tests/functional/func_lpf_hook_simple.pthread.c b/tests/functional/func_lpf_hook_simple.pthread.cpp similarity index 72% rename from tests/functional/func_lpf_hook_simple.pthread.c rename to tests/functional/func_lpf_hook_simple.pthread.cpp index 3b33bdc6..6438b676 100644 --- a/tests/functional/func_lpf_hook_simple.pthread.c +++ b/tests/functional/func_lpf_hook_simple.pthread.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -36,18 +36,18 @@ struct thread_local_data { void lpf_spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) ctx; - const struct thread_local_data * const data = pthread_getspecific( pid_key ); - - EXPECT_EQ( "%zd", (size_t)nprocs, (size_t)(data->P) ); - EXPECT_EQ( "%zd", (size_t)pid, (size_t)(data->s) ); - EXPECT_EQ( "%zd", (size_t)(args.input_size), (size_t)(sizeof( struct thread_local_data)) ); - EXPECT_EQ( "%zd", (size_t)(args.output_size), (size_t)0 ); - EXPECT_EQ( "%p", args.input, data ); - EXPECT_EQ( "%p", args.output, NULL ); + const struct thread_local_data * const data = static_cast(pthread_getspecific( pid_key )); + + EXPECT_EQ( (size_t)nprocs, (size_t)(data->P) ); + EXPECT_EQ( (size_t)pid, (size_t)(data->s) ); + EXPECT_EQ( (size_t)(args.input_size), (size_t)(sizeof( struct thread_local_data)) ); + EXPECT_EQ( (size_t)(args.output_size), (size_t)0 ); + EXPECT_EQ( args.input, data ); + EXPECT_EQ( args.output, nullptr ); } void * pthread_spmd( void * _data ) { - EXPECT_NE( "%p", _data, NULL ); + EXPECT_NE( _data, nullptr); const struct thread_local_data data = * ((struct thread_local_data*) _data); const int pts_rc = pthread_setspecific( pid_key, _data ); @@ -61,20 +61,20 @@ void * pthread_spmd( void * _data ) { lpf_init_t init; lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ( "%d", pts_rc, 0 ); + EXPECT_EQ( pts_rc, 0 ); rc = lpf_pthread_initialize( (lpf_pid_t)data.s, (lpf_pid_t)data.P, &init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_hook( init, &lpf_spmd, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_pthread_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); return NULL; } @@ -85,36 +85,35 @@ void * pthread_spmd( void * _data ) { * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_hook_simple_pthread ) +TEST(API, func_lpf_hook_simple_pthread ) { long k = 0; const long P = sysconf( _SC_NPROCESSORS_ONLN ); const int ptc_rc = pthread_key_create( &pid_key, NULL ); - EXPECT_EQ( "%d", ptc_rc, 0 ); + EXPECT_EQ( ptc_rc, 0 ); pthread_t * const threads = (pthread_t*) malloc( P * sizeof(pthread_t) ); - EXPECT_NE( "%p", threads, NULL ); + EXPECT_NE( threads, nullptr ); struct thread_local_data * const data = (struct thread_local_data*) malloc( P * sizeof(struct thread_local_data) ); - EXPECT_NE( "%p", data, NULL ); + EXPECT_NE( data, nullptr ); for( k = 0; k < P; ++k ) { data[ k ].P = P; data[ k ].s = k; const int rval = pthread_create( threads + k, NULL, &pthread_spmd, data + k ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } for( k = 0; k < P; ++k ) { const int rval = pthread_join( threads[ k ], NULL ); - EXPECT_EQ( "%d", rval, 0 ); + EXPECT_EQ( rval, 0 ); } const int ptd_rc = pthread_key_delete( pid_key ); - EXPECT_EQ( "%d", ptd_rc, 0 ); + EXPECT_EQ( ptd_rc, 0 ); - return 0; } diff --git a/tests/functional/func_lpf_hook_subset.mpimsg.c b/tests/functional/func_lpf_hook_subset.mpimsg.cpp similarity index 92% rename from tests/functional/func_lpf_hook_subset.mpimsg.c rename to tests/functional/func_lpf_hook_subset.mpimsg.cpp index f073e443..6693bab3 100644 --- a/tests/functional/func_lpf_hook_subset.mpimsg.c +++ b/tests/functional/func_lpf_hook_subset.mpimsg.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include @@ -39,10 +39,10 @@ void subset_func(MPI_Comm comm) lpf_init_t init; lpf_err_t rc = lpf_mpi_initialize_with_mpicomm(comm, &init); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_hook(init, test_spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -50,7 +50,7 @@ void subset_func(MPI_Comm comm) * \pre P >= 3 * \return Exit code: 0 */ -TEST( func_lpf_hook_subset ) +TEST(API, func_lpf_hook_subset ) { MPI_Init(NULL, NULL); @@ -71,5 +71,5 @@ TEST( func_lpf_hook_subset ) MPI_Barrier(MPI_COMM_WORLD); // Paranoid barrier MPI_Finalize(); - return 0; + } diff --git a/tests/functional/func_lpf_hook_tcp.mpirma.c b/tests/functional/func_lpf_hook_tcp.mpirma.cpp similarity index 71% rename from tests/functional/func_lpf_hook_tcp.mpirma.c rename to tests/functional/func_lpf_hook_tcp.mpirma.cpp index 2921e6fc..0d7f0290 100644 --- a/tests/functional/func_lpf_hook_tcp.mpirma.c +++ b/tests/functional/func_lpf_hook_tcp.mpirma.cpp @@ -17,28 +17,35 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include +static int myargc; +static char **myargv; + +// disable automatic initialization. +const int LPF_MPI_AUTO_INITIALIZE=0; + + void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { lpf_err_t rc = LPF_SUCCESS; struct { int pid, nprocs; } params; - EXPECT_EQ( "%lu", sizeof(params), args.input_size ); + EXPECT_EQ( sizeof(params), args.input_size ); memcpy( ¶ms, args.input, sizeof(params)); - EXPECT_EQ( "%u", (lpf_pid_t) params.pid, pid ); - EXPECT_EQ( "%u", (lpf_pid_t) params.nprocs, nprocs ); + EXPECT_EQ( (lpf_pid_t) params.pid, pid ); + EXPECT_EQ( (lpf_pid_t) params.nprocs, nprocs ); rc = lpf_resize_message_queue( ctx, 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, 2); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_sync(ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); int x = 5 - pid; int y = pid; @@ -47,25 +54,23 @@ void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t ySlot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( ctx, &x, sizeof(x), &xSlot ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_register_global( ctx, &y, sizeof(y), &ySlot ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_put( ctx, xSlot, 0, (pid + 1) % nprocs, ySlot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); - EXPECT_EQ( "%d", x, (int) (5 - pid) ); - EXPECT_EQ( "%d", y, (int) (5 - (pid + nprocs -1) % nprocs) ); + EXPECT_EQ( x, (int) (5 - pid) ); + EXPECT_EQ( y, (int) (5 - (pid + nprocs -1) % nprocs) ); } -// disable automatic initialization. -const int LPF_MPI_AUTO_INITIALIZE=0; /** * \test Tests lpf_hook on mpi implementation using TCP/IP to initialize. The pids and nprocs are checked for their correctness. @@ -73,15 +78,14 @@ const int LPF_MPI_AUTO_INITIALIZE=0; * \return Exit code: 0 * \note Independent processes: yes */ -TEST( func_lpf_hook_tcp ) +TEST( API, func_lpf_hook_tcp_mpirma ) { lpf_err_t rc = LPF_SUCCESS; - MPI_Init(&argc, &argv); struct { int pid, nprocs; } params = { 0, 0}; - EXPECT_GT("%d", argc, 2 ); - params.pid = atoi( argv[1] ); - params.nprocs = atoi( argv[2] ); + EXPECT_GT( myargc, 2 ); + params.pid = atoi( myargv[1] ); + params.nprocs = atoi( myargv[2] ); lpf_init_t init; rc = lpf_mpi_initialize_over_tcp( @@ -89,7 +93,7 @@ TEST( func_lpf_hook_tcp ) params.pid, params.nprocs, &init); // let e.g. Intel MPI try a few // alternative fabrics - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); lpf_args_t args; args.input = ¶ms; @@ -100,13 +104,20 @@ TEST( func_lpf_hook_tcp ) args.f_size = 0; rc = lpf_hook( init, &spmd, args ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); rc = lpf_mpi_finalize( init ); - EXPECT_EQ( "%d", rc, LPF_SUCCESS ); + EXPECT_EQ( rc, LPF_SUCCESS ); MPI_Finalize(); - return 0; +} + +int main(int argc, char **argv) { + myargc = argc; + myargv = argv; + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + } diff --git a/tests/functional/func_lpf_hook_tcp_timeout.mpirma.c b/tests/functional/func_lpf_hook_tcp_timeout.mpirma.cpp similarity index 91% rename from tests/functional/func_lpf_hook_tcp_timeout.mpirma.c rename to tests/functional/func_lpf_hook_tcp_timeout.mpirma.cpp index e8aba501..94d3edd6 100644 --- a/tests/functional/func_lpf_hook_tcp_timeout.mpirma.c +++ b/tests/functional/func_lpf_hook_tcp_timeout.mpirma.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -31,7 +31,7 @@ const int LPF_MPI_AUTO_INITIALIZE=0; * \pre P <= 100 * \return Exit code: 1 */ -TEST( func_lpf_hook_tcp_timeout_mpi ) +TEST(API, func_lpf_hook_tcp_timeout_mpi ) { MPI_Init(NULL, NULL); @@ -45,9 +45,8 @@ TEST( func_lpf_hook_tcp_timeout_mpi ) "localhost", "9325", 999, pid, nprocs, &init); - EXPECT_EQ( "%d", rc, LPF_ERR_FATAL ); + EXPECT_EQ( rc, LPF_ERR_FATAL ); - return 0; } diff --git a/tests/functional/func_lpf_probe_parallel_full.c b/tests/functional/func_lpf_probe_parallel_full.cpp similarity index 52% rename from tests/functional/func_lpf_probe_parallel_full.c rename to tests/functional/func_lpf_probe_parallel_full.cpp index 113aa0ca..7bf55696 100644 --- a/tests/functional/func_lpf_probe_parallel_full.c +++ b/tests/functional/func_lpf_probe_parallel_full.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -24,24 +24,24 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) lpf_machine_t subMachine = LPF_INVALID_MACHINE; lpf_err_t rc = lpf_probe( lpf, &subMachine ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%u", nprocs, subMachine.p ); - EXPECT_EQ( "%u", 1u, subMachine.free_p ); - EXPECT_LT( "%g", 0.0, (*(subMachine.g))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.l))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.g))(subMachine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.l))(subMachine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.g))(subMachine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.l))(subMachine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_EQ( nprocs, subMachine.p ); + EXPECT_EQ( 1u, subMachine.free_p ); + EXPECT_LT( 0.0, (*(subMachine.g))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.l))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.g))(subMachine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.l))(subMachine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.g))(subMachine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.l))(subMachine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); if ( 0 == pid ) { lpf_machine_t * machine = (lpf_machine_t * ) args.input; - EXPECT_EQ( "%zd", args.input_size, sizeof(lpf_machine_t) ); + EXPECT_EQ( args.input_size, sizeof(lpf_machine_t) ); - EXPECT_EQ( "%u", nprocs, machine->p ); - EXPECT_EQ( "%u", nprocs, machine->free_p ); + EXPECT_EQ( nprocs, machine->p ); + EXPECT_EQ( nprocs, machine->free_p ); } } @@ -52,24 +52,24 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_probe_parallel_full ) +TEST( API, func_lpf_probe_parallel_full ) { lpf_err_t rc = LPF_SUCCESS; lpf_machine_t machine = LPF_INVALID_MACHINE; rc = lpf_probe( LPF_ROOT, &machine ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_LE( "%u", 1u, machine.p ); - EXPECT_LE( "%u", 1u, machine.free_p ); - EXPECT_LE( "%u", machine.p, machine.free_p ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LE( 1u, machine.p ); + EXPECT_LE( 1u, machine.free_p ); + EXPECT_LE( machine.p, machine.free_p ); + EXPECT_LT( 0.0, (*(machine.g))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); lpf_args_t args; args.input = &machine; @@ -80,7 +80,6 @@ TEST( func_lpf_probe_parallel_full ) args.f_size = 0; rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - return 0; } diff --git a/tests/functional/func_lpf_probe_parallel_nested.c b/tests/functional/func_lpf_probe_parallel_nested.cpp similarity index 59% rename from tests/functional/func_lpf_probe_parallel_nested.c rename to tests/functional/func_lpf_probe_parallel_nested.cpp index bacafad8..f594b7b8 100644 --- a/tests/functional/func_lpf_probe_parallel_nested.c +++ b/tests/functional/func_lpf_probe_parallel_nested.cpp @@ -16,56 +16,56 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd2( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { (void) args; // ignore any arguments passed through call to lpf_exec lpf_err_t rc = lpf_resize_message_queue( lpf, nprocs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync(lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_machine_t machine[3] = { LPF_INVALID_MACHINE, LPF_INVALID_MACHINE, LPF_INVALID_MACHINE }; lpf_memslot_t machineSlot = LPF_INVALID_MEMSLOT ; rc = lpf_register_global( lpf, &machine[0], sizeof(machine), &machineSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync(lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { machine[0] = ((lpf_machine_t * ) args.input)[0]; machine[1] = ((lpf_machine_t * ) args.input)[1]; - EXPECT_EQ( "%zd", args.input_size, 2*sizeof(lpf_machine_t) ); + EXPECT_EQ( args.input_size, 2*sizeof(lpf_machine_t) ); } else { // broadcast machine info rc = lpf_get( lpf, 0, machineSlot, 0, machineSlot, 0, 2*sizeof(machine[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync(lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_probe( lpf, &machine[2] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - - EXPECT_EQ( "%u", machine[0].p, machine[1].p ); - EXPECT_EQ( "%u", machine[0].p, machine[2].p ); - EXPECT_EQ( "%u", 1u, machine[2].free_p ); - EXPECT_LT( "%g", 0.0, (*(machine[2].g))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine[2].l))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine[2].g))(machine[0].p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine[2].l))(machine[0].p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine[2].g))(machine[0].p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine[2].l))(machine[0].p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_EQ( LPF_SUCCESS, rc ); + + EXPECT_EQ( machine[0].p, machine[1].p ); + EXPECT_EQ( machine[0].p, machine[2].p ); + EXPECT_EQ( 1u, machine[2].free_p ); + EXPECT_LT( 0.0, (*(machine[2].g))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine[2].l))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine[2].g))(machine[0].p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine[2].l))(machine[0].p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine[2].g))(machine[0].p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine[2].l))(machine[0].p, (size_t)(-1), LPF_SYNC_DEFAULT) ); rc = lpf_deregister( lpf, machineSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) @@ -75,64 +75,64 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) lpf_pid_t p = 0; lpf_machine_t subMachine; lpf_err_t rc = lpf_probe( lpf, &subMachine ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_message_queue( lpf, nprocs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync(lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_machine_t machine ; lpf_memslot_t machineSlot = LPF_INVALID_MEMSLOT ; rc = lpf_register_global( lpf, &machine, sizeof(machine), &machineSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync(lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { machine = * ( lpf_machine_t * ) args.input; - EXPECT_EQ( "%zd", args.input_size, sizeof(lpf_machine_t) ); + EXPECT_EQ( args.input_size, sizeof(lpf_machine_t) ); } else { // broadcast machine info rc = lpf_get( lpf, 0, machineSlot, 0, machineSlot, 0, sizeof(machine), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync(lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, machineSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Do some checks - EXPECT_EQ( "%u", nprocs, subMachine.p / 2 ); - EXPECT_EQ( "%u", nprocs, machine.p / 2 ); - EXPECT_LT( "%g", 0.0, (*(subMachine.g))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.l))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(subMachine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_EQ( nprocs, subMachine.p / 2 ); + EXPECT_EQ( nprocs, machine.p / 2 ); + EXPECT_LT( 0.0, (*(subMachine.g))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.l))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(subMachine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); const int pthread = 1, mpirma = 1, mpimsg = 1, hybrid = 0, ibverbs=1; (void) pthread; (void) mpirma; (void) mpimsg; (void) hybrid; (void) ibverbs; if (LPF_CORE_IMPL_ID) // this part is disabled for the hybrid implementation, because { // that one doesn't do generic nesting of lpf_exec's - EXPECT_EQ( "%d", 1, subMachine.free_p == 2 || subMachine.free_p == 3 ); + EXPECT_EQ( 1, subMachine.free_p == 2 || subMachine.free_p == 3 ); // compute the sum of all 'free_p' values - lpf_pid_t * vec = malloc(sizeof(lpf_pid_t)*nprocs); - EXPECT_NE( "%p", NULL, vec ); + lpf_pid_t * vec = (lpf_pid_t *) malloc(sizeof(lpf_pid_t)*nprocs); + EXPECT_NE( nullptr, vec ); vec[ pid ] = subMachine.free_p; lpf_memslot_t vecSlot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, vec, sizeof(lpf_pid_t)*nprocs, &vecSlot); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for (p = 0 ; p < nprocs; ++p) { if ( pid != p ) @@ -140,19 +140,19 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_put( lpf, vecSlot, pid*sizeof(vec[0]), p, vecSlot, pid*sizeof(vec[0]), sizeof(vec[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, vecSlot ); lpf_pid_t sum = 0; for (p = 0; p < nprocs; ++p) { sum += vec[p]; } - EXPECT_EQ( "%u", sum, machine.p ); - EXPECT_EQ( "%u", sum, subMachine.p ); + EXPECT_EQ( sum, machine.p ); + EXPECT_EQ( sum, subMachine.p ); free(vec); } @@ -164,7 +164,7 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) args.input = multiMachine; args.input_size = sizeof(multiMachine); rc = lpf_exec( lpf, pid + 3, &spmd2, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } @@ -174,24 +174,24 @@ void spmd1( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_probe_parallel_nested ) +TEST( API, func_lpf_probe_parallel_nested ) { lpf_err_t rc = LPF_SUCCESS; lpf_machine_t machine; rc = lpf_probe( LPF_ROOT, &machine ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - - EXPECT_LE( "%u", 1u, machine.p ); - EXPECT_LE( "%u", 1u, machine.free_p ); - EXPECT_LE( "%u", machine.p, machine.free_p ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_EQ( LPF_SUCCESS, rc ); + + EXPECT_LE( 1u, machine.p ); + EXPECT_LE( 1u, machine.free_p ); + EXPECT_LE( machine.p, machine.free_p ); + EXPECT_LT( 0.0, (*(machine.g))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); lpf_args_t args; args.input = &machine; @@ -202,7 +202,6 @@ TEST( func_lpf_probe_parallel_nested ) args.f_size = 0; rc = lpf_exec( LPF_ROOT, machine.p / 2, &spmd1, args ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - return 0; } diff --git a/tests/functional/func_lpf_probe_root.c b/tests/functional/func_lpf_probe_root.cpp similarity index 58% rename from tests/functional/func_lpf_probe_root.c rename to tests/functional/func_lpf_probe_root.cpp index 5a655678..32021efa 100644 --- a/tests/functional/func_lpf_probe_root.c +++ b/tests/functional/func_lpf_probe_root.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" /** * \test Test lpf_probe function on LPF_ROOT @@ -24,23 +24,22 @@ * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_probe_root ) +TEST( API, func_lpf_probe_root ) { lpf_err_t rc = LPF_SUCCESS; lpf_machine_t machine = LPF_INVALID_MACHINE; rc = lpf_probe( LPF_ROOT, &machine ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_LE( "%u", 1u, machine.p ); - EXPECT_LE( "%u", 1u, machine.free_p ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(1, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - EXPECT_LT( "%g", 0.0, (*(machine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LE( 1u, machine.p ); + EXPECT_LE( 1u, machine.free_p ); + EXPECT_LT( 0.0, (*(machine.g))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(1, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.g))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(machine.p, 0, LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.g))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); + EXPECT_LT( 0.0, (*(machine.l))(machine.p, (size_t)(-1), LPF_SYNC_DEFAULT) ); - return 0; } diff --git a/tests/functional/func_lpf_put_and_get_overlapping.c b/tests/functional/func_lpf_put_and_get_overlapping.cpp similarity index 74% rename from tests/functional/func_lpf_put_and_get_overlapping.c rename to tests/functional/func_lpf_put_and_get_overlapping.cpp index ffd1b4bb..9eed7708 100644 --- a/tests/functional/func_lpf_put_and_get_overlapping.c +++ b/tests/functional/func_lpf_put_and_get_overlapping.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,8 +26,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const int n = nprocs*MTU; int i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*n + pid; @@ -35,28 +35,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, 4*nprocs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_global( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) (i*n+pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) (i*n+pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // get the block from all processors and also put data to all processors @@ -67,30 +67,30 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_get( lpf, i, xslot, 0u, yslot, 0u, sizeof(xs[0]) * n, LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, xslot, 0u, i, yslot, 0u, sizeof(xs[0]) * n, LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // on all processors the writes have occurred in some sequential order int delta = ys[0] - xs[0]; for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", delta, ys[i] - xs[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( delta, ys[i] - xs[i] ); } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -98,9 +98,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_put_and_get_overlapping ) +TEST( API, func_lpf_put_and_get_overlapping ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_put_parallel_alltoall.c b/tests/functional/func_lpf_put_parallel_alltoall.cpp similarity index 73% rename from tests/functional/func_lpf_put_parallel_alltoall.c rename to tests/functional/func_lpf_put_parallel_alltoall.cpp index 3dafc19a..41e4ee2e 100644 --- a/tests/functional/func_lpf_put_parallel_alltoall.c +++ b/tests/functional/func_lpf_put_parallel_alltoall.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,8 +26,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const int n = nprocs; int i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i; @@ -35,28 +35,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, 2*nprocs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", i, xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( i, xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // Do an all-to-all which is like transposing a matrix @@ -66,24 +66,24 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_put( lpf, xslot, sizeof(xs[0])*i, i, yslot, sizeof(ys[0])*pid, sizeof(xs[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", i, xs[i] ); - EXPECT_EQ( "%d", (int) pid, ys[i] ); + EXPECT_EQ( i, xs[i] ); + EXPECT_EQ( (int) pid, ys[i] ); } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -91,9 +91,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_alltoall ) +TEST( API, func_lpf_put_parallel_alltoall ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_put_parallel_bad_pattern.c b/tests/functional/func_lpf_put_parallel_bad_pattern.cpp similarity index 67% rename from tests/functional/func_lpf_put_parallel_bad_pattern.c rename to tests/functional/func_lpf_put_parallel_bad_pattern.cpp index 08756644..e31ee15d 100644 --- a/tests/functional/func_lpf_put_parallel_bad_pattern.c +++ b/tests/functional/func_lpf_put_parallel_bad_pattern.cpp @@ -18,7 +18,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -28,74 +28,79 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const unsigned n = sqrt(nprocs); unsigned i; unsigned * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (unsigned *) malloc( sizeof(ys[0]) * n); + xs = (unsigned *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i; ys[i] = 0; } - rc = lpf_resize_message_queue( lpf, n); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + rc = lpf_resize_message_queue( lpf, 2*n ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%u", i, xs[i] ); - EXPECT_EQ( "%u", 0u, ys[i] ); + EXPECT_EQ( i, xs[i] ); + EXPECT_EQ( 0u, ys[i] ); } + // this pattern for P=5 has that: + // - PID 0 puts a message to PID 0 + // - PID 0 puts a message to PID 2 + // - PID 1 puts a message to PID 0 + // - PID 1 puts a message to PID 2 + // hence the h-relation is 2 if ( pid < n ) { for ( i = 0; i < n; ++ i) { - EXPECT_LT("%u", i*n, nprocs); + EXPECT_LT( i*n, nprocs); rc = lpf_put( lpf, xslot, sizeof(xs[0])*i, i*n, yslot, sizeof(ys[0])*pid, sizeof(xs[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for (i = 0; i < n; ++i) { - EXPECT_EQ( "%u", i, xs[i] ); + EXPECT_EQ( i, xs[i] ); if ( pid % n == 0 && pid < n*n) - EXPECT_EQ( "%u", pid / n, ys[i] ); + EXPECT_EQ( pid / n, ys[i] ); else - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( 0, ys[i] ); } } /** * \test Test lpf_put by doing a pattern which bad for a sparse all-to-all - * \pre P >= 1024 * \pre P <= 1024 + * \pre P >= 1024 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_bad_pattern ) +TEST( API, func_lpf_put_parallel_bad_pattern ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_put_parallel_big.c b/tests/functional/func_lpf_put_parallel_big.cpp similarity index 84% rename from tests/functional/func_lpf_put_parallel_big.c rename to tests/functional/func_lpf_put_parallel_big.cpp index af4b3e77..d6f5a93f 100644 --- a/tests/functional/func_lpf_put_parallel_big.c +++ b/tests/functional/func_lpf_put_parallel_big.cpp @@ -22,7 +22,8 @@ #include #include -#include "Test.h" +#include + void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t arg ) { @@ -35,8 +36,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t arg ) const size_t blocksize = 99999; const size_t bufsize = nprocs * blocksize; - char * srcbuf = calloc( bufsize, 1 ); - char * dstbuf = calloc( bufsize, 1 ); + char * srcbuf = (char *) calloc( bufsize, 1 ); + char * dstbuf = (char *) calloc( bufsize, 1 ); lpf_memslot_t srcslot = LPF_INVALID_MEMSLOT; lpf_memslot_t dstslot = LPF_INVALID_MEMSLOT; @@ -44,10 +45,10 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t arg ) lpf_register_global( lpf, srcbuf, bufsize, &srcslot); lpf_register_global( lpf, dstbuf, bufsize, &dstslot); - int try = 0; - for (try = 0; try < 3; ++try ) { + int i = 0; + for (i= 0; i < 3; ++i ) { lpf_err_t rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ) ; - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); size_t dstoffset = 0; size_t srcoffset = 0; unsigned p; @@ -59,7 +60,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t arg ) } lpf_err_t rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ) ; - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_deregister( lpf, srcslot ); lpf_deregister( lpf, dstslot ); @@ -72,13 +73,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t arg ) * \note Extra lpfrun parameters: -max-mpi-msg-size 500 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_big ) +TEST(API, func_lpf_put_parallel_big) { - (void) argc; - (void) argv; - lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - return 0; } diff --git a/tests/functional/func_lpf_put_parallel_huge.c b/tests/functional/func_lpf_put_parallel_huge.cpp similarity index 73% rename from tests/functional/func_lpf_put_parallel_huge.c rename to tests/functional/func_lpf_put_parallel_huge.cpp index b26d0802..bcb754f8 100644 --- a/tests/functional/func_lpf_put_parallel_huge.c +++ b/tests/functional/func_lpf_put_parallel_huge.cpp @@ -18,31 +18,31 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { (void) args; // ignore args parameter lpf_err_t rc = LPF_SUCCESS; - EXPECT_EQ("%d", 2, nprocs); + EXPECT_EQ( 2, nprocs); size_t maxMsgs = 1 , maxRegs = 2; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); size_t huge = (size_t) 10 + INT_MAX; // if this overflows, it means that // size_t fits in 'int' and so this // test is pointless - int *x = calloc( huge , sizeof(int)); - int *y = calloc( huge, sizeof(int)); + int *x = (int *) calloc( huge , sizeof(int)); + int *y = (int *) calloc( huge, sizeof(int)); - EXPECT_NE( "%p", (int *) NULL, x ); - EXPECT_NE( "%p", (int *) NULL, y ); + EXPECT_NE( (int *) NULL, x ); + EXPECT_NE( (int *) NULL, y ); size_t i; for (i = 0; i -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,8 +26,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const int n = MTU*nprocs; int i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*n + pid; @@ -35,39 +35,39 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, nprocs+1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", i*n + (int) pid, xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( i*n + (int) pid, xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // Each processor copies his row to processor zero. rc = lpf_put( lpf, xslot, 0u, 0, yslot, 0u, sizeof(xs[0]) * n, LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { @@ -75,8 +75,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) int delta = ys[0] - xs[0]; for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", delta, ys[i] - xs[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( delta, ys[i] - xs[i] ); } } else @@ -84,15 +84,15 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // on the other processors nothing has been written for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -100,9 +100,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_overlapping_complete ) +TEST( API, func_lpf_put_parallel_overlapping_complete ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_put_parallel_overlapping_pyramid.c b/tests/functional/func_lpf_put_parallel_overlapping_pyramid.cpp similarity index 74% rename from tests/functional/func_lpf_put_parallel_overlapping_pyramid.c rename to tests/functional/func_lpf_put_parallel_overlapping_pyramid.cpp index 690ebaf5..91f57753 100644 --- a/tests/functional/func_lpf_put_parallel_overlapping_pyramid.c +++ b/tests/functional/func_lpf_put_parallel_overlapping_pyramid.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,8 +26,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const size_t n = 2*nprocs*MTU; size_t i; int * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (int *) malloc( sizeof(ys[0]) * n); + xs = (int *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*n + pid; @@ -35,28 +35,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, nprocs + 1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) (i*n+pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) (i*n+pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } // Each processor copies his row to processor zero. @@ -65,11 +65,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_put( lpf, xslot, start*MTU*sizeof(xs[0]), 0, yslot, start*MTU*sizeof(xs[0]), (end-start)*MTU*sizeof(xs[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { @@ -95,19 +95,19 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // check the contents of a block int pid1 = ys[i] - xs[i]; int pid2 = ys[n-i-1] - xs[n-i-1]; - EXPECT_EQ( "%d", pid1, pid2 ); - EXPECT_LE( "%d", pid1, (int) i ); - EXPECT_LE( "%d", pid1, (int) (n-i-1) ); + EXPECT_EQ( pid1, pid2 ); + EXPECT_LE( pid1, (int) i ); + EXPECT_LE( pid1, (int) (n-i-1) ); - EXPECT_LE( "%d", pid1, (int) nprocs); + EXPECT_LE( pid1, (int) nprocs); // check that all values in the block are from the same processor size_t j; for (j = 0; j < MTU; ++j) { - EXPECT_EQ( "%d", pid1, ys[i+j] - xs[i+j]); - EXPECT_EQ( "%d", pid1, ys[n-i-1-j] - xs[n-i-1-j] ); + EXPECT_EQ( pid1, ys[i+j] - xs[i+j]); + EXPECT_EQ( pid1, ys[n-i-1-j] - xs[n-i-1-j] ); } } } @@ -116,16 +116,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // on the other processors nothing has changed for (i = 0; i < n; ++i) { - EXPECT_EQ( "%d", (int) ( i*n + pid), xs[i] ); - EXPECT_EQ( "%d", 0, ys[i] ); + EXPECT_EQ( (int) ( i*n + pid), xs[i] ); + EXPECT_EQ( 0, ys[i] ); } } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -133,9 +133,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_overlapping_pyramid ) +TEST( API, func_lpf_put_parallel_overlapping_pyramid ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_put_parallel_overlapping_rooftiling.c b/tests/functional/func_lpf_put_parallel_overlapping_rooftiling.cpp similarity index 74% rename from tests/functional/func_lpf_put_parallel_overlapping_rooftiling.c rename to tests/functional/func_lpf_put_parallel_overlapping_rooftiling.cpp index 4e08b8eb..dfbb1595 100644 --- a/tests/functional/func_lpf_put_parallel_overlapping_rooftiling.c +++ b/tests/functional/func_lpf_put_parallel_overlapping_rooftiling.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #include #include @@ -30,8 +30,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) const size_t n = 5*nprocs*MTU; size_t i; uint64_t * xs, *ys; - ys = malloc( sizeof(ys[0]) * n); - xs = malloc( sizeof(xs[0]) * n); + ys = (uint64_t *) malloc( sizeof(ys[0]) * n); + xs = (uint64_t *) malloc( sizeof(xs[0]) * n); for (i = 0; i < n; ++i) { xs[i] = i*nprocs + pid; @@ -39,28 +39,28 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) } rc = lpf_resize_message_queue( lpf, nprocs+1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, xs, sizeof(xs[0]) * n, &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, ys, sizeof(ys[0]) * n, &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // Check that data is OK. for (i = 0; i < n; ++i) { - EXPECT_EQ( "%" PRIu64, (uint64_t) (i*nprocs+pid), xs[i] ); - EXPECT_EQ( "%" PRIu64, (uint64_t) 0, ys[i] ); + EXPECT_EQ( (uint64_t) (i*nprocs+pid), xs[i] ); + EXPECT_EQ( (uint64_t) 0, ys[i] ); } // Each processor copies his row to processor zero. @@ -71,12 +71,12 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) rc = lpf_put( lpf, xslot, start*sizeof(xs[0])*MTU, 0, yslot, offset*sizeof(xs[0])*MTU, length*sizeof(xs[0])*MTU, LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); if ( 0 == pid ) { @@ -112,32 +112,33 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) uint64_t fromPid2 = ys[ (4*i+j) * MTU + k] - xs[(4*i+j + offset) * MTU + k]; fromPid2 = (fromPid2 + nprocs*MTU)%nprocs; - EXPECT_EQ( "%" PRIu64, fromPid, fromPid2 ); + EXPECT_EQ( fromPid, fromPid2 ); - if (fromPid == i) - EXPECT_EQ( "%" PRIu64, (5*i+j)*nprocs*MTU + fromPid, ys[(4*i+j)*MTU] ); + if (fromPid == i) { + EXPECT_EQ( (5*i+j)*nprocs*MTU + fromPid, ys[(4*i+j)*MTU] ); + } } if (0 == j && i > 0) { - EXPECT_EQ( "%d", 1, fromPid == i || fromPid == i-1 ); + EXPECT_EQ( 1, fromPid == i || fromPid == i-1 ); } else if (4 == j && i < nprocs-1) { - EXPECT_EQ( "%d", 1, fromPid == i || fromPid == i+1 ); + EXPECT_EQ( 1, fromPid == i || fromPid == i+1 ); } else { - EXPECT_EQ( "%" PRIu64, fromPid, (uint64_t) i ); + EXPECT_EQ( fromPid, (uint64_t) i ); } } offset += 1; } - EXPECT_EQ("%u", (unsigned) nprocs, offset ); + EXPECT_EQ( (unsigned) nprocs, offset ); // the rest of the ys array should be zero for (i = 0; i < (nprocs-1) * MTU ; ++i) { - EXPECT_EQ("%" PRIu64, (uint64_t) 0, ys[n-i-1]); + EXPECT_EQ( (uint64_t) 0, ys[n-i-1]); } } else @@ -145,16 +146,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // on the other processors nothing has changed for (i = 0; i < n; ++i) { - EXPECT_EQ( "%" PRIu64, (uint64_t) ( i*nprocs + pid), xs[i] ); - EXPECT_EQ( "%" PRIu64, (uint64_t) 0, ys[i] ); + EXPECT_EQ( (uint64_t) ( i*nprocs + pid), xs[i] ); + EXPECT_EQ( (uint64_t) 0, ys[i] ); } } rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -162,9 +163,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_overlapping_rooftiling ) +TEST( API, func_lpf_put_parallel_overlapping_rooftiling ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc); } diff --git a/tests/functional/func_lpf_put_parallel_single.c b/tests/functional/func_lpf_put_parallel_single.cpp similarity index 74% rename from tests/functional/func_lpf_put_parallel_single.c rename to tests/functional/func_lpf_put_parallel_single.cpp index 9fa85d84..4dcb9d02 100644 --- a/tests/functional/func_lpf_put_parallel_single.c +++ b/tests/functional/func_lpf_put_parallel_single.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -25,38 +25,38 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 2 , maxRegs = 2; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); int x = 5, y = 10; lpf_memslot_t xslot = LPF_INVALID_MEMSLOT; lpf_memslot_t yslot = LPF_INVALID_MEMSLOT; rc = lpf_register_local( lpf, &x, sizeof(x), &xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &y, sizeof(y), &yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", 10, y); + EXPECT_EQ( 10, y); rc = lpf_put( lpf, xslot, 0, (pid+1)%nprocs, yslot, 0, sizeof(x), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%d", 5, y); + EXPECT_EQ( 5, y); rc = lpf_deregister( lpf, xslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_deregister( lpf, yslot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -64,9 +64,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_put_parallel_single ) +TEST( API, func_lpf_put_parallel_single ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ("%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_register_and_deregister_irregularly.c b/tests/functional/func_lpf_register_and_deregister_irregularly.cpp similarity index 76% rename from tests/functional/func_lpf_register_and_deregister_irregularly.c rename to tests/functional/func_lpf_register_and_deregister_irregularly.cpp index 0047bfcd..890b8e1e 100644 --- a/tests/functional/func_lpf_register_and_deregister_irregularly.c +++ b/tests/functional/func_lpf_register_and_deregister_irregularly.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -28,13 +28,13 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 0 , maxRegs = 16; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - char buffer[16] = "abcdefghijklmnop"; + std::string buffer = "abcdefghijklmnop"; lpf_memslot_t slots[16]; // register 3 entries @@ -42,36 +42,36 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < 16; ++i) { rc = lpf_register_global( lpf, &buffer[i], sizeof(buffer[i]), &slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // deregister all but the last for ( i = 0; i < 15; ++i) { rc = lpf_deregister( lpf, slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // and resize to 2 maxRegs = 2; rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // and deregister the last one rc = lpf_deregister( lpf, slots[15] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -79,10 +79,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_register_and_deregister_irregularly ) +TEST( API, func_lpf_register_and_deregister_irregularly ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_register_and_deregister_many_global.c b/tests/functional/func_lpf_register_and_deregister_many_global.cpp similarity index 81% rename from tests/functional/func_lpf_register_and_deregister_many_global.c rename to tests/functional/func_lpf_register_and_deregister_many_global.cpp index 851c25e7..8aa2a29e 100644 --- a/tests/functional/func_lpf_register_and_deregister_many_global.c +++ b/tests/functional/func_lpf_register_and_deregister_many_global.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -28,11 +28,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 4 , maxRegs = 4; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); char buffer[8] = "abcd"; lpf_memslot_t slots[4]; @@ -46,18 +46,18 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < maxRegs; ++i) { rc = lpf_register_global( lpf, &buffer[i*2], sizeof(buffer[0])*2, &slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } for ( i = 0 ; i < maxRegs; ++i) { rc = lpf_deregister( lpf, slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -65,10 +65,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_register_and_deregister_many_global ) +TEST( API, func_lpf_register_and_deregister_many_global ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_register_global_parallel_grow.c b/tests/functional/func_lpf_register_global_parallel_grow.cpp similarity index 77% rename from tests/functional/func_lpf_register_global_parallel_grow.c rename to tests/functional/func_lpf_register_global_parallel_grow.cpp index 1c5821fd..641cfe07 100644 --- a/tests/functional/func_lpf_register_global_parallel_grow.c +++ b/tests/functional/func_lpf_register_global_parallel_grow.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -26,11 +26,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 20 , maxRegs = 7; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); char buffer[21] = "Ditiseentestmettandr"; lpf_memslot_t slots[10]; @@ -39,24 +39,24 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < 5; ++i) { rc = lpf_register_global( lpf, &buffer[i*2], sizeof(buffer[0])*2, &slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_resize_memory_register( lpf, maxRegs + 3 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for ( i = 0; i < 5; ++i) { rc = lpf_register_global( lpf, &buffer[(i+5)*2], sizeof(buffer[0])*2, &slots[i+5] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } - EXPECT_STREQ( 20, "Ditiseentestmettandr", buffer ); + EXPECT_STREQ( "Ditiseentestmettandr", buffer ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); for (i = 0; i < 10; ++i) { @@ -66,7 +66,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_STREQ( 20, "DDttsseettssmmttaadd", buffer ); + EXPECT_STREQ( "DDttsseettssmmttaadd", buffer ); for (i = 0; i < 10; ++i) lpf_deregister( lpf, slots[i] ); @@ -77,9 +77,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_register_global_parallel_grow ) +TEST( API, func_lpf_register_global_parallel_grow ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_register_global_parallel_multiple.c b/tests/functional/func_lpf_register_global_parallel_multiple.cpp similarity index 60% rename from tests/functional/func_lpf_register_global_parallel_multiple.c rename to tests/functional/func_lpf_register_global_parallel_multiple.cpp index 515f1f87..1578b837 100644 --- a/tests/functional/func_lpf_register_global_parallel_multiple.c +++ b/tests/functional/func_lpf_register_global_parallel_multiple.cpp @@ -17,12 +17,12 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { (void) args; // ignore args parameter - EXPECT_LT( "%d", (int) pid, (int) nprocs ); + EXPECT_LT( (int) pid, (int) nprocs ); char a[1] = { 'i' }; char b[2] = { 'p', 'q' }; char c[3] = { 'a', 'b', 'c'}; @@ -35,62 +35,62 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_err_t rc = LPF_SUCCESS; rc = lpf_resize_message_queue( lpf, 1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 4); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &a, sizeof(a), &aSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &c, sizeof(c), &cSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &d, sizeof(d), &dSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - - EXPECT_EQ( "%c", 'i', a[0]); - EXPECT_EQ( "%c", 'p', b[0]); - EXPECT_EQ( "%c", 'q', b[1]); - EXPECT_EQ( "%c", 'a', c[0]); - EXPECT_EQ( "%c", 'b', c[1]); - EXPECT_EQ( "%c", 'c', c[2]); - EXPECT_EQ( "%c", 'h', d[0]); - EXPECT_EQ( "%c", 'a', d[1]); - EXPECT_EQ( "%c", 'l', d[2]); - EXPECT_EQ( "%c", 'l', d[3]); - EXPECT_EQ( "%c", 'o', d[4]); - EXPECT_EQ( "%c", '\0', d[5]); + EXPECT_EQ( LPF_SUCCESS, rc ); + + EXPECT_EQ( 'i', a[0]); + EXPECT_EQ( 'p', b[0]); + EXPECT_EQ( 'q', b[1]); + EXPECT_EQ( 'a', c[0]); + EXPECT_EQ( 'b', c[1]); + EXPECT_EQ( 'c', c[2]); + EXPECT_EQ( 'h', d[0]); + EXPECT_EQ( 'a', d[1]); + EXPECT_EQ( 'l', d[2]); + EXPECT_EQ( 'l', d[3]); + EXPECT_EQ( 'o', d[4]); + EXPECT_EQ( '\0', d[5]); if ( 0 == pid ) { rc = lpf_register_local( lpf, &b, sizeof(b), &bSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, bSlot, 1u * sizeof(b[0]), 1u, dSlot, 2u*sizeof(d[0]), sizeof(b[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - - EXPECT_EQ( "%c", 'i', a[0]); - EXPECT_EQ( "%c", 'p', b[0]); - EXPECT_EQ( "%c", 'q', b[1]); - EXPECT_EQ( "%c", 'a', c[0]); - EXPECT_EQ( "%c", 'b', c[1]); - EXPECT_EQ( "%c", 'c', c[2]); - EXPECT_EQ( "%c", 'h', d[0]); - EXPECT_EQ( "%c", 'a', d[1]); - EXPECT_EQ( "%c", pid == 1 ? 'q' : 'l', d[2]); - EXPECT_EQ( "%c", 'l', d[3]); - EXPECT_EQ( "%c", 'o', d[4]); - EXPECT_EQ( "%c", '\0', d[5]); + EXPECT_EQ( LPF_SUCCESS, rc ); + + EXPECT_EQ( 'i', a[0]); + EXPECT_EQ( 'p', b[0]); + EXPECT_EQ( 'q', b[1]); + EXPECT_EQ( 'a', c[0]); + EXPECT_EQ( 'b', c[1]); + EXPECT_EQ( 'c', c[2]); + EXPECT_EQ( 'h', d[0]); + EXPECT_EQ( 'a', d[1]); + EXPECT_EQ( pid == 1 ? 'q' : 'l', d[2]); + EXPECT_EQ( 'l', d[3]); + EXPECT_EQ( 'o', d[4]); + EXPECT_EQ( '\0', d[5]); lpf_deregister( lpf, dSlot ); @@ -104,9 +104,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 2 * \return Exit code: 0 */ -TEST( func_lpf_register_global_parallel_multiple ) +TEST( API, func_lpf_register_global_parallel_multiple ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc); } diff --git a/tests/functional/func_lpf_register_global_parallel_shrink.c b/tests/functional/func_lpf_register_global_parallel_shrink.cpp similarity index 82% rename from tests/functional/func_lpf_register_global_parallel_shrink.c rename to tests/functional/func_lpf_register_global_parallel_shrink.cpp index ec1ac62a..231482de 100644 --- a/tests/functional/func_lpf_register_global_parallel_shrink.c +++ b/tests/functional/func_lpf_register_global_parallel_shrink.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -25,11 +25,11 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 20 , maxRegs = 10; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); char buffer[21] = "Ditiseentestmettandr"; lpf_memslot_t slots[10]; @@ -39,7 +39,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < 10; ++i) { rc = lpf_register_global( lpf, &buffer[i*2], sizeof(buffer[0])*2, &slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } // deregister 4 in an atypical order @@ -49,16 +49,16 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for (i = 0; i < nDelRegs; ++i) { rc = lpf_deregister( lpf, slots[ delRegs[i] ]); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } // reduce by 4 which gets accepted rc = lpf_resize_memory_register( lpf, maxRegs - 4); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_STREQ( 20, "Ditiseentestmettandr", buffer ); + EXPECT_STREQ( "Ditiseentestmettandr", buffer ); // test that the remaining registrations still work size_t k; @@ -80,7 +80,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_STREQ( 20, "Dittsseettstmmttandr", buffer ); + EXPECT_STREQ( "Dittsseettstmmttandr", buffer ); for (i = 0; i < 6; ++i) lpf_deregister( lpf, slots[ otherRegs[i] ]); @@ -91,9 +91,8 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_register_global_parallel_shrink ) +TEST( API, func_lpf_register_global_parallel_shrink ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_register_global_root_multiple.c b/tests/functional/func_lpf_register_global_root_multiple.cpp similarity index 65% rename from tests/functional/func_lpf_register_global_root_multiple.c rename to tests/functional/func_lpf_register_global_root_multiple.cpp index 04c69846..b4287632 100644 --- a/tests/functional/func_lpf_register_global_root_multiple.c +++ b/tests/functional/func_lpf_register_global_root_multiple.cpp @@ -17,14 +17,14 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" /** * \test Test registering two times a global variable. * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_register_global_root_multiple ) +TEST( API, func_lpf_register_global_root_multiple ) { char a[1] = { 'i' }; char b[2] = { 'p', 'q' }; @@ -36,44 +36,43 @@ TEST( func_lpf_register_global_root_multiple ) lpf_err_t rc = LPF_SUCCESS; rc = lpf_resize_message_queue( LPF_ROOT, 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( LPF_ROOT, 3); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( LPF_ROOT, &a, sizeof(a), &aSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( LPF_ROOT, &b, sizeof(b), &bSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( LPF_ROOT, &c, sizeof(c), &cSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%c", 'i', a[0]); - EXPECT_EQ( "%c", 'p', b[0]); - EXPECT_EQ( "%c", 'q', b[1]); - EXPECT_EQ( "%c", 'a', c[0]); - EXPECT_EQ( "%c", 'b', c[1]); - EXPECT_EQ( "%c", 'c', c[2]); + EXPECT_EQ( 'i', a[0]); + EXPECT_EQ( 'p', b[0]); + EXPECT_EQ( 'q', b[1]); + EXPECT_EQ( 'a', c[0]); + EXPECT_EQ( 'b', c[1]); + EXPECT_EQ( 'c', c[2]); rc = lpf_put( LPF_ROOT, bSlot, 1u * sizeof(b[0]), 0u, cSlot, 2u*sizeof(c[0]), sizeof(b[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%c", 'i', a[0]); - EXPECT_EQ( "%c", 'p', b[0]); - EXPECT_EQ( "%c", 'q', b[1]); - EXPECT_EQ( "%c", 'a', c[0]); - EXPECT_EQ( "%c", 'b', c[1]); - EXPECT_EQ( "%c", 'q', c[2]); + EXPECT_EQ( 'i', a[0]); + EXPECT_EQ( 'p', b[0]); + EXPECT_EQ( 'q', b[1]); + EXPECT_EQ( 'a', c[0]); + EXPECT_EQ( 'b', c[1]); + EXPECT_EQ( 'q', c[2]); - return 0; } diff --git a/tests/functional/func_lpf_register_global_root_single.c b/tests/functional/func_lpf_register_global_root_single.cpp similarity index 70% rename from tests/functional/func_lpf_register_global_root_single.c rename to tests/functional/func_lpf_register_global_root_single.cpp index 87514734..f8c93aa7 100644 --- a/tests/functional/func_lpf_register_global_root_single.c +++ b/tests/functional/func_lpf_register_global_root_single.cpp @@ -17,14 +17,14 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" /** * \test Test registering one global variable. * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_register_global_root_single ) +TEST( API, func_lpf_register_global_root_single ) { char a[1] = { 'j' }; char b[2] = { 'a', 'b' }; @@ -33,35 +33,34 @@ TEST( func_lpf_register_global_root_single ) lpf_err_t rc = LPF_SUCCESS; rc = lpf_resize_message_queue( LPF_ROOT, 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( LPF_ROOT, 2); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( LPF_ROOT, &a, sizeof(a), &aSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_local( LPF_ROOT, &b, sizeof(b), &bSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%c", 'j', a[0]); - EXPECT_EQ( "%c", 'a', b[0]); - EXPECT_EQ( "%c", 'b', b[1]); + EXPECT_EQ( 'j', a[0]); + EXPECT_EQ( 'a', b[0]); + EXPECT_EQ( 'b', b[1]); rc = lpf_put( LPF_ROOT, bSlot, 1u * sizeof(b[0]), 0u, aSlot, 0u*sizeof(a[0]), sizeof(a[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%c", 'b', a[0]); - EXPECT_EQ( "%c", 'a', b[0]); - EXPECT_EQ( "%c", 'b', b[1]); + EXPECT_EQ( 'b', a[0]); + EXPECT_EQ( 'a', b[0]); + EXPECT_EQ( 'b', b[1]); - return 0; } diff --git a/tests/functional/func_lpf_register_local_parallel_multiple.c b/tests/functional/func_lpf_register_local_parallel_multiple.cpp similarity index 69% rename from tests/functional/func_lpf_register_local_parallel_multiple.c rename to tests/functional/func_lpf_register_local_parallel_multiple.cpp index 368fbe17..e97a9013 100644 --- a/tests/functional/func_lpf_register_local_parallel_multiple.c +++ b/tests/functional/func_lpf_register_local_parallel_multiple.cpp @@ -17,7 +17,7 @@ #include #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -32,55 +32,55 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) lpf_memslot_t xSlot[10]; lpf_err_t rc = LPF_SUCCESS; - EXPECT_LT( "%u", pid, nprocs ); + EXPECT_LT( pid, nprocs ); rc = lpf_resize_message_queue( lpf, 1); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, 2 + nprocs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_pid_t i; for (i = 0; i < pid; ++i) { int x = 0; rc = lpf_register_local( lpf, &x, sizeof(x)+pid, &xSlot[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_register_global( lpf, &a, sizeof(a), &aSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%c", 'i', a[0]); - EXPECT_EQ( "%c", 'p', b[0]); - EXPECT_EQ( "%c", 'q', b[1]); - EXPECT_EQ( "%c", 'a', c[0]); - EXPECT_EQ( "%c", 'b', c[1]); - EXPECT_EQ( "%c", 'c', c[2]); + EXPECT_EQ( 'i', a[0]); + EXPECT_EQ( 'p', b[0]); + EXPECT_EQ( 'q', b[1]); + EXPECT_EQ( 'a', c[0]); + EXPECT_EQ( 'b', c[1]); + EXPECT_EQ( 'c', c[2]); if ( 1 == pid ) { rc = lpf_register_local( lpf, &c, sizeof(c), &cSlot ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_put( lpf, cSlot, 1u * sizeof(c[0]), 0u, aSlot, 0u*sizeof(a[0]), sizeof(a[0]), LPF_MSG_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_EQ( "%c", 0 == pid ? 'b' : 'i', a[0]); - EXPECT_EQ( "%c", 'p', b[0]); - EXPECT_EQ( "%c", 'q', b[1]); - EXPECT_EQ( "%c", 'a', c[0]); - EXPECT_EQ( "%c", 'b', c[1]); - EXPECT_EQ( "%c", 'c', c[2]); + EXPECT_EQ( 0 == pid ? 'b' : 'i', a[0]); + EXPECT_EQ( 'p', b[0]); + EXPECT_EQ( 'q', b[1]); + EXPECT_EQ( 'a', c[0]); + EXPECT_EQ( 'b', c[1]); + EXPECT_EQ( 'c', c[2]); if ( 1 == pid) lpf_deregister( lpf, cSlot ); lpf_deregister( lpf, aSlot ); @@ -94,8 +94,7 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P <= 10 * \return Exit code: 0 */ -TEST( func_lpf_register_local_parallel_multiple ) +TEST( API, func_lpf_register_local_parallel_multiple ) { lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS); - return 0; } diff --git a/tests/functional/func_lpf_resize_delayed_shrinking_memory_registers.c b/tests/functional/func_lpf_resize_delayed_shrinking_memory_registers.cpp similarity index 77% rename from tests/functional/func_lpf_resize_delayed_shrinking_memory_registers.c rename to tests/functional/func_lpf_resize_delayed_shrinking_memory_registers.cpp index 1ff9ff99..7a94803b 100644 --- a/tests/functional/func_lpf_resize_delayed_shrinking_memory_registers.c +++ b/tests/functional/func_lpf_resize_delayed_shrinking_memory_registers.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -28,13 +28,13 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) size_t maxMsgs = 0 , maxRegs = 16; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - char buffer[16] = "abcdefghijklmnop"; + std::string buffer = "abcdefghijklmnop"; lpf_memslot_t slots[16]; // register 16 entries @@ -42,27 +42,27 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) for ( i = 0; i < 16; ++i) { rc = lpf_register_global( lpf, &buffer[i], sizeof(buffer[i]), &slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // resize to 0 again. maxRegs = 0; rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // deregister all for ( i = 0; i < 16; ++i) { rc = lpf_deregister( lpf, slots[i] ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } /** @@ -70,10 +70,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_resize_delayed_shrinking_memory_registers ) +TEST( API, func_lpf_resize_delayed_shrinking_memory_registers ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_resize_delayed_shrinking_message_queues.c b/tests/functional/func_lpf_resize_delayed_shrinking_message_queues.cpp similarity index 75% rename from tests/functional/func_lpf_resize_delayed_shrinking_message_queues.c rename to tests/functional/func_lpf_resize_delayed_shrinking_message_queues.cpp index 94e2f3e1..ce0bc8c6 100644 --- a/tests/functional/func_lpf_resize_delayed_shrinking_message_queues.c +++ b/tests/functional/func_lpf_resize_delayed_shrinking_message_queues.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) { @@ -29,43 +29,43 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) // reserve space for 16 messages size_t maxMsgs = 32 , maxRegs = 2; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( lpf, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - char buf1[16] = "abcdefghijklmnop"; - char buf2[16] = "ABCDEFGHIJKLMNOP"; + std::string buf1 = "abcdefghijklmnop"; + std::string buf2 = "ABCDEFGHIJKLMNOP"; lpf_memslot_t slot1, slot2; rc = lpf_register_global( lpf, &buf1[0], sizeof(buf1), &slot1 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_register_global( lpf, &buf2[0], sizeof(buf2), &slot2 ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); // resize to 0 messages again. maxMsgs = 0; rc = lpf_resize_message_queue( lpf, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); unsigned i; for ( i = 0; i < 16; ++i ) lpf_put( lpf, slot1, i, (pid + 1 ) % nprocs, slot2, i, 1, LPF_MSG_DEFAULT); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - EXPECT_STREQ( 16, buf2, "abcdefghijklmnop"); + EXPECT_STREQ( buf2.c_str(), "abcdefghijklmnop"); rc = lpf_sync( lpf, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); lpf_deregister( lpf, slot1 ); lpf_deregister( lpf, slot2 ); @@ -76,10 +76,9 @@ void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_resize_delayed_shrinking_message_queues ) +TEST( API, func_lpf_resize_delayed_shrinking_message_queues ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc ); } diff --git a/tests/functional/func_lpf_resize_parallel_five.c b/tests/functional/func_lpf_resize_parallel_five.cpp similarity index 84% rename from tests/functional/func_lpf_resize_parallel_five.c rename to tests/functional/func_lpf_resize_parallel_five.cpp index c0937c51..1af3a131 100644 --- a/tests/functional/func_lpf_resize_parallel_five.c +++ b/tests/functional/func_lpf_resize_parallel_five.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) { @@ -29,12 +29,12 @@ void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) size_t maxMsgs = 5 , maxRegs = 7; rc = lpf_resize_message_queue( ctx, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( ctx, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( ctx, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); } @@ -44,9 +44,8 @@ void spmd( lpf_t ctx, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args ) * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_resize_parallel_five ) +TEST( API, func_lpf_resize_parallel_five ) { lpf_err_t rc = lpf_exec( LPF_ROOT, LPF_MAX_P, &spmd, LPF_NO_ARGS); - EXPECT_EQ( "%d", LPF_SUCCESS, rc); - return 0; + EXPECT_EQ( LPF_SUCCESS, rc); } diff --git a/tests/functional/func_lpf_resize_root_five.c b/tests/functional/func_lpf_resize_root_five.cpp similarity index 84% rename from tests/functional/func_lpf_resize_root_five.c rename to tests/functional/func_lpf_resize_root_five.cpp index bbaea650..7f6cdeea 100644 --- a/tests/functional/func_lpf_resize_root_five.c +++ b/tests/functional/func_lpf_resize_root_five.cpp @@ -16,25 +16,24 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" /** * \test Test lpf_resize function on LPF_ROOT and set maxMsgs to five * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_resize_root_five ) +TEST( API, func_lpf_resize_root_five ) { lpf_err_t rc = LPF_SUCCESS; size_t maxMsgs = 5 , maxRegs = 7; rc = lpf_resize_message_queue( LPF_ROOT, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( LPF_ROOT, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - return 0; } diff --git a/tests/functional/func_lpf_resize_root_outofmem.c b/tests/functional/func_lpf_resize_root_outofmem.cpp similarity index 81% rename from tests/functional/func_lpf_resize_root_outofmem.c rename to tests/functional/func_lpf_resize_root_outofmem.cpp index 7c15ccc3..8cd13358 100644 --- a/tests/functional/func_lpf_resize_root_outofmem.c +++ b/tests/functional/func_lpf_resize_root_outofmem.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" @@ -25,25 +25,24 @@ * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_resize_root_outofmem ) +TEST( API, func_lpf_resize_root_outofmem ) { lpf_err_t rc = LPF_SUCCESS; size_t maxMsgs = ((size_t) -1)/10 ; size_t maxRegs = ((size_t) -1)/10; rc = lpf_resize_message_queue( LPF_ROOT, maxMsgs); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY, rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY, rc ); rc = lpf_resize_memory_register( LPF_ROOT, maxRegs ); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY, rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY, rc ); maxMsgs = -1; maxRegs = -1; rc = lpf_resize_message_queue( LPF_ROOT, maxMsgs); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY, rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY, rc ); rc = lpf_resize_memory_register( LPF_ROOT, maxRegs ); - EXPECT_EQ( "%d", LPF_ERR_OUT_OF_MEMORY, rc ); + EXPECT_EQ( LPF_ERR_OUT_OF_MEMORY, rc ); - return 0; } diff --git a/tests/functional/func_lpf_resize_root_zero.c b/tests/functional/func_lpf_resize_root_zero.cpp similarity index 84% rename from tests/functional/func_lpf_resize_root_zero.c rename to tests/functional/func_lpf_resize_root_zero.cpp index 55585084..5bd2bedc 100644 --- a/tests/functional/func_lpf_resize_root_zero.c +++ b/tests/functional/func_lpf_resize_root_zero.cpp @@ -16,24 +16,23 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" /** * \test Test lpf_resize function on LPF_ROOT allocating nothing * \pre P >= 1 * \return Exit code: 0 */ -TEST( func_lpf_resize_root_zero ) +TEST( API, func_lpf_resize_root_zero ) { lpf_err_t rc = LPF_SUCCESS; size_t maxMsgs = 0 , maxRegs = 0; rc = lpf_resize_message_queue( LPF_ROOT, maxMsgs); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_resize_memory_register( LPF_ROOT, maxRegs ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); rc = lpf_sync( LPF_ROOT, LPF_SYNC_DEFAULT ); - EXPECT_EQ( "%d", LPF_SUCCESS, rc ); + EXPECT_EQ( LPF_SUCCESS, rc ); - return 0; } diff --git a/tests/functional/macro_LPF_VERSION.c b/tests/functional/macro_LPF_VERSION.cpp similarity index 90% rename from tests/functional/macro_LPF_VERSION.c rename to tests/functional/macro_LPF_VERSION.cpp index 4527d24d..7588aeea 100644 --- a/tests/functional/macro_LPF_VERSION.c +++ b/tests/functional/macro_LPF_VERSION.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" #ifdef _LPF_VERSION #if _LPF_VERSION == 202000L @@ -33,8 +33,7 @@ * \pre P >= 1 * \return Exit code: 0 */ -TEST( macro_LPF_VERSION ) +TEST( API, macro_LPF_VERSION ) { - EXPECT_EQ( "%ld", 202000L, _LPF_VERSION ); - return 0; + EXPECT_EQ( 202000L, _LPF_VERSION ); } diff --git a/tests/functional/run.sh b/tests/functional/run.sh deleted file mode 100755 index 3af01b5c..00000000 --- a/tests/functional/run.sh +++ /dev/null @@ -1,299 +0,0 @@ -#!/bin/bash - -# -# Copyright 2021 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -shopt -s extglob - -builddir=`pwd` -dir=`dirname $0` -defaultMaxProcs=5 -defaultNodes=2 # This makes the hybrid implementation sensitive to errors -intermOutput=output -lpf_impl_id=$1 -lpf_impl_config=$2 -log=tests-${lpf_impl_id}-${lpf_impl_config}.log -junitfile=$3 -loglevel=1 -shift -shift -shift - -function get() -{ - sed -ne 's/.*\\'"$1"'[[:space:]]*\(.*\)$/\1/p' -} - -function log -{ - echo "$@" | tee -a $log -} - -if [ `uname` = Darwin ]; then - # Non GNU date can't print nanoseconds - function getTime() - { - date +%s - } - - function nproc() { - /usr/sbin/sysctl -o machdep.cpu.core_count | sed -e 's/.*://' - } -else - function getTime() - { - date +%s.%N - } - - if which nproc; then - nproc_exe=`which nproc` - function nproc() { - $nproc_exe - } - else - function nproc() { - echo $defaultMaxProcs - } - fi -fi - -# Adjust default max number of processes -if [ `nproc` -lt $defaultMaxProcs ]; then - defaultMaxProcs=`nproc` -fi - -# Some systems don't have DC calculator -echo | dc -if [ $? -ne 0 ]; then - # define a dummy implementation, because it is only used to report - # the time needed by every test - function dc() { - echo 0 - } -fi - - -function lpfrun -{ - bash ../../lpfrun_build "$@" -} - -XUNIT_TESTS=0 -XUNIT_FAILURES=0 -XUNIT_ERRORS=0 -XUNIT_TOTALTIME=0 -rm -f ${junitfile} ${junitfile}.txt - -if [ `uname` = Darwin ]; then - function junit - { - return - } -else - - function junit - { - case $1 in - add) name=$2 - success=$3 - t=$4 - shift - shift - shift - shift - - - XUNIT_TESTS=$((XUNIT_TESTS + 1)) - XUNIT_TOTALTIME=$( (echo $XUNIT_TOTALTIME; echo $t; echo '+'; echo 'p') | dc ) - echo "" >> ${junitfile}.txt - if [ $success -eq 0 ]; then - XUNIT_FAILURES=$((XUNIT_FAILURES + 1)) - echo "> ${junitfile}.txt - cat >> ${junitfile}.txt - echo "]]>" >> ${junitfile}.txt - fi - echo "" >> ${junitfile}.txt - ;; - - - write) echo "" > $junitfile - echo "" >> $junitfile - echo "" >> $junitfile - cat ${junitfile}.txt >> $junitfile - echo "" >> $junitfile - ;; - esac - - } -fi - -rm -f $log -log "============================================================================" -log "RUNNING LPF API TESTS" -allSuccess=1 -suffix="_${lpf_impl_id}_${lpf_impl_config}" -for testexe in $(find . -name "*${suffix}" -or -name "*${suffix}_debug") -do - testname=${testexe%_debug} - if [ "x${testname}" != "x${testexe}" ] ; then - mode=debug; - else - mode=default; - fi - - testname=$(basename ${testname%${suffix}}) - testCase=$(find $dir -name "${testname}.c" -or -name "${testname}.${lpf_impl_id}.c") - description=`get 'test' < $testCase` - message=`get 'return Message:' < $testCase` - exitCode=`get 'return Exit code:' < $testCase` - minProcs=`get 'pre[[:space:]]*P >=' < $testCase` - maxProcs=`get 'pre[[:space:]]*P <=' < $testCase` - extraParams=`get 'note Extra lpfrun parameters:' < $testCase` - indepProcs=`get 'note Independent processes:' < $testCase` - - if echo "${testexe}" | grep -qf $dir/exception_list ; then - log "----------------------------------------------------------------------------" - log " IGNORING: $testname" - log " Description: $description" - continue - fi - - if [ x$testname = x ]; then - log "Warning: Can't read testname from $testCase. Test case skipped" ; - allSuccess=0; - continue - fi - if [ x$exitCode = x ]; then - log "Error: Can't read expected exit code from $testCase. Test case skipped" ; - allSuccess=0; - continue - fi - if [ '!' '(' $exitCode -ge 0 ')' ]; then - log "Error: Can't read expected exit code from $testCase. Test case skipped" ; - allSuccess=0; - continue - fi - if [ x$minProcs = x ]; then - log "Error: Can't determine lower bound of processes for $testCase. Test case skipped" ; - allSuccess=0; - continue - fi - if [ '!' '(' $minProcs -ge 1 ')' ]; then - log "Error: Lower bound of processes is illegal for test case $testCase. Test case skipped" ; - allSuccess=0; - continue - fi - if [ x$maxProcs = x ]; then - maxProcs=$defaultMaxProcs - fi - if [ '!' '(' $maxProcs -ge 1 ')' ]; then - log "Error: Upper bound of processes is illegal for test case $testCase. Test case skipped" - allSuccess=0; - continue - fi - - if [ x$indepProcs '!=' xyes ]; then - indepProcs=no - fi - - log "----------------------------------------------------------------------------" - log " RUNNING: $testname ( $mode )" - log " Description: $description" - log " Number of processes: $minProcs - $maxProcs" - log " Engine: $lpf_impl_id" - log " Configuration: $lpf_impl_config" - log " Extra lpfrun params: $extraParams" - log " Independent processes: $indepProcs" - log - -#$lpfcc $testCase -o ${testname}.exe -Wall -Wextra >> $log 2>&1 -# compilation=$? - -# if [ '!' $compilation -eq 0 ]; then -# log " TEST FAILURE: Failed to compile $testCase" -# allSuccess=0; -# continue -# fi - - setSuccess=1 - for (( processes=$minProcs; processes <= $maxProcs; ++processes )) - do - success=1 - t0=`getTime` - if [ $indepProcs = no ]; then - # The normal way of running a test - - lpfrun -engine $lpf_impl_id -log $loglevel \ - -n $processes -N $defaultNodes ${extraParams} \ - "$@" ./${testexe} > $intermOutput 2>&1 - actualExitCode=$? - else - # this way of running processes is required to test implementation of - # lpf_hook on MPI implementations - - rm $intermOutput - touch $intermOutput - for (( p = 0; p < processes; ++p )) - do - lpfrun -engine $lpf_impl_id -log $loglevel -np 1 ${extraParams} "$@" \ - ./${testexe} $p ${processes} >> $intermOutput 2>&1 & - done - wait `jobs -p` - actualExitCode=$? - fi - t1=`getTime` - t=$( ( echo $t1 ; echo $t0; echo "-"; echo "p" ) | dc ) - - cat $intermOutput >> $log - # NOTE: Only two exit codes are recognized: failure and success. That's because most - # MPI implementations mangle the exit code. - msg= - if [ \( $actualExitCode -eq 0 -a $exitCode -ne 0 \) -o \ - \( $actualExitCode -ne 0 -a $exitCode -eq 0 \) ]; then - msg=" TEST FAILURE: Expected exit code $exitCode does not match actual exit code $actualExitCode for $testCase on $processes processes" - log "$msg" - allSuccess=0; - setSuccess=0 - success=0 - fi - if [ "x$message" != x ]; then - if grep -q "$message" $intermOutput ; then - let noop=0; - else - msg=" TEST FAILURE: Expected messages does not match for $testCase on $processes processes" - log "$msg" - allSuccess=0 - setSuccess=0 - success=0 - fi - fi - junit add "$testname.$processes" $success $t "$msg" < $intermOutput - done - if [ $setSuccess -eq 1 ]; then - log "TEST SUCCESS" - fi -done - -junit write - -log "----------------------------------------------------------------------------" -if [ $allSuccess -eq 0 ]; then - log "ONE OR MORE TEST FAILURES" - exit 1 -else - log "ALL TESTS SUCCESSFUL" - exit 0 -fi diff --git a/tests/functional/type_lpf_spmd_t.c b/tests/functional/type_lpf_spmd_t.cpp similarity index 86% rename from tests/functional/type_lpf_spmd_t.c rename to tests/functional/type_lpf_spmd_t.cpp index adb8e0c5..e800dc62 100644 --- a/tests/functional/type_lpf_spmd_t.c +++ b/tests/functional/type_lpf_spmd_t.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" void test_spmd( const lpf_t lpf, const lpf_pid_t pid, const lpf_pid_t nprocs, const lpf_args_t args) { @@ -37,7 +37,7 @@ lpf_spmd_t var_c = & test_spmd; * \pre P >= 1 * \return Exit code: 0 */ -TEST( type_lpf_spmd_t ) +TEST( API, type_lpf_spmd_t ) { lpf_spmd_t var_d = NULL; lpf_spmd_t var_e = & test_spmd; @@ -48,8 +48,7 @@ TEST( type_lpf_spmd_t ) lpf_args_t e; (*var_e)(a, b, c, e); - EXPECT_EQ( "%p", (lpf_spmd_t) NULL, var_b ); - EXPECT_EQ( "%p", &test_spmd, var_e ); - EXPECT_EQ( "%p", (lpf_spmd_t) NULL, var_d ); - return 0; + EXPECT_EQ( (lpf_spmd_t) NULL, var_b ); + EXPECT_EQ( &test_spmd, var_e ); + EXPECT_EQ( (lpf_spmd_t) NULL, var_d ); } diff --git a/tests/functional/type_lpf_t.c b/tests/functional/type_lpf_t.cpp similarity index 82% rename from tests/functional/type_lpf_t.c rename to tests/functional/type_lpf_t.cpp index 91353605..3c24afbd 100644 --- a/tests/functional/type_lpf_t.c +++ b/tests/functional/type_lpf_t.cpp @@ -16,7 +16,7 @@ */ #include -#include "Test.h" +#include "gtest/gtest.h" /** @@ -24,7 +24,7 @@ * \pre P >= 1 * \return Exit code: 0 */ -TEST( type_lpf_t ) +TEST( API, type_lpf_t ) { lpf_t var_d = NULL; @@ -34,8 +34,7 @@ TEST( type_lpf_t ) lpf_t var_e = y; y = var_d; - EXPECT_EQ( "%ld", sizeof(lpf_t), sizeof(void *)); - EXPECT_EQ( "%p", NULL, y ); - EXPECT_EQ( "%p", (lpf_t) &x, var_e ); - return 0; + EXPECT_EQ( sizeof(lpf_t), sizeof(void *)); + EXPECT_EQ( NULL, y ); + EXPECT_EQ( (lpf_t) &x, var_e ); }