Skip to content
Snippets Groups Projects
Commit a6838a6e authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

[i339] RunEqualityTest now using correct reference data (#339) (Closes #339)

Merging branch 'i339'  into 'main'.

See merge request !1703
parents 820bcd31 82e2368a
No related branches found
No related tags found
1 merge request!1703RunEqualityTest now using correct reference data (#339)
Pipeline #102903 passed
......@@ -79,6 +79,8 @@ endfunction()
function(test_equality example reference tolerance nsim)
parse_example(${example})
string(REPLACE "/" "." TARGET_NAME Example.${example}.fig)
cmake_path(SET outfile NORMALIZE ${TEST_OUTPUT_DIR_PY_PERSIST}/${example})
cmake_path(SET reffile NORMALIZE ${REFERENCE_DIR_EXAMPLES_MINI}/${reference})
add_test(NAME ${TARGET_NAME}
COMMAND ${CMAKE_COMMAND}
-DPython3_EXECUTABLE=${Python3_EXECUTABLE}
......@@ -86,10 +88,9 @@ function(test_equality example reference tolerance nsim)
-Dxx_srcdir=${CMAKE_CURRENT_SOURCE_DIR}
-Dxx_datdir=${EXAMPLES_DIR}/data
-Dxx_name=${EXAMPLE_NAME}
-Dxx_subdir=${EXAMPLE_SUBDIR}
-Dxx_script=${EXAMPLE_SCRIPT}
-Dxx_outdir=${TEST_OUTPUT_DIR_PY_PERSIST}
-Dxx_refdir=${REFERENCE_DIR_EXAMPLES_MINI}
-Dxx_outfile=${outfile}
-Dxx_reffile=${reffile}
-Dxx_tolerance=${tolerance}
-Dxx_nsim=${nsim}
-P ${CMAKE_CURRENT_SOURCE_DIR}/RunEqualityTest.cmake)
......@@ -103,10 +104,10 @@ function(test_equality example reference tolerance nsim)
endfunction()
function(test_equality1d example reference tolerance)
test_equality(${example} ${example} ${tolerance} 50)
test_equality(${example} ${reference} ${tolerance} 50)
endfunction()
function(test_equality2d example reference tolerance)
test_equality(${example} ${example} ${tolerance} 11)
test_equality(${example} ${reference} ${tolerance} 11)
endfunction()
# Python persistence test: run modified example, and compare with reference data.
......@@ -156,7 +157,7 @@ test_example2d(scatter2d/BiMaterialCylinders 2e-10)
test_example2d(scatter2d/BoxesWithSpecularPeak 2e-10)
test_example2d(scatter2d/ConstantBackground 2e-10)
test_example2d(scatter2d/CoreShellNanoparticles 2e-10)
test_equality2d(scatter2d/CoreShellNanoparticles2 scatter2d/CoreShellNanoparticles 2e-10)
test_example2d(scatter2d/CoreShellNanoparticles2 2e-10)
test_example2d(scatter2d/CorrelatedRoughness 2e-10)
test_example2d(scatter2d/CosineRipplesAtRectLattice 2e-10)
test_example2d(scatter2d/CustomFormFactor 2e-10)
......
cmake_path(SET outfile NORMALIZE ${xx_outdir}/${xx_subdir}/${xx_name})
cmake_path(SET reffile NORMALIZE ${xx_refdir}/${xx_subdir}/${xx_name})
message(STATUS "RunEqualityTest step 1: Going to run ${xx_script}")
execute_process(COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${xx_bindir}/lib
BA_EXAMPLE_DATA_DIR=${xx_datdir}
${Python3_EXECUTABLE} -B
${xx_script} sim_n=${xx_nsim} show=n datfile=${outfile}
${xx_script} sim_n=${xx_nsim} show=n datfile=${xx_outfile}
TIMEOUT 10
RESULT_VARIABLE res)
if(NOT res EQUAL 0)
message(FATAL_ERROR "RunEqualityTest ${xx_name}: script ${xx_script} failed: ${res}")
endif()
set(xx_pycmd "${xx_srcdir}/CheckEquality.py ${outfile} ${reffile} ${xx_tolerance}")
set(xx_pycmd "${xx_srcdir}/CheckEquality.py ${xx_outfile} ${xx_reffile} ${xx_tolerance}")
message(STATUS "RunEqualityTest step 2: Going to run ${xx_pycmd}")
execute_process(COMMAND ${CMAKE_COMMAND} -E env
PYTHONPATH=${xx_bindir}/lib
${Python3_EXECUTABLE} -B
${xx_srcdir}/CheckEquality.py ${outfile} ${reffile} ${xx_tolerance}
${xx_srcdir}/CheckEquality.py ${xx_outfile} ${xx_reffile} ${xx_tolerance}
TIMEOUT 10
RESULT_VARIABLE res)
if(NOT res EQUAL 0)
......
No preview for this file type
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment