[Openmp-commits] [openmp] [OpenMP] Move tool tests out of individual folders (PR #150780)

via Openmp-commits openmp-commits at lists.llvm.org
Sat Jul 26 10:32:23 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions c -- openmp/runtime/test/ompt/loadtool/tool_available.c openmp/runtime/test/ompt/loadtool/tool_available_search.c openmp/runtime/test/ompt/loadtool/tool_not_available.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/openmp/runtime/test/ompt/loadtool/tool_available.c b/openmp/runtime/test/ompt/loadtool/tool_available.c
index a08581b9a..05b36cd7f 100644
--- a/openmp/runtime/test/ompt/loadtool/tool_available.c
+++ b/openmp/runtime/test/ompt/loadtool/tool_available.c
@@ -2,7 +2,7 @@
 
 // RUN: mkdir -p %t.tool_dir
 
-// 1. "statically-linking the tool’s definition of ompt_start_tool into an 
+// 1. "statically-linking the tool’s definition of ompt_start_tool into an
 //     OpenMP application"
 
 // RUN: %libomp-compile -DCODE -DTOOL && env OMP_TOOL_VERBOSE_INIT=stdout \
@@ -13,14 +13,14 @@
 
 // RUN: %clang %flags -DTOOL -shared -fPIC %s -o %t.tool_dir/tool.so
 
-// 2. "introducing a dynamically-linked library that includes the tool’s 
+// 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_dir/tool.so && \
 // RUN:    env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s \
-// RUN:    --check-prefixes CHECK,ADDRSPACE 
+// RUN:    --check-prefixes CHECK,ADDRSPACE
 
 // 2.2 Link with tool during compilation, but AFTER the runtime
 
@@ -35,10 +35,10 @@
 // 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 
+//    architecture and operating system used by the application in the
 //    tool-libraries-var ICV"
 
-// 3.1 OMP_TOOL_VERBOSE_INIT not set 
+// 3.1 OMP_TOOL_VERBOSE_INIT not set
 
 // RUN: %libomp-compile -DCODE && \
 // RUN:    env OMP_TOOL_LIBRARIES=%t.tool_dir/tool.so %libomp-run | FileCheck %s
@@ -72,7 +72,6 @@
 // RUN:    %libomp-run | FileCheck %s && cat %t.tool_dir/init.log | \
 // RUN:    FileCheck %s -DPARENTPATH=%t.tool_dir --check-prefixes TOOLLIB
 
-
 // REQUIRES: ompt
 
 /*
@@ -103,9 +102,8 @@
 #ifdef CODE
 #include "omp.h"
 
-int main()
-{
-  #pragma omp parallel num_threads(2)
+int main() {
+#pragma omp parallel num_threads(2)
   {
   }
 
@@ -127,20 +125,18 @@ int main()
 
 int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
                     ompt_data_t *tool_data) {
-  printf("0: NULL_POINTER=%p\n", (void*)NULL);
-  return 1; //success
+  printf("0: NULL_POINTER=%p\n", (void *)NULL);
+  return 1; // success
 }
 
-void ompt_finalize(ompt_data_t* tool_data)
-{
+void ompt_finalize(ompt_data_t *tool_data) {
   printf("0: ompt_event_runtime_shutdown\n");
 }
 
-ompt_start_tool_result_t* ompt_start_tool(
-  unsigned int omp_version,
-  const char *runtime_version)
-{
-  static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
+                                          const char *runtime_version) {
+  static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
+                                                            &ompt_finalize, 0};
   return &ompt_start_tool_result;
 }
 #endif /* TOOL */
diff --git a/openmp/runtime/test/ompt/loadtool/tool_available_search.c b/openmp/runtime/test/ompt/loadtool/tool_available_search.c
index 73e2dea1b..ff9fa255a 100644
--- a/openmp/runtime/test/ompt/loadtool/tool_available_search.c
+++ b/openmp/runtime/test/ompt/loadtool/tool_available_search.c
@@ -1,10 +1,12 @@
 // RUN: mkdir -p %t.tool_dir
 // RUN: %clang %flags -shared -fPIC %s -o %t.tool_dir/first_tool.so
-// RUN: %clang %flags -DTOOL -DSECOND_TOOL -shared -fPIC %s -o %t.tool_dir/second_tool.so
-// RUN: %clang %flags -DTOOL -DTHIRD_TOOL -shared -fPIC %s -o %t.tool_dir/third_tool.so
-// RUN: %libomp-compile -DCODE
-// RUN: env OMP_TOOL_LIBRARIES=%t.tool_dir/non_existing_file.so:%t.tool_dir/first_tool.so:%t.tool_dir/second_tool.so:%t.tool_dir/third_tool.so \
-// RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s -DPARENTPATH=%t.tool_dir
+// RUN: %clang %flags -DTOOL -DSECOND_TOOL -shared -fPIC %s -o
+// %t.tool_dir/second_tool.so RUN: %clang %flags -DTOOL -DTHIRD_TOOL -shared
+// -fPIC %s -o %t.tool_dir/third_tool.so RUN: %libomp-compile -DCODE
+// RUN: env
+// OMP_TOOL_LIBRARIES=%t.tool_dir/non_existing_file.so:%t.tool_dir/first_tool.so:%t.tool_dir/second_tool.so:%t.tool_dir/third_tool.so
+// \ RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s
+// -DPARENTPATH=%t.tool_dir
 
 // REQUIRES: ompt
 // XFAIL: darwin
@@ -27,16 +29,15 @@
 // CHECK-SAME: [[PARENTPATH]]/second_tool.so
 // CHECK-SAME: [[PARENTPATH]]/third_tool.so
 // CHECK-NEXT: Opening [[PARENTPATH]]/non_existing_file.so... Failed:
-// CHECK-SAME: [[PARENTPATH]]/non_existing_file.so: {{cannot open shared object file|open failed}}:
-// CHECK-SAME: No such file or directory
-// CHECK-NEXT: Opening [[PARENTPATH]]/first_tool.so... Success.
-// CHECK-NEXT: Searching for ompt_start_tool in
-// CHECK-SAME: [[PARENTPATH]]/first_tool.so... Failed:
-// CHECK-SAME: {{.*/first_tool.so: undefined symbol: ompt_start_tool|ld.so.1: .*: ompt_start_tool: can't find symbol}}
-// CHECK-NEXT: Opening [[PARENTPATH]]/second_tool.so... Success.
-// CHECK-NEXT: Searching for ompt_start_tool in
-// CHECK-SAME: [[PARENTPATH]]/second_tool.so... 0: Do not initialize tool
-// CHECK-NEXT: Found but not using the OMPT interface.
+// CHECK-SAME: [[PARENTPATH]]/non_existing_file.so: {{cannot open shared object
+// file|open failed}}: CHECK-SAME: No such file or directory CHECK-NEXT: Opening
+// [[PARENTPATH]]/first_tool.so... Success. CHECK-NEXT: Searching for
+// ompt_start_tool in CHECK-SAME: [[PARENTPATH]]/first_tool.so... Failed:
+// CHECK-SAME: {{.*/first_tool.so: undefined symbol: ompt_start_tool|ld.so.1:
+// .*: ompt_start_tool: can't find symbol}} CHECK-NEXT: Opening
+// [[PARENTPATH]]/second_tool.so... Success. CHECK-NEXT: Searching for
+// ompt_start_tool in CHECK-SAME: [[PARENTPATH]]/second_tool.so... 0: Do not
+// initialize tool CHECK-NEXT: Found but not using the OMPT interface.
 // CHECK-NEXT: Continuing search...
 // CHECK-NEXT: Opening [[PARENTPATH]]/third_tool.so... Success.
 // CHECK-NEXT: Searching for ompt_start_tool in
@@ -54,24 +55,21 @@
 // CHECK-DAG: {{^}}0: control_tool()=-1
 // CHECK: {{^}}0: Tool finalized
 
-
 #ifdef CODE
 #include "stdio.h"
 #include "omp.h"
 #include "omp-tools.h"
 
-int main()
-{
-  #pragma omp parallel num_threads(2)
+int main() {
+#pragma omp parallel num_threads(2)
   {
-    #pragma omp master
+#pragma omp master
     {
       int result = omp_control_tool(omp_control_tool_start, 0, NULL);
       printf("0: control_tool()=%d\n", result);
     }
   }
 
-
   return 0;
 }
 
@@ -84,10 +82,8 @@ int main()
 
 #ifdef SECOND_TOOL
 // The second tool has an implementation of ompt_start_tool that returns NULL
-ompt_start_tool_result_t* ompt_start_tool(
-  unsigned int omp_version,
-  const char *runtime_version)
-{
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
+                                          const char *runtime_version) {
   printf("0: Do not initialize tool\n");
   return NULL;
 }
@@ -95,33 +91,28 @@ ompt_start_tool_result_t* ompt_start_tool(
 // The third tool has an implementation of ompt_start_tool that returns a
 // pointer to a valid instance of ompt_start_tool_result_t
 
-static void
-on_ompt_callback_thread_begin(
-  ompt_thread_t thread_type,
-  ompt_data_t *thread_data)
-{
+static void on_ompt_callback_thread_begin(ompt_thread_t thread_type,
+                                          ompt_data_t *thread_data) {
   printf("0: ompt_event_thread_begin\n");
 }
 
 int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
                     ompt_data_t *tool_data) {
-  ompt_set_callback_t ompt_set_callback = (ompt_set_callback_t) lookup("ompt_set_callback");
-  ompt_set_callback(ompt_callback_thread_begin, (ompt_callback_t)on_ompt_callback_thread_begin);
+  ompt_set_callback_t ompt_set_callback =
+      (ompt_set_callback_t)lookup("ompt_set_callback");
+  ompt_set_callback(ompt_callback_thread_begin,
+                    (ompt_callback_t)on_ompt_callback_thread_begin);
   printf("0: Tool initialized\n");
   return 1;
 }
 
-void ompt_finalize(ompt_data_t *tool_data)
-{
-  printf("0: Tool finalized\n");
-}
+void ompt_finalize(ompt_data_t *tool_data) { printf("0: Tool finalized\n"); }
 
-ompt_start_tool_result_t* ompt_start_tool(
-  unsigned int omp_version,
-  const char *runtime_version)
-{
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
+                                          const char *runtime_version) {
   printf("0: Do initialize tool\n");
-  static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
+  static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
+                                                            &ompt_finalize, 0};
   return &ompt_start_tool_result;
 }
 #endif
diff --git a/openmp/runtime/test/ompt/loadtool/tool_not_available.c b/openmp/runtime/test/ompt/loadtool/tool_not_available.c
index df56d31cb..6d6077775 100644
--- a/openmp/runtime/test/ompt/loadtool/tool_not_available.c
+++ b/openmp/runtime/test/ompt/loadtool/tool_not_available.c
@@ -7,14 +7,14 @@
 
 // RUN: %libomp-compile -DCODE -DTOOL && \
 // RUN:    env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \
-// RUN:    FileCheck %s --check-prefixes CHECK,ADDRSPACE 
+// RUN:    FileCheck %s --check-prefixes CHECK,ADDRSPACE
 
 // 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_dir/tool.so
 
-// 2. "introducing a dynamically-linked library that includes the tool’s 
+// 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
@@ -27,16 +27,16 @@
 
 // RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %t.tool_dir/tool.so && \
 // RUN:    env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \
-// RUN:    FileCheck %s --check-prefixes CHECK,ADDRSPACE 
+// RUN:    FileCheck %s --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:    FileCheck %s --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 
+//    architecture and operating system used by the application in the
 //    tool-libraries-var ICV"
 
 // RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%t.tool_dir/tool.so \
@@ -46,8 +46,8 @@
 // REQUIRES: ompt
 
 /*
- *  This file contains code for an OMPT shared library tool to be 
- *  loaded and the code for the OpenMP executable. 
+ *  This file contains code for an OMPT shared library tool to be
+ *  loaded and the code for the OpenMP executable.
  *  -DTOOL enables the code for the tool during compilation
  *  -DCODE enables the code for the executable during compilation
  */
@@ -57,18 +57,16 @@
 #include "omp.h"
 #include "omp-tools.h"
 
-int main()
-{
-  #pragma omp parallel num_threads(2)
+int main() {
+#pragma omp parallel num_threads(2)
   {
-    #pragma omp master
+#pragma omp master
     {
       int result = omp_control_tool(omp_control_tool_start, 0, NULL);
       printf("0: control_tool()=%d\n", result);
     }
   }
 
-
   // Check if libomp supports the callbacks for this test.
   // CHECK-NOT: {{^}}0: Could not register callback
 
@@ -98,7 +96,6 @@ int main()
   // TOOLLIB-NEXT: ----- END LOGGING OF TOOL REGISTRATION -----
 
   // CHECK: {{^}}0: control_tool()=-2
-  
 
   return 0;
 }
@@ -110,10 +107,8 @@ int main()
 #include <omp-tools.h>
 #include "stdio.h"
 
-ompt_start_tool_result_t* ompt_start_tool(
-  unsigned int omp_version,
-  const char *runtime_version)
-{
+ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
+                                          const char *runtime_version) {
   printf("0: Do not initialize tool\n");
   return NULL;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/150780


More information about the Openmp-commits mailing list