Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
e8f46834
Commit
e8f46834
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
common code -> macr
parent
8e491937
No related branches found
No related tags found
1 merge request
!773
new mechanism to steer simulation size in examples and tests, based on command-line argument sim_n
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Examples/CMakeLists.txt
+9
-11
9 additions, 11 deletions
Tests/Examples/CMakeLists.txt
with
9 additions
and
11 deletions
Tests/Examples/CMakeLists.txt
+
9
−
11
View file @
e8f46834
...
@@ -9,18 +9,21 @@ file(MAKE_DIRECTORY ${TEST_OUTPUT_DIR_PY_PERSIST})
...
@@ -9,18 +9,21 @@ file(MAKE_DIRECTORY ${TEST_OUTPUT_DIR_PY_PERSIST})
# Test scripts
# Test scripts
####################################################################################################
####################################################################################################
macro
(
parse_example example
)
cmake_path
(
SET EXAMPLE_SCRIPT NORMALIZE
${
EXAMPLES_DIR
}
/
${
example
}
.py
)
get_filename_component
(
EXAMPLE_NAME
${
EXAMPLE_SCRIPT
}
NAME_WE
)
get_filename_component
(
EXAMPLE_SUBDIR
${
example
}
DIRECTORY
)
endmacro
()
# Run one Python example.
# Run one Python example.
# Check whether the example executes, don't check results.
# Check whether the example executes, don't check results.
# If there are matplotlib commands, skip plt.show().
# If there are matplotlib commands, skip plt.show().
function
(
run_example example label
)
function
(
run_example example label
)
set
(
script_path
${
EXAMPLES_DIR
}
/
${
example
}
.py
)
parse_example
(
${
example
}
)
get_filename_component
(
EXAMPLE_NAME
${
script_path
}
NAME_WE
)
set
(
test_name Example.run.
${
EXAMPLE_NAME
}
)
set
(
test_name Example.run.
${
EXAMPLE_NAME
}
)
add_test
(
NAME
${
test_name
}
add_test
(
NAME
${
test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E env
COMMAND
${
CMAKE_COMMAND
}
-E env
BA_EXAMPLE_DATA_DIR=
${
EXAMPLES_DIR
}
/data
BA_EXAMPLE_DATA_DIR=
${
EXAMPLES_DIR
}
/data
NOSHOW=TRUE
${
Python3_EXECUTABLE
}
${
TOOL_DIR
}
/code/batch-plot.py
${
Python3_EXECUTABLE
}
${
TOOL_DIR
}
/code/batch-plot.py
-s
${
script_path
}
${
TEST_OUTPUT_DIR_PY_EXAMPLES
}
)
-s
${
script_path
}
${
TEST_OUTPUT_DIR_PY_EXAMPLES
}
)
if
(
NOT label STREQUAL
""
)
if
(
NOT label STREQUAL
""
)
...
@@ -30,9 +33,7 @@ endfunction()
...
@@ -30,9 +33,7 @@ endfunction()
# Run examples that don't plot.
# Run examples that don't plot.
function
(
run_noplot example
)
function
(
run_noplot example
)
cmake_path
(
SET EXAMPLE_SCRIPT NORMALIZE
${
EXAMPLES_DIR
}
/
${
example
}
.py
)
parse_example
(
${
example
}
)
get_filename_component
(
EXAMPLE_NAME
${
EXAMPLE_SCRIPT
}
NAME_WE
)
set
(
test_name Example.exec.
${
EXAMPLE_NAME
}
)
set
(
test_name Example.exec.
${
EXAMPLE_NAME
}
)
add_test
(
NAME
${
test_name
}
add_test
(
NAME
${
test_name
}
COMMAND
${
Python3_EXECUTABLE
}
-B
${
EXAMPLE_SCRIPT
}
COMMAND
${
Python3_EXECUTABLE
}
-B
${
EXAMPLE_SCRIPT
}
...
@@ -41,10 +42,7 @@ endfunction()
...
@@ -41,10 +42,7 @@ endfunction()
# Python equality test: run modified example, and compare with reference data of another example
# Python equality test: run modified example, and compare with reference data of another example
function
(
test_equality example reference tolerance
)
function
(
test_equality example reference tolerance
)
cmake_path
(
SET EXAMPLE_SCRIPT NORMALIZE
${
EXAMPLES_DIR
}
/
${
example
}
.py
)
parse_example
(
${
example
}
)
get_filename_component
(
EXAMPLE_NAME
${
EXAMPLE_SCRIPT
}
NAME_WE
)
get_filename_component
(
EXAMPLE_SUBDIR
${
example
}
DIRECTORY
)
set
(
test_name Example.persist.
${
EXAMPLE_NAME
}
)
set
(
test_name Example.persist.
${
EXAMPLE_NAME
}
)
add_test
(
NAME
${
test_name
}
add_test
(
NAME
${
test_name
}
COMMAND
${
CMAKE_COMMAND
}
COMMAND
${
CMAKE_COMMAND
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment