From 8565d41d7b187f6ad445a2109ca52fa1a56fe83e Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 29 Dec 2019 05:01:18 -0600 Subject: [PATCH] adding C test Change-Id: I006130d6711fd8e7bb222b985e4c64a801825f41 --- test/CMakeLists.txt | 10 +++++++--- test/app/c_test.c | 25 +++++++++++++++++++++++++ test/run.sh | 22 ++++++++++------------ 3 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 test/app/c_test.c diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 72708d7d30..fa6b275909 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,6 +32,10 @@ if ( NOT DEFINED TEST_DIR ) include ( env ) endif () +## C test +add_executable ( "c_test" ${TEST_DIR}/app/c_test.c ) +target_include_directories ( "c_test" PRIVATE ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} ) + ## Util sources file( GLOB UTIL_SRC "${TEST_DIR}/util/*.cpp" ) @@ -67,17 +71,17 @@ execute_process ( COMMAND sh -xc "${TEST_DIR}/../bin/build_kernel.sh ${TEST_DIR} ## Building standalone test executable add_executable ( ${STEXE_NAME} ${STTST_SRC} ${UTIL_SRC} ${KERN_SRC} ) target_include_directories ( ${STEXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} ) -target_link_libraries( ${STEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt ) +target_link_libraries ( ${STEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt ) ## Building intercept test executable add_library ( ${INEXE_NAME} SHARED ${INTST_SRC} ${UTIL_SRC} ${KERN_SRC} ) target_include_directories ( ${INEXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} ) -target_link_libraries( ${INEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt ) +target_link_libraries ( ${INEXE_NAME} ${ROCPROFILER_TARGET} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt ) ## Building ctrl test executable add_executable ( ${EXE_NAME} ${CTRL_SRC} ${UTIL_SRC} ${KERN_SRC} ) target_include_directories ( ${EXE_NAME} PRIVATE ${TEST_DIR} ${ROOT_DIR} ${HSA_RUNTIME_INC_PATH} ) -target_link_libraries( ${EXE_NAME} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt ) +target_link_libraries ( ${EXE_NAME} ${HSA_RUNTIME_LIB} ${HSA_KMT_LIB} c stdc++ dl pthread rt ) execute_process ( COMMAND sh -xc "cp ${TEST_DIR}/run.sh ${PROJECT_BINARY_DIR}" ) execute_process ( COMMAND sh -xc "cp ${TEST_DIR}/tool/*.xml ${PROJECT_BINARY_DIR}" ) execute_process ( COMMAND sh -xc "mkdir -p ${PROJECT_BINARY_DIR}/RESULTS" ) diff --git a/test/app/c_test.c b/test/app/c_test.c new file mode 100644 index 0000000000..70c6d30627 --- /dev/null +++ b/test/app/c_test.c @@ -0,0 +1,25 @@ +/****************************************************************************** +Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*******************************************************************************/ + +#include "inc/rocprofiler.h" +const int ret = 0; +int main() { return ret; } diff --git a/test/run.sh b/test/run.sh index 437db01ed0..84965ac31f 100755 --- a/test/run.sh +++ b/test/run.sh @@ -56,8 +56,6 @@ eval_test() { export HSA_TOOLS_REPORT_LOAD_FAILURE=1 # paths to ROC profiler and oher libraries export LD_LIBRARY_PATH=$PWD -# ROC profiler library loaded by HSA runtime -export HSA_TOOLS_LIB=librocprofiler64.so # enable error messages logging to '/tmp/rocprofiler_log.txt' export ROCPROFILER_LOG=1 # ROC profiler metrics config file @@ -67,8 +65,17 @@ export ROCP_METRICS=metrics.xml # test trace export ROC_TEST_TRACE=1 -## Intercepting usage model test +## C test +eval_test "C test" ./test/c_test +## Standalone sampling usage model test +unset HSA_TOOLS_LIB +unset ROCP_TOOL_LIB +eval_test "Standalone sampling usage model test" ./test/standalone_test + +## Intercepting usage model test +# ROC profiler library loaded by HSA runtime +export HSA_TOOLS_LIB=librocprofiler64.so # tool library loaded by ROC profiler export ROCP_TOOL_LIB=./test/libintercept_test.so export ROCP_KITER=50 @@ -77,13 +84,7 @@ export ROCP_AGENTS=1 export ROCP_THRS=3 eval_test "Intercepting usage model test" "../bin/run_tool.sh ./test/ctrl" -## Standalone sampling usage model test - -unset ROCP_TOOL_LIB -eval_test "Standalone sampling usage model test" ./test/standalone_test - ## Libtool test - # tool library loaded by ROC profiler export ROCP_TOOL_LIB=libtool.so # ROC profiler kernels timing @@ -111,7 +112,6 @@ export ROCP_INPUT=input1.xml eval_test "'rocprof' libtool test n-threads" ./test/ctrl ## SPM test - export ROCP_KITER=3 export ROCP_DITER=3 export ROCP_AGENTS=1 @@ -120,7 +120,6 @@ export ROCP_INPUT=spm_input.xml eval_test "libtool test, SPM trace test" ./test/ctrl ## Libtool test, counter sets - # Memcopies tracking export ROCP_MCOPY_TRACKING=1 @@ -130,7 +129,6 @@ export ROCP_INPUT=input2.xml eval_test "libtool test, counter sets" ./test/ctrl ## OpenCL test - export ROCP_OBJ_TRACKING=1 export ROCP_INPUT=input1.xml eval_test "libtool test, OpenCL sample" ./test/ocl/SimpleConvolution