From ec4654e698c629f2f77bb3f781c92ddadfa7a77f Mon Sep 17 00:00:00 2001
From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:13:31 -0500
Subject: [PATCH] Verify CMake workflows match autotools (#5035)

---
 .github/workflows/main-cmake-par-spc.yml |  4 ++--
 .github/workflows/main-cmake-par.yml     |  2 ++
 .github/workflows/main-cmake-spc.yml     | 23 +++++++++++++++--------
 .github/workflows/main-cmake.yml         |  7 -------
 .github/workflows/msys2-cmake.yml        |  4 ++--
 .github/workflows/nvhpc-cmake.yml        |  2 ++
 .github/workflows/testxpr-cmake.yml      |  1 -
 7 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/main-cmake-par-spc.yml b/.github/workflows/main-cmake-par-spc.yml
index 72bc99bed11..6e16a52add8 100644
--- a/.github/workflows/main-cmake-par-spc.yml
+++ b/.github/workflows/main-cmake-par-spc.yml
@@ -48,6 +48,8 @@ jobs:
             -DHDF5_ENABLE_ALL_WARNINGS=ON \
             -DHDF5_ENABLE_WARNINGS_AS_ERRORS=ON \
             -DHDF5_ENABLE_PARALLEL:BOOL=ON \
+            -DMPIEXEC_NUMPROC_FLAG:STRING=-n \
+            -DMPIEXEC_MAX_NUMPROCS:STRING=2 \
             -DHDF5_ENABLE_SUBFILING_VFD:BOOL=ON \
             -DHDF5_BUILD_CPP_LIB:BOOL=OFF \
             -DHDF5_BUILD_FORTRAN=OFF \
@@ -65,9 +67,7 @@ jobs:
         run: cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
         working-directory: ${{ runner.workspace }}/build
 
-      #
       # RUN TESTS
-      #
       - name: CMake Run Tests
         run: ctest . -E MPI_TEST --parallel 2 -C ${{ inputs.build_mode }} -V
         working-directory: ${{ runner.workspace }}/build
diff --git a/.github/workflows/main-cmake-par.yml b/.github/workflows/main-cmake-par.yml
index c3d9900e857..278855e9737 100644
--- a/.github/workflows/main-cmake-par.yml
+++ b/.github/workflows/main-cmake-par.yml
@@ -47,6 +47,8 @@ jobs:
             -DBUILD_SHARED_LIBS=ON \
             -DHDF5_ENABLE_ALL_WARNINGS=ON \
             -DHDF5_ENABLE_PARALLEL:BOOL=ON \
+            -DMPIEXEC_NUMPROC_FLAG:STRING=-n \
+            -DMPIEXEC_MAX_NUMPROCS:STRING=2 \
             -DHDF5_ENABLE_SUBFILING_VFD:BOOL=ON \
             -DHDF5_BUILD_CPP_LIB:BOOL=OFF \
             -DHDF5_BUILD_FORTRAN=ON \
diff --git a/.github/workflows/main-cmake-spc.yml b/.github/workflows/main-cmake-spc.yml
index 416bac4e8a6..e944ff4be13 100644
--- a/.github/workflows/main-cmake-spc.yml
+++ b/.github/workflows/main-cmake-spc.yml
@@ -68,10 +68,17 @@ jobs:
         run: cmake --build . --parallel 3 --config Debug
         working-directory: ${{ runner.workspace }}/build
 
-      # RUN TESTS - disable until some tests are fixed
-#      - name: CMake Run Tests
-#        run: ctest . --parallel 2 -C Debug -V
-#        working-directory: ${{ runner.workspace }}/build
+      # RUN TESTS
+      - name: CMake Run Tests
+        run: |
+          ctest . --parallel 2 -C Debug -V -E "testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
+        working-directory: ${{ runner.workspace }}/build
+
+      - name: CMake Run Expected to Fail Tests
+        run: |
+          ctest . --parallel 2 -C Debug -V -R "testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
+        working-directory: ${{ runner.workspace }}/build
+        continue-on-error: true
 
   build_v1_8:
     name: "gcc DBG v1.8 default API"
@@ -123,11 +130,11 @@ jobs:
         working-directory: ${{ runner.workspace }}/build
 
       #
-      # RUN TESTS - disable until some tests are fixed
+      # RUN TESTS
       #
-#      - name: CMake Run Tests
-#        run: ctest . --parallel 2 -C Debug -V
-#        working-directory: ${{ runner.workspace }}/build
+      - name: CMake Run Tests
+        run: ctest . --parallel 2 -C Debug -V
+        working-directory: ${{ runner.workspace }}/build
 
   build_v1_10:
     name: "gcc DBG v1.10 default API"
diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml
index 6c192cdcfc9..aad19620d9d 100644
--- a/.github/workflows/main-cmake.yml
+++ b/.github/workflows/main-cmake.yml
@@ -8,7 +8,6 @@ on:
         description: "TS or empty"
         required: true
         type: string
-
       build_mode:
         description: "release vs. debug build"
         required: true
@@ -160,9 +159,7 @@ jobs:
       - name: Get Sources
         uses: actions/checkout@v4.1.7
 
-      #
       # CMAKE CONFIGURE
-      #
       - name: CMake Configure
         run: |
           mkdir "${{ runner.workspace }}/build"
@@ -217,16 +214,12 @@ jobs:
         shell: bash
         if: ${{ inputs.thread_safety == 'TS' }}
 
-      #
       # BUILD
-      #
       - name: CMake Build
         run: cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
         working-directory: ${{ runner.workspace }}/build
 
-      #
       # RUN TESTS
-      #
       - name: CMake Run Tests
         run: ctest . --parallel 2 -C ${{ inputs.build_mode }} -V
         working-directory: ${{ runner.workspace }}/build
diff --git a/.github/workflows/msys2-cmake.yml b/.github/workflows/msys2-cmake.yml
index 7cbd7890f1c..46f1a2b4c37 100644
--- a/.github/workflows/msys2-cmake.yml
+++ b/.github/workflows/msys2-cmake.yml
@@ -81,11 +81,11 @@ jobs:
 
       - name: CMake Run Tests
         run: |
-          ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "tfloatsattrs|testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
+          ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
         working-directory: ${{ runner.workspace }}/build
 
       - name: CMake Run Expected to Fail Tests
         run: |
-          ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -R "tfloatsattrs|testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
+          ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -R "testhdf5-base|cache_api|dt_arith|H5TEST-dtypes|err_compat"
         working-directory: ${{ runner.workspace }}/build
         continue-on-error: true
diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml
index dbdcb365ec9..66ef39c536c 100644
--- a/.github/workflows/nvhpc-cmake.yml
+++ b/.github/workflows/nvhpc-cmake.yml
@@ -54,6 +54,8 @@ jobs:
           -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \
           -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \
           -DHDF5_ENABLE_PARALLEL:BOOL=ON \
+          -DMPIEXEC_NUMPROC_FLAG:STRING=-np \
+          -DMPIEXEC_MAX_NUMPROCS:STRING=2 \
           -DHDF5_BUILD_CPP_LIB:BOOL=OFF \
           -DLIBAEC_USE_LOCALCONTENT=OFF \
           -DZLIB_USE_LOCALCONTENT=OFF \
diff --git a/.github/workflows/testxpr-cmake.yml b/.github/workflows/testxpr-cmake.yml
index b03a67c53cd..47f2d4768d8 100644
--- a/.github/workflows/testxpr-cmake.yml
+++ b/.github/workflows/testxpr-cmake.yml
@@ -65,4 +65,3 @@ jobs:
           HDF5TestExpress: 0
         run: ctest . --parallel 2 -C ${{ matrix.build_mode }} -V -R H5TESTXPR
         working-directory: ${{ runner.workspace }}/build
-