From 8f30b31c3450207e10b8c692861321dccbb4eef8 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 16 Dec 2020 09:21:56 +0100 Subject: [PATCH] Label XL for all but one scatter2d example --- Tests/Examples/CMakeLists.txt | 50 ++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/Tests/Examples/CMakeLists.txt b/Tests/Examples/CMakeLists.txt index d5c57348fac..13e979ccb62 100644 --- a/Tests/Examples/CMakeLists.txt +++ b/Tests/Examples/CMakeLists.txt @@ -1,23 +1,42 @@ ############################################################################### -# Tests/Functional/PyExamples/CMakeLists.txt -# -# Runs check_functionality.py over example scripts found in PY_EXAMPLES_DIR -# +# Run unmodified examples ############################################################################### -function(run_example example_path) - get_filename_component(example_name ${example_path} NAME_WE) - set(test_name Example.run.${example_name}) +set(test_script ${TOOL_DIR}/code/batch-plot.py) + +set(output_dir ${TEST_OUTPUT_DIR_PY_EXAMPLES}) +file(MAKE_DIRECTORY ${output_dir}) + +# Run one Python example. +# Check whether the example passes. +# Don't check results. +# If there are matplotlib commands, skip plt.show(). +function(run_example example label) + get_filename_component(name ${example} NAME_WE) + set(test_name Example.run.${name}) add_test(${test_name} env PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} NOSHOW=TRUE - ${Python3_EXECUTABLE} ${test_script} -s ${example_path} ${output_dir}) + ${Python3_EXECUTABLE} ${test_script} -s ${example} ${output_dir}) + if(NOT label STREQUAL "") + set_tests_properties(${test_name} PROPERTIES LABELS ${label}) + endif() endfunction() -set(output_dir ${TEST_OUTPUT_DIR_PY_EXAMPLES}) -file(MAKE_DIRECTORY ${output_dir}) +function(run_examples examples label) + foreach(example ${examples}) + run_example(${example} ${label}) + endforeach() +endfunction() + +# Examples from scatter2d; all but one prototype get the label XL +set(prototype ${EXAMPLES_DIR}/scatter2d/CylindersInDWBA.py) +file(GLOB examples ${EXAMPLES_DIR}/scatter2d/*.py) +list(REMOVE_ITEM examples ${prototype}) +run_example(${prototype} "") +run_examples(${examples} "XL") +# Examples from other directories file(GLOB examples - ${EXAMPLES_DIR}/scatter2d/*.py ${EXAMPLES_DIR}/specular/*.py ${EXAMPLES_DIR}/varia/*.py ${EXAMPLES_DIR}/fit55_Specular/FitSpecularBasics.py) @@ -26,15 +45,10 @@ if (WIN32) list(REMOVE_ITEM examples ${EXAMPLES_DIR}/scatter2d/Interference2DParaCrystal.py) endif() list(REMOVE_ITEM examples ${EXAMPLES_DIR}/varia/SimulationParameters.py) - -set(test_script ${TOOL_DIR}/code/batch-plot.py) - -foreach(example_path ${examples}) - run_example(${example_path}) -endforeach() +run_examples(${examples} "") ############################################################################ -# Tests/Functional/PyCore/persistence/CMakeLists.txt +# Check results of modified examples ############################################################################ set(OUTPUT_DIR ${TEST_OUTPUT_DIR_PY_PERSIST}) -- GitLab