From 0e4f0e66fdc8eace5810c370813ce48d3b3aea59 Mon Sep 17 00:00:00 2001 From: yangbinfa Date: Tue, 31 Dec 2024 15:49:57 +0800 Subject: [PATCH] [OpenMP]Enable the execution of OMPT-related test cases on remote targets under static linking conditions. Issue:https://gitee.com/openharmony/third_party_llvm-project/issues/IBET5U?from=project-issue Description:(1) Add an environment variable to allow selecting static linking of the OMP library during test cases compilation. (2)Add specific substitutions to enable some OMPT test cases to run on the target platform. Signed-off-by: yangbinfa --- openmp/runtime/test/lit.cfg | 43 +++++++++++++++--- .../loadtool/tool_available/tool_available.c | 45 +++++++++---------- .../tool_available_search.c | 12 ++--- .../tool_not_available/tool_not_available.c | 28 ++++++------ .../test/tasking/omp50_taskdep_depobj.c | 2 +- .../custom_data_storage/custom_data_storage.c | 42 ++++++++--------- openmp/tools/multiplex/tests/lit.cfg | 28 ++++++++++-- openmp/tools/multiplex/tests/print/print.c | 40 ++++++++--------- 8 files changed, 147 insertions(+), 93 deletions(-) diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg index d4507c06d865..739eb9dbccd3 100644 --- a/openmp/runtime/test/lit.cfg +++ b/openmp/runtime/test/lit.cfg @@ -54,7 +54,8 @@ config.test_flags_use_compiler_omp_h = flags # OHOS LOCAL if config.operating_system == 'OHOS': config.test_flags += " --target=aarch64-linux-ohos" - + if os.environ.get('OPENMP_STATIC_TEST') != None and os.environ.get('OPENMP_STATIC_TEST') == "True" : + config.test_flags += " -static-openmp " # extra libraries libs = "" if config.has_libm: @@ -140,24 +141,54 @@ config.substitutions.append(("%libomp-c99-compile", \ # OHOS_LOCAL begin if config.operating_system == 'OHOS': - # Settings required to run test cases remotely on OHOS + # Settings required to run test cases remotely on OHOS + + # specific substitutions for ompt/loadtool/tool_available.c + config.substitutions.append(("%send-libtool", "&& %target-send %T/libtool.so %tool-path/libtool.so")) + config.substitutions.append(("%recv-log", "&& %target-recv %tool-path/init.log %T/init.log")) + # specific substitutions for ompt/loadtool/tool_not_available.c + config.substitutions.append(("%send-libntool", "&& %target-send %T/libntool.so %tool-path/libntool.so")) + # specific substitutions for ompt/loadtool/tool_available_serach.c + config.substitutions.append(("%send-first_tool", "&& %target-send %T/first_tool.so %tool-path/first_tool.so")) + config.substitutions.append(("%send-second_tool", "&& %target-send %T/second_tool.so %tool-path/second_tool.so")) + config.substitutions.append(("%send-third_tool", "&& %target-send %T/third_tool.so %tool-path/third_tool.so")) + + config.substitutions.append(("%tool-path", "%root-path/lib")) + + # HDC releated if not (config.environment.get('HDC') != None and config.environment.get('HDC_SERVER') != None and config.environment.get('HDC_TARGET_SERIAL') != None and config.environment.get('LIB_PATH_ON_TARGET') != None): raise ValueError("Error: One or more environment variables in HDC, HDC_SERVER, HDC_TARGET_SERIAL or LIB_PATH_ON_TARGET are not set.") hdc = f"{config.environment['HDC']} -s {config.environment['HDC_SERVER']} -t {config.environment['HDC_TARGET_SERIAL']}" - cmd_set_ld_library_path = f"env LD_LIBRARY_PATH={config.environment['LIB_PATH_ON_TARGET']}:$LD_LIBRARY_PATH" + cmd_set_ld_library_path = f"env LD_LIBRARY_PATH=%root-path/lib:$LD_LIBRARY_PATH" cmd_mkdir_to_device = f"{hdc} shell mkdir -p /data/local/temp/$(dirname %t)" cmd_push_to_device = f"{hdc} file send %t %root-path%t" cmd_chmod_to_test = f"{hdc} shell chmod 755 %root-path%t" cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) - config.substitutions.append(("%root-path", "/data/local/temp")) - config.substitutions.append(("%platform-flag", "KMP_WARNINGS=false")) -# OHOS_LOCAL end + config.substitutions.append(("%target-send", f"{hdc} file send")) + config.substitutions.append(("%target-recv", f"{hdc} file recv")) + config.substitutions.append(("%root-path", "/data/local/temp")) + config.substitutions.append(("%platform-flag", "KMP_WARNINGS=false")) + config.substitutions.append(("%ohos_target_flag", "--target=aarch64-linux-ohos")) + config.substitutions.append(("%redirect2to1", "'2>&1'")) + config.substitutions.append(("%redirect1tonull", "'> /dev/null'")) + else: + config.substitutions.append(("%send-libtool", "")) + config.substitutions.append(("%send-libntool", "")) + config.substitutions.append(("%send-first_tool", "")) + config.substitutions.append(("%send-second_tool", "")) + config.substitutions.append(("%send-third_tool", "")) + config.substitutions.append(("%recv-log", "")) config.substitutions.append(("%libomp-run", "%t")) config.substitutions.append(("%platform-flag", "")) + config.substitutions.append(("%ohos_target_flag", "")) + config.substitutions.append(("%tool-path", "%T")) + config.substitutions.append(("%redirect2to1", "2>&1")) + config.substitutions.append(("%redirect1tonull", "> /dev/null")) +# OHOS_LOCAL end config.substitutions.append(("%clangXX", config.test_cxx_compiler)) config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flags", config.test_openmp_flags)) diff --git a/openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c b/openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c index ba6ce32b921e..734c0ed2cfb1 100644 --- a/openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c +++ b/openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c @@ -9,27 +9,27 @@ // Note: We should compile the tool without -fopenmp as other tools developer // would do. Otherwise this test may pass for the wrong reasons on Darwin. -// RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/tool.so +// RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/libtool.so %send-libtool // 2. "introducing a dynamically-linked library that includes the tool’s // definition of ompt_start_tool into the application’s address space" // 2.1 Link with tool during compilation -// RUN: %libomp-compile -DCODE %no-as-needed-flag %T/tool.so && \ -// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s \ +// RUN: %libomp-compile -DCODE -L%T %no-as-needed-flag -ltool && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%tool-path %libomp-run | FileCheck %s \ // RUN: --check-prefixes CHECK,ADDRSPACE // 2.2 Link with tool during compilation, but AFTER the runtime -// RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %T/tool.so && \ -// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s \ +// RUN: %libomp-compile -DCODE -L%T -lomp %no-as-needed-flag -ltool && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%tool-path %libomp-run | FileCheck %s \ // RUN: --check-prefixes CHECK,ADDRSPACE // 2.3 Inject tool via the dynamic loader // RUN: %libomp-compile -DCODE && env OMP_TOOL_VERBOSE_INIT=stdout \ -// RUN: %preload-tool %libomp-run | FileCheck %s \ +// RUN: env LD_PRELOAD=%tool-path/libtool.so %libomp-run | FileCheck %s \ // RUN: --check-prefixes CHECK,ADDRSPACE // 3. "providing the name of a dynamically-linked library appropriate for the @@ -39,37 +39,36 @@ // 3.1 OMP_TOOL_VERBOSE_INIT not set // RUN: %libomp-compile -DCODE && \ -// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so %libomp-run | FileCheck %s +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/libtool.so %libomp-run | FileCheck %s // 3.2 OMP_TOOL_VERBOSE_INIT disabled -// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=disabled \ +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/libtool.so OMP_TOOL_VERBOSE_INIT=disabled \ // RUN: %libomp-run | FileCheck %s // 3.3 OMP_TOOL_VERBOSE_INIT to stdout -// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/tool.so \ +// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%tool-path/libtool.so \ // RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ -// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes CHECK,TOOLLIB +// RUN: FileCheck %s -DPARENTPATH=%tool-path --check-prefixes CHECK,TOOLLIB // 3.4 OMP_TOOL_VERBOSE_INIT to stderr, check merged stdout and stderr -// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=stderr \ -// RUN: %libomp-run 2>&1 | \ -// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes CHECK,TOOLLIB +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/libtool.so OMP_TOOL_VERBOSE_INIT=stderr \ +// RUN: %libomp-run %redirect2to1 | \ +// RUN: FileCheck %s -DPARENTPATH=%tool-path --check-prefixes CHECK,TOOLLIB // 3.5 OMP_TOOL_VERBOSE_INIT to stderr, check just stderr -// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=stderr \ -// RUN: %libomp-run 2>&1 >/dev/null | \ -// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes TOOLLIB +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/libtool.so OMP_TOOL_VERBOSE_INIT=stderr \ +// RUN: %libomp-run %redirect2to1 %redirect1tonull | \ +// RUN: FileCheck %s -DPARENTPATH=%tool-path --check-prefixes TOOLLIB // 3.6 OMP_TOOL_VERBOSE_INIT to file "init.log" -// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=%T/init.log \ -// RUN: %libomp-run | FileCheck %s && cat %T/init.log | \ -// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes TOOLLIB - +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/libtool.so OMP_TOOL_VERBOSE_INIT=%tool-path/init.log \ +// RUN: %libomp-run | FileCheck %s %recv-log && cat %T/init.log | \ +// RUN: FileCheck %s -DPARENTPATH=%tool-path --check-prefixes TOOLLIB // REQUIRES: ompt @@ -91,10 +90,10 @@ // TOOLLIB: ----- START LOGGING OF TOOL REGISTRATION ----- // TOOLLIB-NEXT: Search for OMP tool in current address space... Failed. // TOOLLIB-NEXT: Searching tool libraries... -// TOOLLIB-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/tool.so -// TOOLLIB-NEXT: Opening [[PARENTPATH]]/tool.so... Success. +// TOOLLIB-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/libtool.so +// TOOLLIB-NEXT: Opening [[PARENTPATH]]/libtool.so... Success. // TOOLLIB-NEXT: Searching for ompt_start_tool in -// TOOLLIB-SAME: [[PARENTPATH]]/tool.so... Success. +// TOOLLIB-SAME: [[PARENTPATH]]/libtool.so... Success. // TOOLLIB-NEXT: Tool was started and is using the OMPT interface. // TOOLLIB-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- diff --git a/openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c b/openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c index e2cb3877724a..c314c6b3f58e 100644 --- a/openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c +++ b/openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c @@ -1,9 +1,9 @@ -// RUN: %clang %flags -shared -fPIC %s -o %T/first_tool.so -// RUN: %clang %flags -DTOOL -DSECOND_TOOL -shared -fPIC %s -o %T/second_tool.so -// RUN: %clang %flags -DTOOL -DTHIRD_TOOL -shared -fPIC %s -o %T/third_tool.so +// RUN: %clang %flags -shared -fPIC %s -o %T/first_tool.so %send-first_tool +// RUN: %clang %flags -DTOOL -DSECOND_TOOL -shared -fPIC %s -o %T/second_tool.so %send-second_tool +// RUN: %clang %flags -DTOOL -DTHIRD_TOOL -shared -fPIC %s -o %T/third_tool.so %send-third_tool // RUN: %libomp-compile -DCODE -// RUN: env OMP_TOOL_LIBRARIES=%T/non_existing_file.so:%T/first_tool.so:%T/second_tool.so:%T/third_tool.so \ -// RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s -DPARENTPATH=%T \ +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/non_existing_file.so:%tool-path/first_tool.so:%tool-path/second_tool.so:%tool-path/third_tool.so \ +// RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s -DPARENTPATH=%tool-path \ // RUN: --check-prefix=CHECK-%os --check-prefix=CHECK // REQUIRES: ompt @@ -28,11 +28,13 @@ // CHECK-NEXT: Opening [[PARENTPATH]]/non_existing_file.so... Failed: // CHECK-Linux-SAME: [[PARENTPATH]]/non_existing_file.so: cannot open shared object // CHECK-Linux-SAME: file: No such file or directory +// CHECK-OHOS-SAME: Error loading shared library [[PARENTPATH]]/non_existing_file.so: No such file or directory // CHECK-Darwin-SAME: dlopen([[PARENTPATH]]/non_existing_file.so, 1): image not found // CHECK-NEXT: Opening [[PARENTPATH]]/first_tool.so... Success. // CHECK-NEXT: Searching for ompt_start_tool in // CHECK-SAME: [[PARENTPATH]]/first_tool.so... Failed: // CHECK-Linux-SAME: [[PARENTPATH]]/first_tool.so: undefined symbol: ompt_start_tool +// CHECK-OHOS-SAME: do_dlsym failed: Symbol not found: ompt_start_tool, version: null so=[[PARENTPATH]]/first_tool.so // CHECK-Darwin-SAME: dlsym({{0x[0-9a-f]+}}, ompt_start_tool): symbol not found // CHECK-NEXT: Opening [[PARENTPATH]]/second_tool.so... Success. // CHECK-NEXT: Searching for ompt_start_tool in diff --git a/openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c b/openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c index 7e68d8b337f9..b67eb8d32acf 100644 --- a/openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c +++ b/openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c @@ -10,36 +10,36 @@ // Note: We should compile the tool without -fopenmp as other tools developer // would do. Otherwise this test may pass for the wrong reasons on Darwin. -// RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/tool.so +// RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/libntool.so %send-libntool // 2. "introducing a dynamically-linked library that includes the tool’s // definition of ompt_start_tool into the application’s address space" // 2.1 Link with tool during compilation -// RUN: %libomp-compile -DCODE %no-as-needed-flag %T/tool.so && \ -// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ +// RUN: %libomp-compile -DCODE -L%T %no-as-needed-flag -lntool && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%tool-path %libomp-run | \ // RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE // 2.2 Link with tool during compilation, but AFTER the runtime -// RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %T/tool.so && \ -// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ -// RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE +// RUN: %libomp-compile -DCODE -L%T -lomp %no-as-needed-flag -lntool && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%tool-path %libomp-run | FileCheck %s \ +// RUN: --check-prefixes CHECK,ADDRSPACE // 2.3 Inject tool via the dynamic loader -// RUN: %libomp-compile -DCODE && \ -// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %preload-tool %libomp-run | \ -// RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE +// RUN: %libomp-compile -DCODE && env OMP_TOOL_VERBOSE_INIT=stdout \ +// RUN: env LD_PRELOAD=%tool-path/libntool.so %libomp-run | FileCheck %s \ +// RUN: --check-prefixes CHECK,ADDRSPACE // 3. "providing the name of a dynamically-linked library appropriate for the // architecture and operating system used by the application in the // tool-libraries-var ICV" -// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/tool.so \ +// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%tool-path/libntool.so \ // RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ -// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes CHECK,TOOLLIB +// RUN: FileCheck %s -DPARENTPATH=%tool-path --check-prefixes CHECK,TOOLLIB // REQUIRES: ompt @@ -76,10 +76,10 @@ int main() // TOOLLIB: ----- START LOGGING OF TOOL REGISTRATION ----- // TOOLLIB-NEXT: Search for OMP tool in current address space... Failed. // TOOLLIB-NEXT: Searching tool libraries... - // TOOLLIB-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/tool.so - // TOOLLIB-NEXT: Opening [[PARENTPATH]]/tool.so... Success. + // TOOLLIB-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/libntool.so + // TOOLLIB-NEXT: Opening [[PARENTPATH]]/libntool.so... Success. // TOOLLIB-NEXT: Searching for ompt_start_tool in - // TOOLLIB-SAME: [[PARENTPATH]]/tool.so... + // TOOLLIB-SAME: [[PARENTPATH]]/libntool.so... // CHECK: 0: Do not initialize tool diff --git a/openmp/runtime/test/tasking/omp50_taskdep_depobj.c b/openmp/runtime/test/tasking/omp50_taskdep_depobj.c index 3c7912bfe715..eecfb19b1da7 100644 --- a/openmp/runtime/test/tasking/omp50_taskdep_depobj.c +++ b/openmp/runtime/test/tasking/omp50_taskdep_depobj.c @@ -1,4 +1,4 @@ -// RUN: %clang %openmp_flags %flags-use-compiler-omp-h %s -o %t && %libomp-run +// RUN: %clang %openmp_flags %ohos_target_flag %flags-use-compiler-omp-h %s -o %t && %libomp-run // UNSUPPORTED: gcc-5, gcc-6, gcc-7, gcc-8 // UNSUPPORTED: clang-5, clang-6, clang-7, clang-8, clang-9, clang-10 // UNSUPPORTED: icc diff --git a/openmp/tools/multiplex/tests/custom_data_storage/custom_data_storage.c b/openmp/tools/multiplex/tests/custom_data_storage/custom_data_storage.c index 96d9a758429f..bee3321a5346 100644 --- a/openmp/tools/multiplex/tests/custom_data_storage/custom_data_storage.c +++ b/openmp/tools/multiplex/tests/custom_data_storage/custom_data_storage.c @@ -1,9 +1,9 @@ -// RUN: %libomp-tool -DFIRST_TOOL -o %t.first.tool.so %s && \ -// RUN: %libomp-tool -DSECOND_TOOL -o %t.second.tool.so %s && \ +// RUN: %libomp-tool -DFIRST_TOOL -o %T/first.tool.so %s %send-first && \ +// RUN: %libomp-tool -DSECOND_TOOL -o %T/second.tool.so %s %send-second && \ // RUN: %libomp-compile && \ -// RUN: env OMP_TOOL_LIBRARIES=%t.first.tool.so \ -// RUN: CUSTOM_DATA_STORAGE_TOOL_LIBRARIES=%t.second.tool.so \ -// RUN: %libomp-run | %sort-threads | FileCheck %s +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/first.tool.so \ +// RUN: CUSTOM_DATA_STORAGE_TOOL_LIBRARIES=%tool-path/second.tool.so \ +// RUN: %libomp-run | %sort-threads | FileCheck %s -DNULL_ENCODING=%null-encoding // For GCC we don't get an event for master, // see runtime/test/ompt/sycnchronization/master.c @@ -54,7 +54,7 @@ int main() { // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_parallel_begin: // CHECK-SAME: parent_task_id=[[_FIRST_INITIAL_TASK_ID]], -// CHECK-SAME: parent_task_frame.exit=(nil), +// CHECK-SAME: parent_task_frame.exit=[[NULL]], // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, // CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID:[0-9]+]], requested_team_size=2, // CHECK-SAME: codeptr_ra={{0x[0-f]+}}, invoker @@ -98,7 +98,7 @@ int main() { // CHECK-SAME: prior_task_status=ompt_task_switch=7 // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_control_tool: -// CHECK-SAME: command=5, modifier=1, arg=(nil), +// CHECK-SAME: command=5, modifier=1, arg=[[NULL]], // CHECK-SAME: codeptr_ra={{0x[0-f]+}} // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: task level 0: @@ -127,11 +127,11 @@ int main() { // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], @@ -156,7 +156,7 @@ int main() { // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_parallel_begin: // CHECK-SAME: parent_task_id=[[SECOND_INITIAL_TASK_ID]], -// CHECK-SAME: parent_task_frame.exit=(nil), +// CHECK-SAME: parent_task_frame.exit=[[NULL]], // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, // CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID:[0-9]+]], requested_team_size=2, // CHECK-SAME: codeptr_ra={{0x[0-f]+}}, invoker @@ -200,7 +200,7 @@ int main() { // CHECK-SAME: prior_task_status=ompt_task_switch=7 // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_control_tool: -// CHECK-SAME: command=5, modifier=1, arg=(nil), +// CHECK-SAME: command=5, modifier=1, arg=[[NULL]], // CHECK-SAME: codeptr_ra={{0x[0-f]+}} // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: task level 0: @@ -229,11 +229,11 @@ int main() { // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, @@ -259,19 +259,19 @@ int main() { // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_barrier_begin: // CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]], -// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_wait_barrier_begin: // CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]], -// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, @@ -292,19 +292,19 @@ int main() { // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_barrier_begin: // CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]], -// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_wait_barrier_begin: // CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]], -// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, -// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, diff --git a/openmp/tools/multiplex/tests/lit.cfg b/openmp/tools/multiplex/tests/lit.cfg index 3e0666d360e6..6d66e0f948a8 100644 --- a/openmp/tools/multiplex/tests/lit.cfg +++ b/openmp/tools/multiplex/tests/lit.cfg @@ -70,6 +70,8 @@ if config.operating_system == 'Darwin': # OHOS LOCAL if config.operating_system == 'OHOS': config.test_flags += " --target=aarch64-linux-ohos" + if os.environ.get('OPENMP_STATIC_TEST') != None and os.environ.get('OPENMP_STATIC_TEST') == "True" : + config.test_flags += " -static-openmp " # Find the SDK on Darwin if config.operating_system == 'Darwin': @@ -96,7 +98,18 @@ config.substitutions.append(("%libomp-tool", \ "%clang %cflags -shared -fPIC -g")) # OHOS_LOCAL begin -if config.operating_system == 'OHOS': +if config.operating_system == 'OHOS': + # specific substitutions for openmp/tools/multiplex/tests/custom_data_storage/custom_data_storage.c + config.substitutions.append(("%send-first", "&& %target-send %T/first.tool.so %tool-path/first.tool.so")) + config.substitutions.append(("%send-second", "&& %target-send %T/second.tool.so %tool-path/second.tool.so")) + + # specific substitutions for openmp/tools/multiplex/tests/print/print.c + config.substitutions.append(("%send-print-first", "&& %target-send %T/print.first.tool.so %tool-path/print.first.tool.so")) + config.substitutions.append(("%send-print-second", "&& %target-send %T/print.second.tool.so %tool-path/print.second.tool.so")) + + config.substitutions.append(("%tool-path", "%root-path/lib")) + + # HDC releated if not (config.environment.get('HDC') != None and config.environment.get('HDC_SERVER') != None and config.environment.get('HDC_TARGET_SERIAL') != None and config.environment.get('LIB_PATH_ON_TARGET') != None): raise ValueError("Error: One or more environment variables in HDC, HDC_SERVER, HDC_TARGET_SERIAL or LIB_PATH_ON_TARGET are not set.") @@ -108,10 +121,19 @@ if config.operating_system == 'OHOS': cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) - config.substitutions.append(("%root-path", "/data/local/temp")) -# OHOS_LOCAL end + config.substitutions.append(("%target-send", f"{hdc} file send")) + config.substitutions.append(("%target-recv", f"{hdc} file recv")) + config.substitutions.append(("%root-path", "/data/local/temp")) + config.substitutions.append(("%platform-flag", "KMP_WARNINGS=false")) else: + config.substitutions.append(("%send-first", "")) + config.substitutions.append(("%send-second", "")) + config.substitutions.append(("%send-print-first", "")) + config.substitutions.append(("%send-print-second", "")) config.substitutions.append(("%libomp-run", "%t")) + config.substitutions.append(("%platform-flag", "")) + config.substitutions.append(("%tool-path", "%T")) +# OHOS_LOCAL end config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flag", config.test_openmp_flags)) config.substitutions.append(("%cflags", config.test_flags)) diff --git a/openmp/tools/multiplex/tests/print/print.c b/openmp/tools/multiplex/tests/print/print.c index c492899c69f8..a3697c117c7f 100644 --- a/openmp/tools/multiplex/tests/print/print.c +++ b/openmp/tools/multiplex/tests/print/print.c @@ -1,8 +1,8 @@ -// RUN: %libomp-tool -DFIRST_TOOL -o %t.first.tool.so %s && \ -// RUN: %libomp-tool -DSECOND_TOOL -o %t.second.tool.so %s && \ +// RUN: %libomp-tool -DFIRST_TOOL -o %T/print.first.tool.so %s %send-print-first && \ +// RUN: %libomp-tool -DSECOND_TOOL -o %T/print.second.tool.so %s %send-print-second && \ // RUN: %libomp-compile && \ -// RUN: env OMP_TOOL_LIBRARIES=%t.first.tool.so \ -// RUN: PRINT_TOOL_LIBRARIES=%t.second.tool.so \ +// RUN: env OMP_TOOL_LIBRARIES=%tool-path/print.first.tool.so \ +// RUN: PRINT_TOOL_LIBRARIES=%tool-path/print.second.tool.so \ // RUN: %libomp-run | %sort-threads | FileCheck %s // For GCC we don't get an event for master, @@ -55,7 +55,7 @@ int main() { // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_parallel_begin: // CHECK-SAME: parent_task_id=[[_FIRST_INITIAL_TASK_ID]], -// CHECK-SAME: parent_task_frame.exit=(nil), +// CHECK-SAME: parent_task_frame.exit=[[NULL]], // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, // CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID:[0-9]+]], // CHECK-SAME: requested_team_size=2, codeptr_ra={{0x[0-f]+}}, invoker @@ -99,7 +99,7 @@ int main() { // CHECK-SAME: prior_task_status=ompt_task_switch=7 // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_control_tool: -// CHECK-SAME: command=5, modifier=1, arg=(nil), codeptr_ra={{0x[0-f]+}} +// CHECK-SAME: command=5, modifier=1, arg=[[NULL]], codeptr_ra={{0x[0-f]+}} // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: task level 0: // CHECK-SAME: task_id=[[_FIRST_EXPLICIT_TASK_ID]] @@ -126,11 +126,11 @@ int main() { // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], @@ -153,7 +153,7 @@ int main() { // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_parallel_begin: // CHECK-SAME: parent_task_id=[[SECOND_INITIAL_TASK_ID]], -// CHECK-SAME: parent_task_frame.exit=(nil), +// CHECK-SAME: parent_task_frame.exit=[[NULL]], // CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}}, // CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID:[0-9]+]], // CHECK-SAME: requested_team_size=2, codeptr_ra={{0x[0-f]+}}, invoker @@ -197,7 +197,7 @@ int main() { // CHECK-SAME: prior_task_status=ompt_task_switch=7 // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_control_tool: -// CHECK-SAME: command=5, modifier=1, arg=(nil), codeptr_ra={{0x[0-f]+}} +// CHECK-SAME: command=5, modifier=1, arg=[[NULL]], codeptr_ra={{0x[0-f]+}} // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: task level 0: // CHECK-SAME: task_id=[[SECOND_EXPLICIT_TASK_ID]] @@ -224,11 +224,11 @@ int main() { // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], @@ -252,19 +252,19 @@ int main() { // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_barrier_begin: // CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]], -// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_wait_barrier_begin: // CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]], -// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], @@ -284,19 +284,19 @@ int main() { // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_barrier_begin: // CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]], -// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_wait_barrier_begin: // CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]], -// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil) +// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_wait_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_barrier_end: // CHECK-SAME: parallel_id=0, task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], -// CHECK-SAME: codeptr_ra=(nil) +// CHECK-SAME: codeptr_ra=[[NULL]] // CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_implicit_task_end: // CHECK-SAME: parallel_id=0, task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], -- Gitee