diff --git a/.github/workflows/test_t8code.yml b/.github/workflows/test_t8code.yml index 05f4cd8402..a27bb9df2d 100644 --- a/.github/workflows/test_t8code.yml +++ b/.github/workflows/test_t8code.yml @@ -82,8 +82,14 @@ jobs: run: export TEST_LEVEL_FLAG="-DT8CODE_TEST_LEVEL=${{ inputs.TEST_LEVEL }}" && echo TEST_LEVEL_FLAG="$TEST_LEVEL_FLAG" >> $GITHUB_ENV - name: build config variables - run: export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -GNinja -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON -DT8CODE_BUILD_WEXTRA=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" - && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV + run: | + export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -GNinja -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} \ + -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON \ + -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON \ + -DT8CODE_BUILD_WEXTRA=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DT8CODE_BUILD_MESH_HANDLE=ON -DSC_DIR=$SC_PATH/install/cmake \ + -DP4EST_DIR=$P4EST_PATH/install/cmake" + echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV # cmake and test - name: Printing MPI compiler info run: mpicc --version && mpirun --version diff --git a/.github/workflows/test_t8code_api.yml b/.github/workflows/test_t8code_api.yml index 0a83e82c19..48b08af9d6 100644 --- a/.github/workflows/test_t8code_api.yml +++ b/.github/workflows/test_t8code_api.yml @@ -84,7 +84,7 @@ jobs: run: export TEST_LEVEL_FLAG="-DT8CODE_TEST_LEVEL=${{ inputs.TEST_LEVEL }}" && echo TEST_LEVEL_FLAG="$TEST_LEVEL_FLAG" >> $GITHUB_ENV - name: build config variables - run: export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -GNinja -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} -DT8CODE_BUILD_FORTRAN_INTERFACE=ON -DT8CODE_BUILD_MESH_HANDLE=ON -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON -DT8CODE_BUILD_WEXTRA=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" + run: export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -GNinja -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} -DT8CODE_BUILD_FORTRAN_INTERFACE=ON -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON -DT8CODE_BUILD_WEXTRA=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV # cmake and test with api options - name: echo cmake line diff --git a/.github/workflows/test_t8code_w_shipped_submodules.yml b/.github/workflows/test_t8code_w_shipped_submodules.yml index 228268beaf..769c11d064 100644 --- a/.github/workflows/test_t8code_w_shipped_submodules.yml +++ b/.github/workflows/test_t8code_w_shipped_submodules.yml @@ -75,8 +75,12 @@ jobs: run: export TEST_LEVEL_FLAG="-DT8CODE_TEST_LEVEL=${{ inputs.TEST_LEVEL }}" && echo TEST_LEVEL_FLAG="$TEST_LEVEL_FLAG" >> $GITHUB_ENV - name: build config variables - run: export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -GNinja -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON -DT8CODE_BUILD_WEXTRA=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE" - && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV + run: | + export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -GNinja -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} \ + -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} -DT8CODE_BUILD_MESH_HANDLE=ON -DT8CODE_BUILD_PEDANTIC=ON \ + -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON -DT8CODE_BUILD_WEXTRA=ON -DT8CODE_ENABLE_MPI=$MPI \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE" + echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV # cmake and test - name: Printing MPI compiler info run: mpicc --version && mpirun --version diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 92c72c8853..8a98d09b69 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -171,7 +171,7 @@ jobs: BUILD_TYPE: ${{ matrix.BUILD_TYPE }} TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. - # Run t8code linkage tests with and without MPI and in serial and debug mode + # Run t8code api tests only with MPI and in serial and debug mode t8code_api_tests: needs: preparation uses: ./.github/workflows/test_t8code_api.yml diff --git a/test/mesh_handle/competences/t8_gtest_dg_competences.cxx b/test/mesh_handle/competences/t8_gtest_dg_competences.cxx index 3a9c3a73b3..ce666823bf 100644 --- a/test/mesh_handle/competences/t8_gtest_dg_competences.cxx +++ b/test/mesh_handle/competences/t8_gtest_dg_competences.cxx @@ -77,13 +77,18 @@ TEST (t8_gtest_dg_competences, remote_ranks) const t8_locidx_t num_local = mesh->get_num_local_elements (); const t8_locidx_t num_ghosts = mesh->get_num_ghosts (); - if ((mesh->get_dimension () > 1) && (num_local > 1)) { - // Ensure that we actually test with ghost elements. - ASSERT_GT (num_ghosts, 0); + // Test does not make sense without ghosts. + int mpisize; + int mpiret = sc_MPI_Comm_size (sc_MPI_COMM_WORLD, &mpisize); + SC_CHECK_MPI (mpiret); + if (!(mpisize > 1) || !(mesh->get_dimension () > 1) || (num_local < mpisize)) { + GTEST_SKIP () << "Skipping test as no ghost elements are created."; } + // Ensure that we actually test with ghost elements. + ASSERT_GT (num_ghosts, 0); int mpirank; - int mpiret = sc_MPI_Comm_rank (sc_MPI_COMM_WORLD, &mpirank); + mpiret = sc_MPI_Comm_rank (sc_MPI_COMM_WORLD, &mpirank); SC_CHECK_MPI (mpiret); // Set local rank for all local mesh elements. diff --git a/test/mesh_handle/competences/t8_gtest_handle_data.cxx b/test/mesh_handle/competences/t8_gtest_handle_data.cxx index cfb8b60b44..f25243ce5b 100644 --- a/test/mesh_handle/competences/t8_gtest_handle_data.cxx +++ b/test/mesh_handle/competences/t8_gtest_handle_data.cxx @@ -52,11 +52,6 @@ TEST (t8_gtest_handle_data, set_and_get_element_data) auto mesh = t8_mesh_handle::handle_hypercube_hybrid_uniform_default (level, sc_MPI_COMM_WORLD, true, false); - if ((mesh->get_dimension () > 1) && (mesh->get_num_local_elements () > 1)) { - // Ensure that we actually test with ghost elements. - EXPECT_GT (mesh->get_num_ghosts (), 0); - } - // Create element data for all local mesh elements. std::vector element_data; for (const auto &elem : *mesh) { diff --git a/test/mesh_handle/t8_gtest_ghost.cxx b/test/mesh_handle/t8_gtest_ghost.cxx index f75c61cdbf..2ebe709bae 100644 --- a/test/mesh_handle/t8_gtest_ghost.cxx +++ b/test/mesh_handle/t8_gtest_ghost.cxx @@ -66,18 +66,22 @@ TEST_P (t8_mesh_ghost_test, check_ghosts) EXPECT_EQ (mesh->get_num_ghosts (), 0); mesh->set_ghost (); mesh->commit (); - EXPECT_EQ (mesh->get_num_ghosts (), t8_forest_get_num_ghosts (mesh->get_forest ())); - if ((mesh->get_dimension () > 1) && (mesh->get_num_local_elements () > 1)) { - // Ensure that we actually have ghost elements in this test. - EXPECT_GT (mesh->get_num_ghosts (), 0); - } - else { - GTEST_SKIP () << "Skipping test as no ghost elements are created for 1D or single element meshes."; + const t8_locidx_t num_local_elements = mesh->get_num_local_elements (); + const t8_locidx_t num_ghost_elements = mesh->get_num_ghosts (); + + // Test does not make sense without ghosts. + int mpisize; + int mpiret = sc_MPI_Comm_size (sc_MPI_COMM_WORLD, &mpisize); + SC_CHECK_MPI (mpiret); + if (!(mpisize > 1) || !(mesh->get_dimension () > 1) || (num_local_elements < mpisize)) { + GTEST_SKIP () << "Skipping test as no ghost elements are created."; } + // Ensure that we actually test with ghost elements. + ASSERT_GT (num_ghost_elements, 0); + EXPECT_EQ (num_ghost_elements, t8_forest_get_num_ghosts (mesh->get_forest ())); // Check functions for ghost elements. - const t8_locidx_t num_local_elements = mesh->get_num_local_elements (); - const t8_locidx_t num_ghost_elements = mesh->get_num_ghosts (); + for (t8_locidx_t ighost = num_local_elements; ighost < num_local_elements + num_ghost_elements; ++ighost) { EXPECT_EQ (ighost, (*mesh)[ighost].get_element_handle_id ()); EXPECT_TRUE ((*mesh)[ighost].is_ghost_element ()); @@ -121,10 +125,6 @@ TEST_P (t8_mesh_ghost_test, compare_neighbors_to_forest) const t8_mesh_handle::mesh<> mesh (forest); EXPECT_EQ (mesh.get_num_ghosts (), t8_forest_get_num_ghosts (forest)); - if ((mesh.get_dimension () > 1) && (mesh.get_num_local_elements () > 1)) { - // Ensure that we have ghost elements in this test. - EXPECT_GT (mesh.get_num_ghosts (), 0); - } // Iterate over the elements of the forest and of the mesh handle simultaneously and compare results. auto mesh_iterator = mesh.cbegin ();