diff --git a/projects/rocshmem/scripts/build_configs/dc_multi b/projects/rocshmem/scripts/build_configs/dc_multi index 9511b27aad..4e806e7f85 100755 --- a/projects/rocshmem/scripts/build_configs/dc_multi +++ b/projects/rocshmem/scripts/build_configs/dc_multi @@ -1,6 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. - +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/dc_multi_debug b/projects/rocshmem/scripts/build_configs/dc_multi_debug index 8b884f87ce..e95ed54a6a 100755 --- a/projects/rocshmem/scripts/build_configs/dc_multi_debug +++ b/projects/rocshmem/scripts/build_configs/dc_multi_debug @@ -1,6 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. - +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/dc_multi_ipc b/projects/rocshmem/scripts/build_configs/dc_multi_ipc index 82f99ec4a3..a154f34667 100755 --- a/projects/rocshmem/scripts/build_configs/dc_multi_ipc +++ b/projects/rocshmem/scripts/build_configs/dc_multi_ipc @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/dc_multi_profile b/projects/rocshmem/scripts/build_configs/dc_multi_profile index 1477115d55..37954c8342 100755 --- a/projects/rocshmem/scripts/build_configs/dc_multi_profile +++ b/projects/rocshmem/scripts/build_configs/dc_multi_profile @@ -1,6 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. - +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/dc_single b/projects/rocshmem/scripts/build_configs/dc_single index 46c5226bd2..1cc14f71ef 100755 --- a/projects/rocshmem/scripts/build_configs/dc_single +++ b/projects/rocshmem/scripts/build_configs/dc_single @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/ipc_single b/projects/rocshmem/scripts/build_configs/ipc_single index d0c43b9231..c1ade33baa 100755 --- a/projects/rocshmem/scripts/build_configs/ipc_single +++ b/projects/rocshmem/scripts/build_configs/ipc_single @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_multi b/projects/rocshmem/scripts/build_configs/rc_multi index 797ad6db92..f38514dea7 100755 --- a/projects/rocshmem/scripts/build_configs/rc_multi +++ b/projects/rocshmem/scripts/build_configs/rc_multi @@ -1,6 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. - +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_multi_debug b/projects/rocshmem/scripts/build_configs/rc_multi_debug index 1d103b0cb7..8937d426ea 100755 --- a/projects/rocshmem/scripts/build_configs/rc_multi_debug +++ b/projects/rocshmem/scripts/build_configs/rc_multi_debug @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_multi_wf_coal b/projects/rocshmem/scripts/build_configs/rc_multi_wf_coal index c8845e7608..cfa1acaf90 100755 --- a/projects/rocshmem/scripts/build_configs/rc_multi_wf_coal +++ b/projects/rocshmem/scripts/build_configs/rc_multi_wf_coal @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single b/projects/rocshmem/scripts/build_configs/rc_single index aceca7dbed..ad378880e1 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single +++ b/projects/rocshmem/scripts/build_configs/rc_single @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single_debug b/projects/rocshmem/scripts/build_configs/rc_single_debug index 99dbd61a97..cf75f64819 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single_debug +++ b/projects/rocshmem/scripts/build_configs/rc_single_debug @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single_managed b/projects/rocshmem/scripts/build_configs/rc_single_managed index a7b94b379e..963fe7260b 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single_managed +++ b/projects/rocshmem/scripts/build_configs/rc_single_managed @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single_managed_debug b/projects/rocshmem/scripts/build_configs/rc_single_managed_debug index 2873c1fb4c..fd74cf904e 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single_managed_debug +++ b/projects/rocshmem/scripts/build_configs/rc_single_managed_debug @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single_profile b/projects/rocshmem/scripts/build_configs/rc_single_profile index 281ea297f7..ff6c0194f6 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single_profile +++ b/projects/rocshmem/scripts/build_configs/rc_single_profile @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single_single_node b/projects/rocshmem/scripts/build_configs/rc_single_single_node index a5223c379f..4f1c56f79a 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single_single_node +++ b/projects/rocshmem/scripts/build_configs/rc_single_single_node @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/rc_single_single_node_debug b/projects/rocshmem/scripts/build_configs/rc_single_single_node_debug index c4e2477da9..60292ca594 100755 --- a/projects/rocshmem/scripts/build_configs/rc_single_single_node_debug +++ b/projects/rocshmem/scripts/build_configs/rc_single_single_node_debug @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/ro_ipc b/projects/rocshmem/scripts/build_configs/ro_ipc index d57404b88c..0d07b18af3 100755 --- a/projects/rocshmem/scripts/build_configs/ro_ipc +++ b/projects/rocshmem/scripts/build_configs/ro_ipc @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/ro_net b/projects/rocshmem/scripts/build_configs/ro_net index 95ea2950a8..8a6de89ba4 100755 --- a/projects/rocshmem/scripts/build_configs/ro_net +++ b/projects/rocshmem/scripts/build_configs/ro_net @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/build_configs/ro_net_debug b/projects/rocshmem/scripts/build_configs/ro_net_debug index c2b8afdc00..8468dead93 100755 --- a/projects/rocshmem/scripts/build_configs/ro_net_debug +++ b/projects/rocshmem/scripts/build_configs/ro_net_debug @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. +set -e if [ -z $1 ] then diff --git a/projects/rocshmem/scripts/functional_tests/driver.sh b/projects/rocshmem/scripts/functional_tests/driver.sh index e0e0d45fa6..5fa93051ef 100755 --- a/projects/rocshmem/scripts/functional_tests/driver.sh +++ b/projects/rocshmem/scripts/functional_tests/driver.sh @@ -20,6 +20,8 @@ #!/bin/bash +driver_return_status=0 + if [ $# -eq 0 ] ; then echo "This script must be run with at least 2 arguments." echo 'Usage: ${0} argument1 argument2 [argument3]' @@ -35,6 +37,7 @@ check() { if [ $? -ne 0 ] then echo "Failed $1" >&2 + driver_return_status=1 fi } @@ -579,4 +582,4 @@ case $2 in ;; esac -exit $? +exit $(($driver_return_status || $?)) diff --git a/projects/rocshmem/scripts/unit_tests/driver.sh b/projects/rocshmem/scripts/unit_tests/driver.sh index 8eea7daef7..64d7b558d5 100755 --- a/projects/rocshmem/scripts/unit_tests/driver.sh +++ b/projects/rocshmem/scripts/unit_tests/driver.sh @@ -16,13 +16,14 @@ function display_help { } # Validate number of arguments for each mode -if [[ "$#" -lt 2 ]] || +if [[ "$#" -lt 2 ]] || { [[ "$2" == "all" ]] && [[ "$#" -ne 2 ]]; } || { [[ "$2" == "custom" ]] && [[ "$#" -ne 4 ]]; }; then display_help exit 1 fi +driver_return_status=0 binary_name=$1 mode=$2 timestamp=$(date "+%Y-%m-%d-%H:%M:%S") @@ -32,15 +33,24 @@ log_file="unit_tests_${timestamp}.log" function run_mpirun { local np=$1 local gtest_filter=$2 - echo "mpirun -np $np $binary_name --gtest_filter='$gtest_filter'" | tee -a "$log_file" - mpirun -np "$np" "$binary_name" --gtest_filter="$gtest_filter" >> "$log_file" 2>&1 + cmd_str="mpirun -np $np $binary_name --gtest_filter=$gtest_filter >> $log_file 2>&1" + echo $cmd_str + eval $cmd_str + + # Test if mpirun failed + if [ $? -ne 0 ] + then + echo "FAILED: $cmd_str" >&2 + cat $log_file + driver_return_status=1 + fi } # Processing modes case $mode in all) - run_mpirun 4 "-IPCImplSimpleCoarseTestFixture.*:IPCImplSimpleFineTestFixture.*" - run_mpirun 2 "IPCImplSimpleCoarseTestFixture.*:IPCImplSimpleFineTestFixture.*" + run_mpirun 4 "-IPCImplSimpleCoarseTestFixture/*:IPCImplSimpleFineTestFixture.*" + run_mpirun 2 "IPCImplSimpleCoarseTestFixture/*:IPCImplSimpleFineTestFixture.*" ;; custom) # Check if ranks is a positive integer @@ -60,3 +70,4 @@ esac echo "Tests Completed" echo "log file: '$log_file'" +exit $driver_return_status diff --git a/projects/rocshmem/tests/unit_tests/CMakeLists.txt b/projects/rocshmem/tests/unit_tests/CMakeLists.txt index b47da1c154..568b156fd2 100644 --- a/projects/rocshmem/tests/unit_tests/CMakeLists.txt +++ b/projects/rocshmem/tests/unit_tests/CMakeLists.txt @@ -115,6 +115,10 @@ target_link_libraries( ############################################################################### # GTEST DEPENDENCY ############################################################################### +# These packages are required for the unit tests +find_package(rocprim REQUIRED CONFIG PATHS "${ROCM_PATH}/include/rocprim") +find_package(rocthrust REQUIRED CONFIG PATHS "${ROCM_PATH}/include/rocthrust") + include(FetchContent) FetchContent_Declare( @@ -135,4 +139,5 @@ target_link_libraries( PRIVATE gtest gtest_main + roc::rocthrust )