From 4643d91b19b2083e5e95b944265f03f64ab7d780 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Tue, 17 Dec 2024 11:01:17 -0800 Subject: [PATCH] single add_test macro for WIN32 or not (#2027) --- Tests/CTestList.cmake | 159 +++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 95 deletions(-) diff --git a/Tests/CTestList.cmake b/Tests/CTestList.cmake index eb3c85732..ba86ee5c9 100644 --- a/Tests/CTestList.cmake +++ b/Tests/CTestList.cmake @@ -28,7 +28,7 @@ macro(setup_test) endmacro(setup_test) # Standard regression test -function(add_test_r TEST_NAME TEST_EXE PLTFILE) +function(add_test_r TEST_NAME TEST_DIR TEST_EXE PLTFILE) set(options ) set(oneValueArgs "INPUT_SOUNDING" "RUNTIME_OPTIONS") set(multiValueArgs ) @@ -42,7 +42,12 @@ function(add_test_r TEST_NAME TEST_EXE PLTFILE) string(APPEND RUNTIME_OPTIONS "erf.input_sounding_file=${CURRENT_TEST_BINARY_DIR}/${ADD_TEST_R_INPUT_SOUNDING}") endif() - set(TEST_EXE ${CMAKE_BINARY_DIR}/Exec/${TEST_EXE}) + if(WIN32) + set(TEST_EXE "${CMAKE_BINARY_DIR}/Exec/${TEST_DIR}/*/${TEST_EXE}.exe") + else() + set(TEST_EXE "${CMAKE_BINARY_DIR}/Exec/${TEST_DIR}/${TEST_EXE}") + endif() + set(FCOMPARE_TOLERANCE "-r ${ERF_TEST_FCOMPARE_RTOL} --abs_tol ${ERF_TEST_FCOMPARE_ATOL}") set(FCOMPARE_FLAGS "--abort_if_not_all_found -a ${FCOMPARE_TOLERANCE}") set(test_command sh -c "${MPI_COMMANDS} ${TEST_EXE} ${CURRENT_TEST_BINARY_DIR}/${TEST_NAME}.i ${RUNTIME_OPTIONS} > ${TEST_NAME}.log && ${MPI_FCOMP_COMMANDS} ${FCOMPARE_EXE} ${FCOMPARE_FLAGS} ${PLOT_GOLD} ${CURRENT_TEST_BINARY_DIR}/${PLTFILE}") @@ -59,10 +64,14 @@ function(add_test_r TEST_NAME TEST_EXE PLTFILE) endfunction(add_test_r) # Debug regression test with lower tolerance -function(add_test_d TEST_NAME TEST_EXE PLTFILE) +function(add_test_d TEST_NAME TEST_DIR TEST_EXE PLTFILE) setup_test() - set(TEST_EXE ${CMAKE_BINARY_DIR}/Exec/${TEST_EXE}) + if(WIN32) + set(TEST_EXE "${CMAKE_BINARY_DIR}/Exec/${TEST_DIR}/*/${TEST_EXE}.exe") + else() + set(TEST_EXE "${CMAKE_BINARY_DIR}/Exec/${TEST_DIR}/${TEST_EXE}") + endif() set(FCOMPARE_TOLERANCE "-r 3.0e-9 --abs_tol 3.0e-9") set(FCOMPARE_FLAGS "--abort_if_not_all_found -a ${FCOMPARE_TOLERANCE}") set(test_command sh -c "${MPI_COMMANDS} ${TEST_EXE} ${CURRENT_TEST_BINARY_DIR}/${TEST_NAME}.i > ${TEST_NAME}.log && ${MPI_FCOMP_COMMANDS} ${FCOMPARE_EXE} ${FCOMPARE_FLAGS} ${PLOT_GOLD} ${CURRENT_TEST_BINARY_DIR}/${PLTFILE}") @@ -79,10 +88,14 @@ function(add_test_d TEST_NAME TEST_EXE PLTFILE) endfunction(add_test_d) # Stationary test -- compare with time 0 -function(add_test_0 TEST_NAME TEST_EXE PLTFILE) +function(add_test_0 TEST_NAME TEST_DIR TEST_EXE PLTFILE) setup_test() - set(TEST_EXE ${CMAKE_BINARY_DIR}/Exec/${TEST_EXE}) + if(WIN32) + set(TEST_EXE "${CMAKE_BINARY_DIR}/Exec/${TEST_DIR}/*/${TEST_EXE}.exe") + else() + set(TEST_EXE "${CMAKE_BINARY_DIR}/Exec/${TEST_DIR}/${TEST_EXE}") + endif() set(FCOMPARE_TOLERANCE "-r 1e-14 --abs_tol 1.0e-14") set(FCOMPARE_FLAGS "-a ${FCOMPARE_TOLERANCE}") set(test_command sh -c "${MPI_COMMANDS} ${TEST_EXE} ${CURRENT_TEST_BINARY_DIR}/${TEST_NAME}.i erf.input_sounding_file=${CURRENT_TEST_BINARY_DIR}/input_sounding > ${TEST_NAME}.log && ${MPI_FCOMP_COMMANDS} ${FCOMPARE_EXE} ${FCOMPARE_FLAGS} ${CURRENT_TEST_BINARY_DIR}/plt00000 ${CURRENT_TEST_BINARY_DIR}/${PLTFILE}") @@ -101,95 +114,51 @@ endfunction(add_test_0) #============================================================================= # Regression tests #============================================================================= -if(WIN32) -add_test_r(CouetteFlow_x "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00050") -add_test_r(CouetteFlow_y "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00050") -add_test_r(DensityCurrent "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(DensityCurrent_anelastic "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(DensityCurrent_detJ2 "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(DensityCurrent_detJ2_nosub "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00020") -add_test_r(DensityCurrent_detJ2_MT "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(EkmanSpiral "DryRegTests/EkmanSpiral/*/erf_ekman_spiral.exe" "plt00010") -add_test_r(IsentropicVortexStationary "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(IsentropicVortexAdvecting "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(IVA_NumDiff "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(MovingTerrain_nosub "DevTests/MovingTerrain/*/erf_moving_terrain.exe" "plt00020") -add_test_r(MovingTerrain_sub "DevTests/MovingTerrain/*/erf_moving_terrain.exe" "plt00010") -add_test_r(PoiseuilleFlow_x "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00010") -add_test_r(PoiseuilleFlow_y "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00010") -add_test_r(RayleighDamping "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00100") -add_test_r(ScalarAdvectionUniformU "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvectionShearedU "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00080") -add_test_r(ScalarAdvDiff_order2 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order3 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order4 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order5 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order6 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_weno3 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_d(ScalarAdvDiff_weno3z "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_weno5 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_d(ScalarAdvDiff_weno5z "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_wenomzq3 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarDiffusionGaussian "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarDiffusionSine "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(TaylorGreenAdvecting "DryRegTests/TaylorGreenVortex/*/erf_taylor_green.exe" "plt00010") -add_test_r(TaylorGreenAdvectingDiffusing "DryRegTests/TaylorGreenVortex/*/erf_taylor_green.exe" "plt00010") -add_test_r(MSF_NoSub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(MSF_Sub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(ABL_MOST "ABL/*/erf_abl.exe" "plt00010") -add_test_r(ABL_MYNN_PBL "ABL/*/erf_abl.exe" "plt00100" INPUT_SOUNDING "input_sounding_GABLS1") -add_test_r(ABL_InflowFile "ABL/*/erf_abl.exe" "plt00010") -add_test_r(MoistBubble "MoistRegTests/Bubble/*/erf_bubble.exe" "plt00010") -add_test_r(SquallLine_2D "MoistRegTests/SquallLine_2D/*/erf_squallline.exe" "plt00010") -add_test_r(SuperCell_3D "MoistRegTests/SuperCell_3D/*/erf_supercell.exe" "plt00010") - -add_test_0(Deardorff_stationary "ABL/*/erf_abl.exe" "plt00010") - -else() -add_test_r(CouetteFlow_x "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00050") -add_test_r(CouetteFlow_y "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00050") -add_test_r(DensityCurrent "DryRegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(DensityCurrent_anelastic "DryRegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(DensityCurrent_detJ2 "DryRegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(DensityCurrent_detJ2_nosub "DryRegTests/DensityCurrent/erf_density_current" "plt00020") -add_test_r(DensityCurrent_detJ2_MT "DryRegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(EkmanSpiral "DryRegTests/EkmanSpiral/erf_ekman_spiral" "plt00010") -add_test_r(IsentropicVortexStationary "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(IsentropicVortexAdvecting "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(IVA_NumDiff "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(MovingTerrain_nosub "DevTests/MovingTerrain/erf_moving_terrain" "plt00020") -add_test_r(MovingTerrain_sub "DevTests/MovingTerrain/erf_moving_terrain" "plt00010") -add_test_r(PoiseuilleFlow_x "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00010") -add_test_r(PoiseuilleFlow_y "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00010") -add_test_r(RayleighDamping "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00100") -add_test_r(ScalarAdvectionUniformU "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvectionShearedU "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00080") -add_test_r(ScalarAdvDiff_order2 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order3 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order4 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order5 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order6 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_weno3 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_d(ScalarAdvDiff_weno3z "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_weno5 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_d(ScalarAdvDiff_weno5z "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_wenomzq3 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarDiffusionGaussian "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarDiffusionSine "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(TaylorGreenAdvecting "DryRegTests/TaylorGreenVortex/erf_taylor_green" "plt00010") -add_test_r(TaylorGreenAdvectingDiffusing "DryRegTests/TaylorGreenVortex/erf_taylor_green" "plt00010") -add_test_r(MSF_NoSub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(MSF_Sub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(ABL_MOST "ABL/erf_abl" "plt00010") -add_test_r(ABL_MYNN_PBL "ABL/erf_abl" "plt00100" INPUT_SOUNDING "input_sounding_GABLS1") -add_test_r(ABL_InflowFile "ABL/erf_abl" "plt00010") -add_test_r(MoistBubble "MoistRegTests/Bubble/erf_bubble" "plt00010") -add_test_r(SquallLine_2D "MoistRegTests/SquallLine_2D/erf_squallline" "plt00010") -add_test_r(SuperCell_3D "MoistRegTests/SuperCell_3D/erf_supercell" "plt00010") - -add_test_0(InitSoundingIdeal_stationary "ABL/erf_abl" "plt00010") -add_test_0(Deardorff_stationary "ABL/erf_abl" "plt00010") -endif() + +add_test_r(CouetteFlow_x "DryRegTests/Couette_Poiseuille" "erf_couette_poiseuille" "plt00050") +add_test_r(CouetteFlow_y "DryRegTests/Couette_Poiseuille" "erf_couette_poiseuille" "plt00050") +add_test_r(DensityCurrent "DryRegTests/DensityCurrent" "erf_density_current" "plt00010") +add_test_r(DensityCurrent_anelastic "DryRegTests/DensityCurrent" "erf_density_current" "plt00010") +add_test_r(DensityCurrent_detJ2 "DryRegTests/DensityCurrent" "erf_density_current" "plt00010") +add_test_r(DensityCurrent_detJ2_nosub "DryRegTests/DensityCurrent" "erf_density_current" "plt00020") +add_test_r(DensityCurrent_detJ2_MT "DryRegTests/DensityCurrent" "erf_density_current" "plt00010") +add_test_r(EkmanSpiral "DryRegTests/EkmanSpiral" "erf_ekman_spiral" "plt00010") +add_test_r(IsentropicVortexStationary "DryRegTests/IsentropicVortex" "erf_isentropic_vortex" "plt00010") +add_test_r(IsentropicVortexAdvecting "DryRegTests/IsentropicVortex" "erf_isentropic_vortex" "plt00010") +add_test_r(IVA_NumDiff "DryRegTests/IsentropicVortex" "erf_isentropic_vortex" "plt00010") +add_test_r(MovingTerrain_nosub "DevTests/MovingTerrain" "erf_moving_terrain" "plt00020") +add_test_r(MovingTerrain_sub "DevTests/MovingTerrain" "erf_moving_terrain" "plt00010") +add_test_r(PoiseuilleFlow_x "DryRegTests/Couette_Poiseuille" "erf_couette_poiseuille" "plt00010") +add_test_r(PoiseuilleFlow_y "DryRegTests/Couette_Poiseuille" "erf_couette_poiseuille" "plt00010") +add_test_r(RayleighDamping "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00100") +add_test_r(ScalarAdvectionUniformU "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvectionShearedU "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00080") +add_test_r(ScalarAdvDiff_order2 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order3 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order4 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order5 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order6 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_weno3 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_d(ScalarAdvDiff_weno3z "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_weno5 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_d(ScalarAdvDiff_weno5z "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_wenomzq3 "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarDiffusionGaussian "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(ScalarDiffusionSine "DryRegTests/ScalarAdvDiff" "erf_scalar_advdiff" "plt00020") +add_test_r(TaylorGreenAdvecting "DryRegTests/TaylorGreenVortex" "erf_taylor_green" "plt00010") +add_test_r(TaylorGreenAdvectingDiffusing "DryRegTests/TaylorGreenVortex" "erf_taylor_green" "plt00010") +add_test_r(MSF_NoSub_IsentropicVortexAdv "DryRegTests/IsentropicVortex" "erf_isentropic_vortex" "plt00010") +add_test_r(MSF_Sub_IsentropicVortexAdv "DryRegTests/IsentropicVortex" "erf_isentropic_vortex" "plt00010") +add_test_r(ABL_MOST "ABL" "erf_abl" "plt00010") +add_test_r(ABL_MYNN_PBL "ABL" "erf_abl" "plt00100" INPUT_SOUNDING "input_sounding_GABLS1") +add_test_r(ABL_InflowFile "ABL" "erf_abl" "plt00010") +add_test_r(MoistBubble "MoistRegTests/Bubble" "erf_bubble" "plt00010") +add_test_r(SquallLine_2D "MoistRegTests/SquallLine_2D" "erf_squallline" "plt00010") +add_test_r(SuperCell_3D "MoistRegTests/SuperCell_3D" "erf_supercell" "plt00010") + +add_test_0(InitSoundingIdeal_stationary "ABL" "erf_abl" "plt00010") +add_test_0(Deardorff_stationary "ABL" "erf_abl" "plt00010") + #============================================================================= # Performance tests #=============================================================================