Compare commits
339 Commits
split-list
...
jungfrau_d
Author | SHA1 | Date | |
---|---|---|---|
f7aedf7711 | |||
8c112efdb3 | |||
938e1e87ff | |||
82308daf7b | |||
aa99309caf | |||
a0f697ce71 | |||
14dd753397 | |||
7e43472b7b | |||
ac7c85029c | |||
639ea0eb56 | |||
659e204b35 | |||
2c2fb7358c | |||
d3646f0ac5 | |||
54a396065d | |||
7fdab08256 | |||
e2ef043e04 | |||
43dc9df6db | |||
10f89599e0 | |||
452fd1e457 | |||
7b817fa194 | |||
1a1c6b9b42 | |||
3e5d34647e | |||
591ff53b84 | |||
fff79fbbb6 | |||
1943e77b24 | |||
9315768159 | |||
f1a1391866 | |||
877bdb8979 | |||
bf0847e967 | |||
97dd329a7b | |||
6847175743 | |||
f90d8c6aff | |||
45ae8a41ab | |||
24fc5de58d | |||
7314c52c63 | |||
bc4d0452af | |||
97692ae3ab | |||
55f482f915 | |||
74d67261a9 | |||
741ee3b44c | |||
29be6f3b34 | |||
81e858ea4d | |||
0f8d099196 | |||
ab5aa78b8a | |||
3f6736ad23 | |||
3e654977ca | |||
1029ce9705 | |||
d114f8db90 | |||
9fd2866fc0 | |||
aff6e30b65 | |||
0224dccd2e | |||
fbada2e81a | |||
40d88002c0 | |||
3a8c7c6e2a | |||
2a1c89f712 | |||
0e0e7ea81f | |||
df938c2535 | |||
932e377765 | |||
0904d1db29 | |||
20720bc073 | |||
e14519c236 | |||
e2f08da3e6 | |||
181ac4f509 | |||
a0f5224d09 | |||
6a0d44e358 | |||
1094d5d30c | |||
9231dff626 | |||
92b447c83a | |||
aaa7576f7d | |||
96d7345124 | |||
4f13b29c7f | |||
a55ae38874 | |||
7683b18fa3 | |||
71dd43d252 | |||
fc7d3bcaea | |||
2f3b0e0b06 | |||
b0cffcd570 | |||
56d1994b8c | |||
668cff1c65 | |||
06d4c7ce37 | |||
c0f06fcfca | |||
33efd42bdc | |||
af5eb9fc12 | |||
61a939ef53 | |||
a3342f86d8 | |||
554f9dc2ee | |||
c4aa5ef7bb | |||
d7eadd5782 | |||
65930002b3 | |||
f5feb081ab | |||
714e456d7d | |||
b76d123df1 | |||
2eac75aa0b | |||
18558e1288 | |||
b853bd92c8 | |||
4da85b15a0 | |||
77d34d5b6e | |||
6472cc4dd7 | |||
67eef8ba75 | |||
91a338cf52 | |||
9b53a295e1 | |||
8cc8b58b05 | |||
ec9f360c75 | |||
dbf927901f | |||
9e16dcb1e6 | |||
eb88fabfbc | |||
92310f845c | |||
262140728f | |||
834b1e58ea | |||
5192be6784 | |||
5c0e1643f2 | |||
7dc014f19c | |||
02fd4b356e | |||
eac992ee03 | |||
4e3baf41cb | |||
72091f47d9 | |||
21cab38921 | |||
3d40fb2d2c | |||
83c2775d6c | |||
e3859c3097 | |||
833ca071c4 | |||
45884a72da | |||
61aa673be9 | |||
1bc6e7f978 | |||
202d88d6be | |||
266520741a | |||
faf7e0db82 | |||
7aaaeae30c | |||
86afb2bd0e | |||
a29466b396 | |||
c7259538e9 | |||
ff4ce48e5d | |||
f3beda6bcf | |||
8256b7ba84 | |||
7c4aa7f3a7 | |||
1e19b99a78 | |||
f591adccb8 | |||
7abe070ea8 | |||
708975acb5 | |||
849d3ba049 | |||
ee20cfab1e | |||
b46e107f35 | |||
91813a2c68 | |||
cedde395a0 | |||
c7169f3c36 | |||
dd6bb85230 | |||
bad8b99b25 | |||
001ce4a93e | |||
0527880747 | |||
d31446ce07 | |||
0cc0c2715b | |||
248306d570 | |||
6b4d6084f5 | |||
79c6f5310b | |||
f59b172cfd | |||
25d7781878 | |||
721f80a493 | |||
192ac229e9 | |||
4cbf8483ba | |||
77c1ffffb1 | |||
c16b19ed1f | |||
cafca86bbf | |||
89a06f099c | |||
6c7c91307b | |||
5fdb090926 | |||
d17fd54a9d | |||
9543171504 | |||
74f2783b10 | |||
4a5cb011f7 | |||
dce7dcbfd4 | |||
d00fd70d6d | |||
04146e683c | |||
4b7c5c5950 | |||
92b674354d | |||
8cb123cdcb | |||
6b5aa5ff66 | |||
2b377df0bd | |||
ec17529c52 | |||
404d3fa677 | |||
026d4019c5 | |||
31a4a46fb6 | |||
8c3691f767 | |||
70b2a41d5e | |||
39221f1230 | |||
fad308754b | |||
33f726ff7e | |||
cbacf471d6 | |||
f11db00aef | |||
951d4d6091 | |||
025b3a8d4c | |||
acf32a5524 | |||
55ba2afc05 | |||
498569a42a | |||
d6360ca197 | |||
05720c12ac | |||
85516e42c0 | |||
b35a8f0650 | |||
c284b24397 | |||
7256a1e422 | |||
69a11f8950 | |||
0270e18882 | |||
697c020a49 | |||
90b257a74d | |||
bb025adc09 | |||
1558ca2bb5 | |||
a7ab8aa9e6 | |||
3b4d36c3d4 | |||
59a0f5fac9 | |||
bbfb5df30d | |||
09f1a8956e | |||
d6c0f7be05 | |||
11d7ebd298 | |||
d9ea8e6747 | |||
5131245f0a | |||
6fc388bf78 | |||
24f28f14f4 | |||
45fd35b243 | |||
11a452545c | |||
b198b50377 | |||
df2d67d90d | |||
73ad238028 | |||
959d9aa5d1 | |||
45b837b42a | |||
969551ae37 | |||
05709e2f47 | |||
1fce125d47 | |||
d134e54810 | |||
ed9dc3b386 | |||
990848554c | |||
78fcb7eb98 | |||
94c4e4c352 | |||
3e23a38fc8 | |||
37b80bcc0d | |||
fc0306564c | |||
c38bebd615 | |||
5a4122ae7c | |||
2ccd03a3b0 | |||
c7c52c63cd | |||
c7ad548e4c | |||
7cd5bc8b2d | |||
8c2ee57591 | |||
c15e72510c | |||
ac1511c3b0 | |||
cd5aea895b | |||
5bf37a4f0d | |||
0bb800cc8a | |||
ed74e710d6 | |||
907d1655d1 | |||
a7ba5eb0d8 | |||
6bf1a944da | |||
3c77447868 | |||
046fb11e5e | |||
b89d56001e | |||
de204dee38 | |||
0ef030354f | |||
dccce9bf55 | |||
441c3dc5db | |||
afd9e29424 | |||
ce939b3cd6 | |||
0984654fd0 | |||
cd738106ec | |||
0e120330f4 | |||
bf0e0ac601 | |||
143682cfb1 | |||
18ab437ae5 | |||
3b56091e2f | |||
dcad6c80ce | |||
22686e1e25 | |||
e13ecc8625 | |||
ef3e01b9bd | |||
dffa4d9de5 | |||
dfca81208b | |||
37be7d0e2b | |||
49812a34ae | |||
133b82ad61 | |||
61e769773b | |||
23dce681b2 | |||
6abfdcb2c8 | |||
7481c7f0e6 | |||
3c2bbf6ad4 | |||
b8fec6c050 | |||
2f11681d3f | |||
12f8166d25 | |||
fd68a41918 | |||
9e5ec6a57b | |||
d45375947f | |||
73ae8c6151 | |||
615dd2a84f | |||
dc80dccb8a | |||
de34d85761 | |||
f747c908dc | |||
64d94b978b | |||
f810a9e9fb | |||
152186ee59 | |||
d9551fa07f | |||
8738c6b9a2 | |||
f701c731fb | |||
9d3134c3de | |||
563d644d2f | |||
e2306bd41c | |||
e379b98631 | |||
f98259adc9 | |||
88e0914405 | |||
9d8aa5fe91 | |||
dceea92f1a | |||
2815458652 | |||
d8140d8db9 | |||
5e71aeb85f | |||
3a51d107bd | |||
6b4a9be870 | |||
b4b38cb607 | |||
03e7a83e74 | |||
0869a975e4 | |||
2cebec90ee | |||
c611523352 | |||
a774c62cd4 | |||
550ed4b1c2 | |||
2c08c1e7ce | |||
2b0208bd98 | |||
05d8ef6277 | |||
228cfa35c0 | |||
f120f9c3dd | |||
262bf1b307 | |||
4d0090dfcc | |||
e98d60c26e | |||
cd3135c01d | |||
40dedb8b07 | |||
2e83db7d45 | |||
817736fcd5 | |||
660ed4c177 | |||
0d96272db5 | |||
38a6393dde | |||
4aa720eecb | |||
d68c3b73a8 | |||
ae8678cdc2 | |||
19e7ced332 | |||
f288390255 | |||
83600fcb15 | |||
921ae01bbe |
@ -2,5 +2,5 @@ BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
|
||||
UseTab: Never
|
||||
ColumnLimit: 100
|
||||
ColumnLimit: 80
|
||||
AlignConsecutiveAssignments: false
|
31
.clang-tidy
@ -1,7 +1,32 @@
|
||||
---
|
||||
Checks: '*, -google-runtime-references, -hicpp-no-array-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -fuchsia*,-readability-else-after-return,-readability-avoid-const-params-in-decls,-hicpp-signed-bitwise,-cppcoreguidelines-pro-bounds-constant-array-index,-llvm-header-guard,-readability-static-accessed-through-instance,-google-readability-todo'
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '.*'
|
||||
Checks: '*,
|
||||
-android-cloexec-fopen,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-fuchsia*,
|
||||
-readability-else-after-return,
|
||||
-readability-avoid-const-params-in-decls,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-llvm-header-guard,
|
||||
-readability-static-accessed-through-instance,
|
||||
-readability-braces-around-statements,
|
||||
-hicpp-signed-bitwise,
|
||||
-hicpp-no-array-decay,
|
||||
-hicpp-braces-around-statements,
|
||||
-google-runtime-references,
|
||||
-google-readability-todo,
|
||||
-google-readability-braces-around-statements'
|
||||
|
||||
HeaderFilterRegex: \.h
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
CheckOptions:
|
||||
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
|
||||
# - { key: readability-identifier-naming.FunctionCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
|
||||
# - { key: readability-identifier-naming.MethodCase, value: CamelCase }
|
||||
# - { key: readability-identifier-naming.StructCase, value: CamelCase }
|
||||
# - { key: readability-identifier-naming.VariableCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
|
||||
...
|
||||
|
2
.gitignore
vendored
@ -7,9 +7,11 @@ bin/
|
||||
*.out
|
||||
*.toc
|
||||
*.o
|
||||
.*
|
||||
build
|
||||
docs/
|
||||
RELEASE.txt
|
||||
Testing/
|
||||
|
||||
|
||||
*.pyc
|
||||
|
@ -25,7 +25,9 @@ install:
|
||||
- conda config --add channels slsdetectorgroup
|
||||
- conda update conda
|
||||
- conda update --all
|
||||
- conda install conda-build anaconda-client
|
||||
- conda install conda-build=3.17
|
||||
- conda install anaconda-client
|
||||
- conda install conda-verify
|
||||
|
||||
# Useful for debugging any issues with conda
|
||||
- conda info -a
|
||||
@ -37,12 +39,12 @@ install:
|
||||
- conda-build .
|
||||
|
||||
script:
|
||||
- echo "No test scripts to be run!"
|
||||
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
||||
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
all_branches: true
|
||||
branch: developer
|
||||
|
||||
|
118
CMakeLists.txt
Normal file → Executable file
@ -1,7 +1,9 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
# cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project(slsDetectorPackage)
|
||||
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
include(cmake/project_version.cmake)
|
||||
include(CheckIPOSupported)
|
||||
|
||||
# Include additional modules that are used unconditionally
|
||||
include(GNUInstallDirs)
|
||||
@ -28,59 +30,100 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(SLS_MASTER_PROJECT ON)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
option (SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
|
||||
option (SLS_USE_RECEIVER "Receiver" OFF)
|
||||
option (SLS_USE_TEXTCLIENT "Text Client" ON)
|
||||
option (SLS_USE_RECEIVER "Receiver" ON)
|
||||
option (SLS_USE_GUI "GUI" OFF)
|
||||
option (SLS_USE_TESTS "TESTS" ON)
|
||||
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" ON)
|
||||
option (SLS_USE_TESTS "TESTS" OFF)
|
||||
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
|
||||
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
||||
option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "No build type selected, default to Release")
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
#Add two fake libraries to manage options
|
||||
add_library(slsProjectOptions INTERFACE)
|
||||
add_library(slsProjectWarnings INTERFACE)
|
||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter #Needs to be slowly mitigated
|
||||
# -Wold-style-cast
|
||||
-Wnon-virtual-dtor
|
||||
-Woverloaded-virtual
|
||||
-Wdouble-promotion
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wdouble-promotion
|
||||
|
||||
)
|
||||
|
||||
|
||||
#Testing for minimum version for compilers
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# clang does not support -Wno-misleading-indentation
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
|
||||
message(FATAL_ERROR "Clang version must be at least 3.2!")
|
||||
endif()
|
||||
target_compile_options(slsProjectWarnings INTERFACE -Wshadow) #Clag does not warn on constructor
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation -Wno-stringop-truncation -Wno-class-memaccess")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wno-missing-field-initializers)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wno-misleading-indentation # mostly in rapidjson remove using clang format
|
||||
-Wduplicated-cond
|
||||
-Wnull-dereference )
|
||||
endif()
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wno-class-memaccess )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Suppressed warnings in GCC
|
||||
# -Wno-stringop-truncation happens when we do sls::strcpy_safe truncates string instead of overwrite buffer
|
||||
# -Wno-class-memaccess - on memcpy in rapidjson should be investigated upgrade implementation?
|
||||
# -Wno-misleading-indentation - until clang format
|
||||
|
||||
#set (CMAKE_CXX_STANDARD 11)
|
||||
#set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ")
|
||||
|
||||
if(SLS_USE_SANITIZER)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address,undefined")
|
||||
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address,undefiend")
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
|
||||
# Install fake the libraries
|
||||
install(TARGETS slsProjectOptions slsProjectWarnings
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
|
||||
|
||||
|
||||
find_package(Doxygen)
|
||||
find_package(ZeroMQ 4 REQUIRED)
|
||||
|
||||
if (SLS_USE_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif(SLS_USE_TESTS)
|
||||
|
||||
# Support library containing functionallity common to
|
||||
# detector and receiver
|
||||
# Common functionallity to detector and receiver
|
||||
add_subdirectory(slsSupportLib)
|
||||
|
||||
if (SLS_USE_TEXTCLIENT)
|
||||
@ -103,10 +146,6 @@ if (SLS_USE_GUI)
|
||||
endif()
|
||||
endif (SLS_USE_GUI)
|
||||
|
||||
if (SLS_USE_TESTS)
|
||||
enable_testing()
|
||||
endif(SLS_USE_TESTS)
|
||||
|
||||
if (SLS_USE_INTEGRATION_TESTS)
|
||||
add_subdirectory(integrationTests)
|
||||
endif (SLS_USE_INTEGRATION_TESTS)
|
||||
@ -115,6 +154,26 @@ if (SLS_USE_PYTHON)
|
||||
add_subdirectory(python)
|
||||
endif(SLS_USE_PYTHON)
|
||||
|
||||
configure_file( .clang-tidy
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy
|
||||
)
|
||||
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in)
|
||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||
|
||||
# note the option ALL which allows to build the docs together with the application
|
||||
add_custom_target( docs
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM )
|
||||
else (DOXYGEN_FOUND)
|
||||
message("Doxygen need to be installed to generate the doxygen documentation")
|
||||
endif (DOXYGEN_FOUND)
|
||||
|
||||
|
||||
if(SLS_MASTER_PROJECT)
|
||||
# Set install dir CMake packages
|
||||
@ -124,4 +183,3 @@ if(SLS_MASTER_PROJECT)
|
||||
# Generate and install package config file and version
|
||||
include(cmake/package_config.cmake)
|
||||
endif()
|
||||
|
||||
|
0
RELEASE.txt
Normal file → Executable file
0
catch/catch.hpp
Normal file → Executable file
175
cmake/Catch.cmake
Executable file
@ -0,0 +1,175 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
Catch
|
||||
-----
|
||||
|
||||
This module defines a function to help use the Catch test framework.
|
||||
|
||||
The :command:`catch_discover_tests` discovers tests by asking the compiled test
|
||||
executable to enumerate its tests. This does not require CMake to be re-run
|
||||
when tests change. However, it may not work in a cross-compiling environment,
|
||||
and setting test properties is less convenient.
|
||||
|
||||
This command is intended to replace use of :command:`add_test` to register
|
||||
tests, and will create a separate CTest test for each Catch test case. Note
|
||||
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||
cannot be shared by multiple test cases executing in the same instance.
|
||||
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||
usually considered as more beneficial. By default, the CTest test name is the
|
||||
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||
|
||||
.. command:: catch_discover_tests
|
||||
|
||||
Automatically add tests with CTest by querying the compiled test executable
|
||||
for available tests::
|
||||
|
||||
catch_discover_tests(target
|
||||
[TEST_SPEC arg1...]
|
||||
[EXTRA_ARGS arg1...]
|
||||
[WORKING_DIRECTORY dir]
|
||||
[TEST_PREFIX prefix]
|
||||
[TEST_SUFFIX suffix]
|
||||
[PROPERTIES name1 value1...]
|
||||
[TEST_LIST var]
|
||||
)
|
||||
|
||||
``catch_discover_tests`` sets up a post-build command on the test executable
|
||||
that generates the list of tests by parsing the output from running the test
|
||||
with the ``--list-test-names-only`` argument. This ensures that the full
|
||||
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||
not necessary to re-run CMake when the list of tests changes.
|
||||
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||
in order to function in a cross-compiling environment.
|
||||
|
||||
Additionally, setting properties on tests is somewhat less convenient, since
|
||||
the tests are not available at CMake time. Additional test properties may be
|
||||
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||
more fine-grained test control is needed, custom content may be provided
|
||||
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||
directory property. The set of discovered tests is made accessible to such a
|
||||
script via the ``<target>_TESTS`` variable.
|
||||
|
||||
The options are:
|
||||
|
||||
``target``
|
||||
Specifies the Catch executable, which must be a known CMake executable
|
||||
target. CMake will substitute the location of the built executable when
|
||||
running the test.
|
||||
|
||||
``TEST_SPEC arg1...``
|
||||
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||
pass to the Catch executable with the ``--list-test-names-only`` argument.
|
||||
|
||||
``EXTRA_ARGS arg1...``
|
||||
Any extra arguments to pass on the command line to each test case.
|
||||
|
||||
``WORKING_DIRECTORY dir``
|
||||
Specifies the directory in which to run the discovered test cases. If this
|
||||
option is not provided, the current binary directory is used.
|
||||
|
||||
``TEST_PREFIX prefix``
|
||||
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||
case. This can be useful when the same test executable is being used in
|
||||
multiple calls to ``catch_discover_tests()`` but with different
|
||||
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||
|
||||
``TEST_SUFFIX suffix``
|
||||
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||
be specified.
|
||||
|
||||
``PROPERTIES name1 value1...``
|
||||
Specifies additional properties to be set on all tests discovered by this
|
||||
invocation of ``catch_discover_tests``.
|
||||
|
||||
``TEST_LIST var``
|
||||
Make the list of tests available in the variable ``var``, rather than the
|
||||
default ``<target>_TESTS``. This can be useful when the same test
|
||||
executable is being used in multiple calls to ``catch_discover_tests()``.
|
||||
Note that this variable is only available in CTest.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
function(catch_discover_tests TARGET)
|
||||
cmake_parse_arguments(
|
||||
""
|
||||
""
|
||||
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
|
||||
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(NOT _WORKING_DIRECTORY)
|
||||
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
if(NOT _TEST_LIST)
|
||||
set(_TEST_LIST ${TARGET}_TESTS)
|
||||
endif()
|
||||
|
||||
## Generate a unique name based on the extra arguments
|
||||
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||
|
||||
# Define rule to generate test list for aforementioned test executable
|
||||
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||
get_property(crosscompiling_emulator
|
||||
TARGET ${TARGET}
|
||||
PROPERTY CROSSCOMPILING_EMULATOR
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET} POST_BUILD
|
||||
BYPRODUCTS "${ctest_tests_file}"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "TEST_TARGET=${TARGET}"
|
||||
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||
-D "TEST_LIST=${_TEST_LIST}"
|
||||
-D "CTEST_FILE=${ctest_tests_file}"
|
||||
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
file(WRITE "${ctest_include_file}"
|
||||
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||
" include(\"${ctest_tests_file}\")\n"
|
||||
"else()\n"
|
||||
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||
"endif()\n"
|
||||
)
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||
set_property(DIRECTORY
|
||||
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||
if (NOT ${test_include_file_set})
|
||||
set_property(DIRECTORY
|
||||
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
###############################################################################
|
||||
|
||||
set(_CATCH_DISCOVER_TESTS_SCRIPT
|
||||
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
|
||||
)
|
78
cmake/CatchAddTests.cmake
Executable file
@ -0,0 +1,78 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
set(prefix "${TEST_PREFIX}")
|
||||
set(suffix "${TEST_SUFFIX}")
|
||||
set(spec ${TEST_SPEC})
|
||||
set(extra_args ${TEST_EXTRA_ARGS})
|
||||
set(properties ${TEST_PROPERTIES})
|
||||
set(script)
|
||||
set(suite)
|
||||
set(tests)
|
||||
|
||||
function(add_command NAME)
|
||||
set(_args "")
|
||||
foreach(_arg ${ARGN})
|
||||
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||
else()
|
||||
set(_args "${_args} ${_arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Run test executable to get list of available tests
|
||||
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||
message(FATAL_ERROR
|
||||
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
||||
OUTPUT_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
||||
if(${result} EQUAL 0)
|
||||
message(WARNING
|
||||
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
|
||||
)
|
||||
elseif(${result} LESS 0)
|
||||
message(FATAL_ERROR
|
||||
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||
" Result: ${result}\n"
|
||||
" Output: ${output}\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" output "${output}")
|
||||
|
||||
# Parse output
|
||||
foreach(line ${output})
|
||||
set(test ${line})
|
||||
# use escape commas to handle properly test cases with commans inside the name
|
||||
string(REPLACE "," "\\," test_name ${test})
|
||||
# ...and add to script
|
||||
add_command(add_test
|
||||
"${prefix}${test}${suffix}"
|
||||
${TEST_EXECUTOR}
|
||||
"${TEST_EXECUTABLE}"
|
||||
"${test_name}"
|
||||
${extra_args}
|
||||
)
|
||||
add_command(set_tests_properties
|
||||
"${prefix}${test}${suffix}"
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
${properties}
|
||||
)
|
||||
list(APPEND tests "${prefix}${test}${suffix}")
|
||||
endforeach()
|
||||
|
||||
# Create a list of all discovered tests, which users may use to e.g. set
|
||||
# properties on the tests
|
||||
add_command(set ${TEST_LIST} ${tests})
|
||||
|
||||
# Write CTest script
|
||||
file(WRITE "${CTEST_FILE}" "${script}")
|
0
cmake/FindCBF.cmake
Normal file → Executable file
0
cmake/FindQwt.cmake
Normal file → Executable file
0
cmake/FindROOT.cmake
Normal file → Executable file
0
cmake/FindZeroMQ.cmake
Normal file → Executable file
203
cmake/ParseAndAddCatchTests.cmake
Executable file
@ -0,0 +1,203 @@
|
||||
#==================================================================================================#
|
||||
# supported macros #
|
||||
# - TEST_CASE, #
|
||||
# - SCENARIO, #
|
||||
# - TEST_CASE_METHOD, #
|
||||
# - CATCH_TEST_CASE, #
|
||||
# - CATCH_SCENARIO, #
|
||||
# - CATCH_TEST_CASE_METHOD. #
|
||||
# #
|
||||
# Usage #
|
||||
# 1. make sure this module is in the path or add this otherwise: #
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||
# 2. make sure that you've enabled testing option for the project by the call: #
|
||||
# enable_testing() #
|
||||
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
|
||||
# project(testing_target) #
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||
# enable_testing() #
|
||||
# #
|
||||
# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
|
||||
# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
|
||||
# #
|
||||
# file(GLOB SOURCE_FILES "*.cpp") #
|
||||
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
|
||||
# #
|
||||
# include(ParseAndAddCatchTests) #
|
||||
# ParseAndAddCatchTests(${PROJECT_NAME}) #
|
||||
# #
|
||||
# The following variables affect the behavior of the script: #
|
||||
# #
|
||||
# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
|
||||
# -- enables debug messages #
|
||||
# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
|
||||
# -- excludes tests marked with [!hide], [.] or [.foo] tags #
|
||||
# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
|
||||
# -- adds fixture class name to the test name #
|
||||
# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
|
||||
# -- adds cmake target name to the test name #
|
||||
# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
|
||||
# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
|
||||
# #
|
||||
# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way #
|
||||
# a test should be run. For instance to use test MPI, one can write #
|
||||
# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) #
|
||||
# just before calling this ParseAndAddCatchTests function #
|
||||
# #
|
||||
#==================================================================================================#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
|
||||
option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
|
||||
option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
|
||||
option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
|
||||
option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
|
||||
option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
|
||||
|
||||
function(PrintDebugMessage)
|
||||
if(PARSE_CATCH_TESTS_VERBOSE)
|
||||
message(STATUS "ParseAndAddCatchTests: ${ARGV}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# This removes the contents between
|
||||
# - block comments (i.e. /* ... */)
|
||||
# - full line comments (i.e. // ... )
|
||||
# contents have been read into '${CppCode}'.
|
||||
# !keep partial line comments
|
||||
function(RemoveComments CppCode)
|
||||
string(ASCII 2 CMakeBeginBlockComment)
|
||||
string(ASCII 3 CMakeEndBlockComment)
|
||||
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
|
||||
|
||||
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Worker function
|
||||
function(ParseFile SourceFile TestTarget)
|
||||
# According to CMake docs EXISTS behavior is well-defined only for full paths.
|
||||
get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
|
||||
if(NOT EXISTS ${SourceFile})
|
||||
message(WARNING "Cannot find source file: ${SourceFile}")
|
||||
return()
|
||||
endif()
|
||||
PrintDebugMessage("parsing ${SourceFile}")
|
||||
file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
|
||||
|
||||
# Remove block and fullline comments
|
||||
RemoveComments(Contents)
|
||||
|
||||
# Find definition of test names
|
||||
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
|
||||
|
||||
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
||||
PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
||||
set_property(
|
||||
DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(TestName ${Tests})
|
||||
# Strip newlines
|
||||
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
||||
|
||||
# Get test type and fixture if applicable
|
||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
||||
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
||||
|
||||
# Get string parts of test definition
|
||||
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
|
||||
|
||||
# Strip wrapping quotation marks
|
||||
string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
|
||||
string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
|
||||
|
||||
# Validate that a test name and tags have been provided
|
||||
list(LENGTH TestStrings TestStringsLength)
|
||||
if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
|
||||
message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
|
||||
endif()
|
||||
|
||||
# Assign name and tags
|
||||
list(GET TestStrings 0 Name)
|
||||
if("${TestType}" STREQUAL "SCENARIO")
|
||||
set(Name "Scenario: ${Name}")
|
||||
endif()
|
||||
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
|
||||
set(CTestName "${TestFixture}:${Name}")
|
||||
else()
|
||||
set(CTestName "${Name}")
|
||||
endif()
|
||||
if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
|
||||
set(CTestName "${TestTarget}:${CTestName}")
|
||||
endif()
|
||||
# add target to labels to enable running all tests added from this target
|
||||
set(Labels ${TestTarget})
|
||||
if(TestStringsLength EQUAL 2)
|
||||
list(GET TestStrings 1 Tags)
|
||||
string(TOLOWER "${Tags}" Tags)
|
||||
# remove target from labels if the test is hidden
|
||||
if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
|
||||
list(REMOVE_ITEM Labels ${TestTarget})
|
||||
endif()
|
||||
string(REPLACE "]" ";" Tags "${Tags}")
|
||||
string(REPLACE "[" "" Tags "${Tags}")
|
||||
else()
|
||||
# unset tags variable from previous loop
|
||||
unset(Tags)
|
||||
endif()
|
||||
|
||||
list(APPEND Labels ${Tags})
|
||||
|
||||
list(FIND Labels "!hide" IndexOfHideLabel)
|
||||
set(HiddenTagFound OFF)
|
||||
foreach(label ${Labels})
|
||||
string(REGEX MATCH "^!hide|^\\." result ${label})
|
||||
if(result)
|
||||
set(HiddenTagFound ON)
|
||||
break()
|
||||
endif(result)
|
||||
endforeach(label)
|
||||
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
|
||||
PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
|
||||
else()
|
||||
PrintDebugMessage("Adding test \"${CTestName}\"")
|
||||
if(Labels)
|
||||
PrintDebugMessage("Setting labels to ${Labels}")
|
||||
endif()
|
||||
|
||||
# Escape commas in the test spec
|
||||
string(REPLACE "," "\\," Name ${Name})
|
||||
|
||||
# Add the test and set its properties
|
||||
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} ${TestTarget} ${Name} ${AdditionalCatchParameters})
|
||||
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
||||
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||
PrintDebugMessage("Setting DISABLED test property")
|
||||
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
|
||||
else()
|
||||
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||
LABELS "${Labels}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# entry point
|
||||
function(ParseAndAddCatchTests TestTarget)
|
||||
PrintDebugMessage("Started parsing ${TestTarget}")
|
||||
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
||||
PrintDebugMessage("Found the following sources: ${SourceFiles}")
|
||||
foreach(SourceFile ${SourceFiles})
|
||||
ParseFile(${SourceFile} ${TestTarget})
|
||||
endforeach()
|
||||
PrintDebugMessage("Finished parsing ${TestTarget}")
|
||||
endfunction()
|
0
cmake/package_config.cmake
Normal file → Executable file
0
cmake/project-config.cmake.in
Normal file → Executable file
0
cmake/project_version.cc.in
Normal file → Executable file
48
cmake/project_version.cmake
Normal file → Executable file
@ -57,28 +57,28 @@ if (GIT_CMD AND NOT "${GIT_TOPLEVEL}" STREQUAL "")
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
#message(STATUS "GIT_DESCRIBE: " ${GIT_DESCRIBE})
|
||||
|
||||
if (GIT_DESCRIBE)
|
||||
string(REGEX REPLACE "v?([0-9.]+).*" "\\1" GIT_VERSION ${GIT_DESCRIBE})
|
||||
message(STATUS "GIT_VERSION: " ${GIT_VERSION})
|
||||
# if (GIT_DESCRIBE)
|
||||
# string(REGEX REPLACE "v?([0-9.]+).*" "\\1" GIT_VERSION ${GIT_DESCRIBE})
|
||||
# message(STATUS "GIT_VERSION: " ${GIT_VERSION})
|
||||
|
||||
# as package version we use the full version from git describe: 1.7.1+7+ge324c81
|
||||
if (GIT_DESCRIBE MATCHES ".*-g.*")
|
||||
# convert a git describe string to usable debian version, e.g. v1.7.1-7-ge324c81 to 1.7.1+7+ge324c81
|
||||
string(REGEX REPLACE "v?([0-9]*.[0-9.]*).*-([0-9]*)-([a-g0-9]*)" "\\1+\\2+\\3" GIT_FULL_VERSION ${GIT_DESCRIBE})
|
||||
else()
|
||||
# current HEAD is git tag (i.e. releaase), directly use the version
|
||||
set(GIT_FULL_VERSION ${GIT_VERSION})
|
||||
endif()
|
||||
else ()
|
||||
# no (suitable) tag found
|
||||
set(GIT_VERSION "0.0.0")
|
||||
# get number of commits in repo
|
||||
execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD
|
||||
WORKING_DIRECTORY ${GIT_TOPLEVEL}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_COUNT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(GIT_FULL_VERSION 0.0.0+${GIT_COMMIT_COUNT}+g${GIT_SHA1})
|
||||
endif ()
|
||||
# # as package version we use the full version from git describe: 1.7.1+7+ge324c81
|
||||
# if (GIT_DESCRIBE MATCHES ".*-g.*")
|
||||
# # convert a git describe string to usable debian version, e.g. v1.7.1-7-ge324c81 to 1.7.1+7+ge324c81
|
||||
# string(REGEX REPLACE "v?([0-9]*.[0-9.]*).*-([0-9]*)-([a-g0-9]*)" "\\1+\\2+\\3" GIT_FULL_VERSION ${GIT_DESCRIBE})
|
||||
# else()
|
||||
# # current HEAD is git tag (i.e. releaase), directly use the version
|
||||
# set(GIT_FULL_VERSION ${GIT_VERSION})
|
||||
# endif()
|
||||
# else ()
|
||||
# # no (suitable) tag found
|
||||
# set(GIT_VERSION "0.0.0")
|
||||
# # get number of commits in repo
|
||||
# execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD
|
||||
# WORKING_DIRECTORY ${GIT_TOPLEVEL}
|
||||
# OUTPUT_VARIABLE GIT_COMMIT_COUNT
|
||||
# OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# set(GIT_FULL_VERSION 0.0.0+${GIT_COMMIT_COUNT}+g${GIT_SHA1})
|
||||
# endif ()
|
||||
endif ()
|
||||
|
||||
# get version from package.xml if it exists
|
||||
@ -104,10 +104,10 @@ if (NOT PROJECT_VERSION)
|
||||
set(PROJECT_VERSION "0.0.0")
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT PACKAGE_VERSION)
|
||||
message(WARNING "PACKAGE_VERSION not set! Falling back to (${PROJECT_VERSION})")
|
||||
# if (NOT PACKAGE_VERSION)
|
||||
# message(WARNING "PACKAGE_VERSION not set! Falling back to (${PROJECT_VERSION})")
|
||||
set(PACKAGE_VERSION ${PROJECT_VERSION})
|
||||
endif ()
|
||||
# endif ()
|
||||
|
||||
# warn if versions don't match
|
||||
if (GIT_VERSION AND NOT GIT_VERSION MATCHES ${PROJECT_VERSION})
|
||||
|
0
cmake/project_version.h.in
Normal file → Executable file
64
cmk.sh
@ -7,6 +7,7 @@ TEXTCLIENT=0
|
||||
RECEIVER=0
|
||||
GUI=0
|
||||
DEBUG=0
|
||||
PYTHON=0
|
||||
|
||||
|
||||
CLEAN=0
|
||||
@ -15,10 +16,11 @@ CMAKE_PRE=""
|
||||
CMAKE_POST=""
|
||||
|
||||
usage() { echo -e "
|
||||
Usage: $0 [-c] [-b] [-h] [-d <HDF5 directory>] [-j]
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
-p: Builds/Rebuilds Python API
|
||||
-h: Builds/Rebuilds Cmake files with HDF5 package
|
||||
-d: HDF5 Custom Directory
|
||||
-t: Build/Rebuilds only text client
|
||||
@ -26,6 +28,12 @@ Usage: $0 [-c] [-b] [-h] [-d <HDF5 directory>] [-j]
|
||||
-g: Build/Rebuilds only gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
|
||||
Rebuild when you switch to a new build and compile in parallel:
|
||||
./cmk.sh -bj5
|
||||
|
||||
Rebuild python
|
||||
./cmk.sh -p
|
||||
|
||||
For only make:
|
||||
./cmk.sh
|
||||
@ -55,12 +63,17 @@ For rebuilding only certain sections
|
||||
|
||||
" ; exit 1; }
|
||||
|
||||
while getopts ":bchd:j:trge" opt ; do
|
||||
while getopts ":bpchd:j:trges:" opt ; do
|
||||
case $opt in
|
||||
b)
|
||||
echo "Building of CMake files Required"
|
||||
REBUILD=1
|
||||
;;
|
||||
p)
|
||||
echo "Compiling Options: Python"
|
||||
PYTHON=1
|
||||
REBUILD=1
|
||||
;;
|
||||
c)
|
||||
echo "Clean Required"
|
||||
CLEAN=1
|
||||
@ -96,7 +109,7 @@ while getopts ":bchd:j:trge" opt ; do
|
||||
e)
|
||||
echo "Compiling Options: Debug"
|
||||
DEBUG=1
|
||||
;;
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
usage
|
||||
@ -111,28 +124,30 @@ while getopts ":bchd:j:trge" opt ; do
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
#python
|
||||
if [ $PYTHON -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_PYTHON=ON "
|
||||
echo "Enabling Compile Option: Python"
|
||||
fi
|
||||
|
||||
|
||||
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
|
||||
# CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON "
|
||||
echo "Compile Option: TextClient, Receiver and GUI"
|
||||
#CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=OFF "
|
||||
echo "Enabling Compile Option: TextClient, Receiver and GUI"
|
||||
else
|
||||
if [ $TEXTCLIENT -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
|
||||
echo "Compile Option: TextClient"
|
||||
fi
|
||||
if [ $RECEIVER -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_RECEIVER=ON "
|
||||
echo "Compile Option: Receiver"
|
||||
fi
|
||||
|
||||
if [ $GUI -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_GUI=ON "
|
||||
echo "Compile Option: GUI"
|
||||
fi
|
||||
if [ $TEXTCLIENT -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
|
||||
echo "Enabling Compile Option: TextClient"
|
||||
fi
|
||||
if [ $RECEIVER -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_RECEIVER=ON "
|
||||
echo "Enabling Compile Option: Receiver"
|
||||
fi
|
||||
if [ $GUI -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_GUI=ON "
|
||||
echo "Enabling Compile Option: GUI"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -154,14 +169,15 @@ fi
|
||||
|
||||
#Debug
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
echo "Debug Option enabled"
|
||||
fi
|
||||
|
||||
|
||||
#hdf5 rebuild
|
||||
if [ $HDF5 -eq 1 ]; then
|
||||
CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
|
||||
# CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
|
||||
CMAKE_POST+=" -DCMAKE_INSTALL_PREFIX="$HDF5DIR
|
||||
CMAKE_POST+=" -DSLS_USE_HDF5=ON "
|
||||
#normal mode rebuild
|
||||
else
|
||||
@ -178,7 +194,7 @@ echo "in "$PWD
|
||||
#cmake
|
||||
if [ $REBUILD -eq 1 ]; then
|
||||
rm -f CMakeCache.txt
|
||||
BUILDCOMMAND="$CMAKE_PRE cmake $CMAKE_POST .."
|
||||
BUILDCOMMAND="$CMAKE_PRE cmake3 $CMAKE_POST .."
|
||||
echo $BUILDCOMMAND
|
||||
eval $BUILDCOMMAND
|
||||
fi
|
||||
|
6
conda-recepie/build.sh
Normal file → Executable file
@ -7,9 +7,13 @@ cmake .. \
|
||||
-DSLS_USE_TEXTCLIENT=ON \
|
||||
-DSLS_USE_RECEIVER=ON \
|
||||
-DSLS_USE_GUI=OFF \
|
||||
-DSLS_USE_TESTS=ON \
|
||||
-DSLS_USE_PYTHON=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DSLS_USE_HDF5=OFF\
|
||||
|
||||
|
||||
cmake --build . -- -j10
|
||||
cmake --build . --target install
|
||||
cmake --build . --target install
|
||||
|
||||
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
14
conda-recepie/build_pylib.sh
Executable file
@ -0,0 +1,14 @@
|
||||
|
||||
# mkdir $PREFIX/lib
|
||||
# mkdir $PREFIX/include
|
||||
|
||||
|
||||
# #Shared and static libraries
|
||||
# cp build/bin/_sls_detector* $PREFIX/lib/.
|
||||
|
||||
|
||||
# #Binaries
|
||||
# cp -r build/bin/sls_detector $PREFIX/lib/.
|
||||
|
||||
cd python
|
||||
${PYTHON} setup.py install
|
0
conda-recepie/copy_gui.sh
Normal file → Executable file
0
conda-recepie/copy_lib.sh
Normal file → Executable file
42
conda-recepie/meta.yaml
Normal file → Executable file
@ -1,13 +1,13 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: "refactor"
|
||||
version: "developer"
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
|
||||
build:
|
||||
number: 0
|
||||
number: 1
|
||||
rpaths:
|
||||
- lib/
|
||||
|
||||
@ -16,8 +16,8 @@ requirements:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- cmake
|
||||
- qwt 6.*
|
||||
- qt=4.8.7=7
|
||||
# - qwt 6.* #require qt5 investigate befor activating gui
|
||||
# - qt=4.8.7=7
|
||||
- zeromq=4.2.5=hfc679d8_5
|
||||
- pyzmq
|
||||
- xorg-libx11
|
||||
@ -30,14 +30,13 @@ requirements:
|
||||
- {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||
- {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||
- {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||
- {{ cdt('libselinux') }} # [linux]
|
||||
- {{ cdt('libselinux') }} # [linux]
|
||||
- {{ cdt('libxdamage') }} # [linux]
|
||||
- {{ cdt('libxxf86vm') }} # [linux]
|
||||
|
||||
host:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- libpng >=1.6.32,<1.6.35
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
@ -50,18 +49,41 @@ requirements:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
|
||||
outputs:
|
||||
- name: sls_detector_lib
|
||||
version: "refactor"
|
||||
script: copy_lib.sh
|
||||
|
||||
- name: sls_detector
|
||||
script: build_pylib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- python {{ python }}
|
||||
- setuptools
|
||||
- sls_detector_lib
|
||||
- pyzmq
|
||||
- pybind11 2.2
|
||||
host:
|
||||
- python
|
||||
- pybind11 2.2
|
||||
- pyzmq
|
||||
- sls_detector_lib
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
run:
|
||||
- python
|
||||
- numpy
|
||||
- sls_detector_lib=developer
|
||||
- pyzmq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
test:
|
||||
imports:
|
||||
- sls_detector
|
||||
|
||||
# - name: sls_detector
|
||||
# version: "refactor"
|
||||
# script: copy_lib.sh
|
||||
# requirements:
|
||||
# build:
|
||||
# - {{ compiler('c') }}
|
||||
|
1
conda-recepie/run_test.sh
Executable file
@ -0,0 +1 @@
|
||||
ctest -j2
|
58
configure
vendored
@ -1,58 +0,0 @@
|
||||
##!/bin/bash
|
||||
|
||||
: ${INSTALLROOT=$PWD}
|
||||
read -p "Installation directory [default:\"$INSTALLROOT\"]:" -e t3
|
||||
if [ -z "$t3" ]
|
||||
then
|
||||
echo
|
||||
else
|
||||
INSTALLROOT=$t3
|
||||
fi
|
||||
echo "INSTALLROOT will be \"$INSTALLROOT\""
|
||||
export INSTALLROOT
|
||||
|
||||
: ${BINDIR="bin"}
|
||||
read -p "Binaries directory [default:\"$BINDIR\"]:" -e t4
|
||||
if [ -z "$t4" ]
|
||||
then
|
||||
BINDIR=$INSTALLROOT/$BINDIR
|
||||
else
|
||||
BINDIR=$INSTALLROOT/$t4
|
||||
fi
|
||||
echo "BINDIR will be \"$BINDIR\""
|
||||
export BINDIR
|
||||
|
||||
: ${LIBDIR="bin"}
|
||||
read -p "Libraries directory [default:\"$LIBDIR\"]:" -e t5
|
||||
if [ -z "$t5" ]
|
||||
then
|
||||
LIBDIR=$INSTALLROOT/$LIBDIR
|
||||
else
|
||||
LIBDIR=$INSTALLROOT/$t5
|
||||
fi
|
||||
echo "LIBDIR will be \"$LIBDIR\""
|
||||
export LIBDIR
|
||||
|
||||
: ${INCDIR="include"}
|
||||
read -p "Includes directory [default:\"$INCDIR\"]:" -e t6
|
||||
if [ -z "$t6" ]
|
||||
then
|
||||
INCDIR=$INSTALLROOT/$INCDIR
|
||||
else
|
||||
INCDIR=$INSTALLROOT/$t6
|
||||
fi
|
||||
echo "INCDIR will be \"$INCDIR\""
|
||||
export INCDIR
|
||||
|
||||
: ${DOCDIR="doc"}
|
||||
read -p "Documentation directory [default:\"$DOCDIR\"]:" -e t7
|
||||
if [ -z "$t7" ]
|
||||
then
|
||||
DOCDIR=$INSTALLROOT/$DOCDIR
|
||||
else
|
||||
DOCDIR=$INSTALLROOT/$t7
|
||||
fi
|
||||
echo "DOCDIR will be \"$DOCDIR\""
|
||||
export DOCDIR
|
||||
|
||||
|
2482
doxygen/Doxyfile.in
Normal file
0
evalVersionVariables.sh
Normal file → Executable file
@ -1,24 +0,0 @@
|
||||
module 0 center 6.395E+02 +- 0.00E+00 conversion 6.5660E-05 +- 7.10E-09 offset 0.00000 +- 0.00015
|
||||
module 1 center 6.395E+02 +- 0.00E+00 conversion 6.5650E-05 +- 7.09E-09 offset 5.00211 +- 0.00015
|
||||
module 2 center 6.395E+02 +- 0.00E+00 conversion 6.5625E-05 +- 7.09E-09 offset 10.00733 +- 0.00015
|
||||
module 3 center 6.395E+02 +- 0.00E+00 conversion 6.5618E-05 +- 7.09E-09 offset 15.00742 +- 0.00015
|
||||
module 4 center 6.395E+02 +- 0.00E+00 conversion 6.5642E-05 +- 7.15E-09 offset 20.00620 +- 0.00015
|
||||
module 5 center 6.395E+02 +- 0.00E+00 conversion 6.5612E-05 +- 7.09E-09 offset 25.00281 +- 0.00015
|
||||
module 6 center 6.395E+02 +- 0.00E+00 conversion 6.5623E-05 +- 6.93E-09 offset 30.00704 +- 0.00015
|
||||
module 7 center 6.395E+02 +- 0.00E+00 conversion 6.5605E-05 +- 7.10E-09 offset 34.99715 +- 0.00015
|
||||
module 8 center 6.395E+02 +- 0.00E+00 conversion 6.5643E-05 +- 7.21E-09 offset 39.99533 +- 0.00015
|
||||
module 9 center 6.395E+02 +- 0.00E+00 conversion 6.5638E-05 +- 7.09E-09 offset 44.99969 +- 0.00015
|
||||
module 10 center 6.395E+02 +- 0.00E+00 conversion 6.5638E-05 +- 6.94E-09 offset 49.99859 +- 0.00015
|
||||
module 11 center 6.395E+02 +- 0.00E+00 conversion 6.5644E-05 +- 7.10E-09 offset 54.99499 +- 0.00015
|
||||
module 12 center 6.395E+02 +- 0.00E+00 conversion 6.5618E-05 +- 7.09E-09 offset 59.99120 +- 0.00015
|
||||
module 13 center 6.395E+02 +- 0.00E+00 conversion 6.5607E-05 +- 7.11E-09 offset 64.98880 +- 0.00015
|
||||
module 14 center 6.395E+02 +- 0.00E+00 conversion 6.5609E-05 +- 7.09E-09 offset 69.98205 +- 0.00015
|
||||
module 15 center 6.395E+02 +- 0.00E+00 conversion 6.5611E-05 +- 7.09E-09 offset 74.98379 +- 0.00015
|
||||
module 16 center 6.395E+02 +- 0.00E+00 conversion 6.5619E-05 +- 4.72E-09 offset 79.98559 +- 0.00015
|
||||
module 17 center 6.395E+02 +- 0.00E+00 conversion 6.5604E-05 +- 7.09E-09 offset 84.98376 +- 0.00015
|
||||
module 18 center 6.395E+02 +- 0.00E+00 conversion 6.5605E-05 +- 7.09E-09 offset 89.98307 +- 0.00015
|
||||
module 19 center 6.395E+02 +- 0.00E+00 conversion 6.5616E-05 +- 7.09E-09 offset 94.98907 +- 0.00015
|
||||
module 20 center 6.395E+02 +- 0.00E+00 conversion 6.5634E-05 +- 7.08E-09 offset 99.97965 +- 0.00015
|
||||
module 21 center 6.395E+02 +- 0.00E+00 conversion 6.5608E-05 +- 4.16E-09 offset 104.99732 +- 0.00016
|
||||
module 22 center 6.395E+02 +- 0.00E+00 conversion 6.5608E-05 +- 7.09E-09 offset 109.98646 +- 0.00015
|
||||
module 23 center 6.395E+02 +- 0.00E+00 conversion 6.5649E-05 +- 7.09E-09 offset 114.98765 +- 0.00015
|
@ -1,5 +0,0 @@
|
||||
15
|
||||
1528
|
||||
5000
|
||||
6513
|
||||
|
0
examples/config_gen_script/beb_31_25.config_gen
Normal file → Executable file
0
examples/config_gen_script/eiger_2m_1gb.config_gen
Normal file → Executable file
39
examples/config_gen_script/generic_example.config
Normal file
@ -0,0 +1,39 @@
|
||||
hostname hostname1+hostname2+hostname3+hostname55+
|
||||
header_var1 wow
|
||||
header_var2 great
|
||||
header_var3 very nice
|
||||
|
||||
0:counter1 100
|
||||
0:counter2 1024
|
||||
0:counter3 1500
|
||||
0:forallmodules val_mod1
|
||||
0:constant1 const1
|
||||
0:constant2 const2
|
||||
0:constant3 const3 /path/to/something
|
||||
|
||||
1:counter1 101
|
||||
1:counter2 1036
|
||||
1:counter3 1503
|
||||
1:forallmodules val_mod2
|
||||
1:constant1 const1
|
||||
1:constant2 const2
|
||||
1:constant3 const3 /path/to/something
|
||||
|
||||
2:counter1 102
|
||||
2:counter2 1048
|
||||
2:counter3 1506
|
||||
2:forallmodules val_mod3
|
||||
2:constant1 const1
|
||||
2:constant2 const2
|
||||
2:constant3 const3 /path/to/something
|
||||
|
||||
3:counter1 103
|
||||
3:counter2 1060
|
||||
3:counter3 1509
|
||||
3:forallmodules val_mod4
|
||||
3:constant1 const1
|
||||
3:constant2 const2
|
||||
3:constant3 const3 /path/to/something
|
||||
|
||||
footer1 foot1
|
||||
footer2 somethingelseathebottom
|
47
examples/config_gen_script/generic_example.config_gen
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# local variables
|
||||
a_variable=/path/to/something
|
||||
|
||||
# HOSTNAMES is special
|
||||
# Beside of the hostname line it also defines the amount of modules
|
||||
# for the body part
|
||||
# take care for the last space
|
||||
HOSTNAMES="hostname1 hostname2 hostname3 hostname55 "
|
||||
|
||||
## header contains constant values at the beginning of the file
|
||||
header=(
|
||||
header_var1="wow"
|
||||
header_var2="great"
|
||||
header_var3="very nice"
|
||||
)
|
||||
|
||||
## the body part is for each half module
|
||||
# counters will count automatically
|
||||
# the number behind ':' indicates the incrementation value
|
||||
|
||||
counters=(
|
||||
counter1="100:1"
|
||||
counter2="1024:12"
|
||||
counter3="1500:3"
|
||||
)
|
||||
|
||||
# constant values
|
||||
constants=(
|
||||
constant1="const1"
|
||||
constant2="const2"
|
||||
constant3="const3 ${a_variable}"
|
||||
)
|
||||
|
||||
# lists contains space separated lists each value for each half module
|
||||
lists=(
|
||||
forallmodules="val_mod1 val_mod2 val_mod3 val_mod4"
|
||||
)
|
||||
|
||||
|
||||
## footer contains constant values for the end of the file
|
||||
footer=(
|
||||
footer1=foot1
|
||||
footer2=somethingelseathebottom
|
||||
)
|
||||
|
0
examples/eiger_10Gb.config
Normal file → Executable file
0
examples/eiger_1Gb.config
Normal file → Executable file
0
examples/gotthard.config
Normal file → Executable file
0
examples/gotthard_setup.det
Normal file → Executable file
0
examples/gotthard_two.config
Normal file → Executable file
0
examples/howto_gotthard_twomodules.txt
Normal file → Executable file
0
examples/jungfrau.config
Normal file → Executable file
0
examples/jungfrau_two.config
Normal file → Executable file
0
examples/moench01_T1_lab.config
Normal file → Executable file
@ -1,32 +0,0 @@
|
||||
type Mythen+
|
||||
0:hostname mcs1x21
|
||||
0:port 1952
|
||||
0:stopport 1953
|
||||
0:settingsdir /afs/psi.ch/user/b/bergamaschi
|
||||
0:outdir /afs/psi.ch/user/b/bergamaschi
|
||||
0:angdir 1.000000
|
||||
0:moveflag 1.000000
|
||||
0:lock 0
|
||||
0:caldir /afs/psi.ch/user/b/bergamaschi
|
||||
0:ffdir /afs/psi.ch/user/b/bergamaschi
|
||||
0:nmod 1
|
||||
0:waitstates 13
|
||||
0:setlength 3
|
||||
0:clkdivider 6
|
||||
0:extsig:0 gate_in_active_high
|
||||
0:extsig:1 trigger_in_rising_edge
|
||||
0:extsig:2 off
|
||||
0:extsig:3 off
|
||||
master -1
|
||||
sync none
|
||||
outdir /afs/psi.ch/user/b/bergamaschi
|
||||
ffdir /afs/psi.ch/user/b/bergamaschi
|
||||
headerbefore none
|
||||
headerafter none
|
||||
headerbeforepar none
|
||||
headerafterpar none
|
||||
badchannels none
|
||||
angconv none
|
||||
globaloff 0.000000
|
||||
binsize 0.001000
|
||||
threaded 1
|
@ -1 +0,0 @@
|
||||
dataport 1955
|
@ -1,10 +0,0 @@
|
||||
#!/bin/csh -f
|
||||
#set l = `ipcs -m | grep "$USER"| cut -c12-19`
|
||||
set l = `ipcs -m | cut -c0-10`
|
||||
foreach s ( $l )
|
||||
echo $s
|
||||
ipcrm -M $s
|
||||
end
|
||||
#if ($#l != 0 )
|
||||
echo $#l shared memory\(s\) for $user removed
|
||||
|
0
examples/scripts/.parab
Normal file → Executable file
@ -1,142 +0,0 @@
|
||||
#! /bin/awk -f
|
||||
|
||||
# this is an awk script to start a run
|
||||
# you first need to run inimodule.awk to initialize
|
||||
# the pattern, set Vc and set the trimbits
|
||||
#
|
||||
|
||||
#####################################################################
|
||||
# revision history #
|
||||
#####################################################################
|
||||
# 31.10.2001 first version #
|
||||
#####################################################################
|
||||
# #
|
||||
# Bernd Schmitt #
|
||||
# #
|
||||
# bernd.schmitt@psi.ch #
|
||||
# #
|
||||
#####################################################################
|
||||
# #
|
||||
# modifications: #
|
||||
# #
|
||||
# 1.3.2002 BS adapted for use with DCB #
|
||||
# #
|
||||
# 25.5.2002 BS adapted to new convert program #
|
||||
# #
|
||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
||||
# #
|
||||
#####################################################################
|
||||
|
||||
BEGIN {
|
||||
|
||||
# initialize variables
|
||||
NPAR=3
|
||||
|
||||
PAR[1]="nrun"
|
||||
PAR[2]="fn"
|
||||
PAR[3]="par"
|
||||
|
||||
# initialize default values
|
||||
|
||||
|
||||
|
||||
PARVAL[1] = 100
|
||||
PARVAL[2] = "microstrip_july2007"
|
||||
PARVAL[3]=0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
||||
|
||||
# read command line defined variables
|
||||
if (ARGC>1) {
|
||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
||||
for (i=1; i<=ARGC; i++) {
|
||||
printf("%s \n", ARGV[i]);
|
||||
nsplit=split(ARGV[i],array,"=")
|
||||
VAR = array[1];
|
||||
VAL = array[2];
|
||||
|
||||
for (j=1; j<=NPAR; j++) {
|
||||
if ( VAR==PAR[j] ) {
|
||||
PARVAL[j] = VAL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
run=PARVAL[1]
|
||||
fn=PARVAL[2]
|
||||
par=PARVAL[3]
|
||||
|
||||
|
||||
# print command line arguments
|
||||
for (i=1; i<=NPAR; i++){
|
||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
||||
}
|
||||
printf("\n\n");
|
||||
|
||||
# generate parameter file
|
||||
|
||||
fnamep=fn".parab"
|
||||
printf("header before\n")>> fnamep
|
||||
system("date >>"fnamep)
|
||||
printf("run=%i \n", run ) >> fnamep
|
||||
|
||||
#print detector parameters to file
|
||||
if (par==1) {
|
||||
|
||||
command="sls_detector_get exptime| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("acquisition time = %11.6f second(s)\n", var) >> fnamep
|
||||
|
||||
command="sls_detector_get settings| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("settings = %s\n", var) >> fnamep;
|
||||
|
||||
command="sls_detector_get threshold| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("threshold energy = %d eV\n", var) >> fnamep;
|
||||
|
||||
command="sls_detector_get badchannels| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("bad channel list = %s\n",var) >> fnamep;
|
||||
|
||||
|
||||
command="sls_detector_get angconv| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("angle calibration conversion = %s\n",var) >> fnamep;
|
||||
|
||||
|
||||
command="sls_detector_get globaloff| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("beamline offset = %f deg\n", var) >> fnamep;
|
||||
|
||||
command="sls_detector_get fineoff| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("fine offset = %f deg\n", var) >> fnamep;
|
||||
|
||||
command="sls_detector_get flatfield| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("Flat field corrections = %s\n",var) >> fnamep;
|
||||
|
||||
command="sls_detector_get ratecorr| awk -F \" \" '{print $2}'"
|
||||
command | getline var
|
||||
printf("Dead time corrections tau = %d ns\n",var) >> fnamep;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#print beamline parameters to file
|
||||
|
||||
#read detector position
|
||||
system("caget X04SA-ES2-TH2:RO.RBV >>"fnamep)
|
||||
#read I0
|
||||
system("caget X04SA-ES2-SC:CH6>>"fnamep)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
#! /bin/awk -f
|
||||
|
||||
# this is an awk script to start a run
|
||||
# you first need to run inimodule.awk to initialize
|
||||
# the pattern, set Vc and set the trimbits
|
||||
#
|
||||
|
||||
#####################################################################
|
||||
# revision history #
|
||||
#####################################################################
|
||||
# 31.10.2001 first version #
|
||||
#####################################################################
|
||||
# #
|
||||
# Bernd Schmitt #
|
||||
# #
|
||||
# bernd.schmitt@psi.ch #
|
||||
# #
|
||||
#####################################################################
|
||||
# #
|
||||
# modifications: #
|
||||
# #
|
||||
# 1.3.2002 BS adapted for use with DCB #
|
||||
# #
|
||||
# 25.5.2002 BS adapted to new convert program #
|
||||
# #
|
||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
||||
# #
|
||||
#####################################################################
|
||||
|
||||
BEGIN {
|
||||
|
||||
# initialize variables
|
||||
NPAR=4
|
||||
|
||||
PAR[1]="nrun"
|
||||
PAR[2]="fn"
|
||||
PAR[3]="var"
|
||||
PAR[4]="par"
|
||||
|
||||
|
||||
# initialize default values
|
||||
PARVAL[1] = 100
|
||||
PARVAL[2] = "myfname"
|
||||
PARVAL[3] = 0
|
||||
PARVAL[2] = "none"
|
||||
|
||||
|
||||
|
||||
# read command line defined variables
|
||||
if (ARGC>1) {
|
||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
||||
for (i=1; i<=ARGC; i++) {
|
||||
|
||||
nsplit=split(ARGV[i],array,"=")
|
||||
VAR = array[1];
|
||||
VAL = array[2];
|
||||
|
||||
for (j=1; j<=NPAR; j++) {
|
||||
if ( VAR==PAR[j] ) {
|
||||
PARVAL[j] = VAL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run=PARVAL[1]
|
||||
fn=PARVAL[2]
|
||||
var=PARVAL[3]
|
||||
par=PARVAL[4]
|
||||
|
||||
|
||||
|
||||
|
||||
# print command line arguments
|
||||
for (i=1; i<=NPAR; i++){
|
||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
||||
}
|
||||
|
||||
#execute you command hereafter e.g. change temperature etc.
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,100 +0,0 @@
|
||||
#! /bin/awk -f
|
||||
|
||||
# this is an awk script to start a run
|
||||
# you first need to run inimodule.awk to initialize
|
||||
# the pattern, set Vc and set the trimbits
|
||||
#
|
||||
|
||||
#####################################################################
|
||||
# revision history #
|
||||
#####################################################################
|
||||
# 31.10.2001 first version #
|
||||
#####################################################################
|
||||
# #
|
||||
# Bernd Schmitt #
|
||||
# #
|
||||
# bernd.schmitt@psi.ch #
|
||||
# #
|
||||
#####################################################################
|
||||
# #
|
||||
# modifications: #
|
||||
# #
|
||||
# 1.3.2002 BS adapted for use with DCB #
|
||||
# #
|
||||
# 25.5.2002 BS adapted to new convert program #
|
||||
# #
|
||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
||||
# #
|
||||
#####################################################################
|
||||
|
||||
BEGIN {
|
||||
|
||||
# initialize variables
|
||||
NPAR=7
|
||||
|
||||
PAR[1]="nrun"
|
||||
PAR[2]="fn"
|
||||
PAR[3]="par"
|
||||
PAR[4]="sv0"
|
||||
PAR[5]="sv1"
|
||||
PAR[6]="p0"
|
||||
PAR[7]="p1"
|
||||
|
||||
# initialize default values
|
||||
PARVAL[1] = 100
|
||||
PARVAL[2] = "myfname"
|
||||
PARVAL[3] = 1
|
||||
PARVAL[4] = 0
|
||||
PARVAL[5] = 0
|
||||
PARVAL[6] = "none"
|
||||
PARVAL[7] = "none"
|
||||
|
||||
|
||||
|
||||
# read command line defined variables
|
||||
if (ARGC>1) {
|
||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
||||
for (i=1; i<=ARGC; i++) {
|
||||
|
||||
nsplit=split(ARGV[i],array,"=")
|
||||
VAR = array[1];
|
||||
VAL = array[2];
|
||||
|
||||
for (j=1; j<=NPAR; j++) {
|
||||
if ( VAR==PAR[j] ) {
|
||||
PARVAL[j] = VAL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run=PARVAL[1]
|
||||
fn=PARVAL[2]
|
||||
"par"PAR[3]=
|
||||
sv0=PAR[4]
|
||||
sv1=PAR[5]
|
||||
p0=PAR[6]
|
||||
p1=PAR[7]
|
||||
|
||||
|
||||
|
||||
# print command line arguments
|
||||
for (i=1; i<=NPAR; i++){
|
||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
||||
}
|
||||
# printf("\n\n");
|
||||
# system("close_shutter_g95")
|
||||
|
||||
# execute your actions hereafter
|
||||
if (par==1) {
|
||||
#open shutter
|
||||
} else {
|
||||
#close shutter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,79 +0,0 @@
|
||||
#! /bin/awk -f
|
||||
|
||||
# this is an awk script to start a run
|
||||
# you first need to run inimodule.awk to initialize
|
||||
# the pattern, set Vc and set the trimbits
|
||||
#
|
||||
|
||||
#####################################################################
|
||||
# revision history #
|
||||
#####################################################################
|
||||
# 31.10.2001 first version #
|
||||
#####################################################################
|
||||
# #
|
||||
# Bernd Schmitt #
|
||||
# #
|
||||
# bernd.schmitt@psi.ch #
|
||||
# #
|
||||
#####################################################################
|
||||
# #
|
||||
# modifications: #
|
||||
# #
|
||||
# 1.3.2002 BS adapted for use with DCB #
|
||||
# #
|
||||
# 25.5.2002 BS adapted to new convert program #
|
||||
# #
|
||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
||||
# #
|
||||
#####################################################################
|
||||
|
||||
BEGIN {
|
||||
|
||||
# initialize variables
|
||||
NPAR=2
|
||||
|
||||
PAR[1]="nrun"
|
||||
PAR[2]="par"
|
||||
|
||||
|
||||
# initialize default values
|
||||
PARVAL[1] = 100
|
||||
PARVAL[2] = "none"
|
||||
|
||||
|
||||
|
||||
# read command line defined variables
|
||||
if (ARGC>1) {
|
||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
||||
for (i=1; i<=ARGC; i++) {
|
||||
|
||||
nsplit=split(ARGV[i],array,"=")
|
||||
VAR = array[1];
|
||||
VAL = array[2];
|
||||
|
||||
for (j=1; j<=NPAR; j++) {
|
||||
if ( VAR==PAR[j] ) {
|
||||
PARVAL[j] = VAL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run=PARVAL[1]
|
||||
par=PARVAL[2]
|
||||
|
||||
|
||||
|
||||
|
||||
# print command line arguments
|
||||
for (i=1; i<=NPAR; i++){
|
||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
||||
}
|
||||
#execute action hereafter
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
0
examples/two_gotthard.config
Normal file → Executable file
@ -1,64 +0,0 @@
|
||||
#####Any line with a # is not read######
|
||||
|
||||
#type Gotthard+
|
||||
hostname bchip007+bchip009+
|
||||
|
||||
#0:hostname bchip007
|
||||
#0:port 1952
|
||||
#0:stopport 1953
|
||||
#0:rx_tcpport 1956
|
||||
0:settingsdir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
0:angdir 1.000000
|
||||
0:moveflag 0.000000
|
||||
0:lock 0
|
||||
0:caldir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
0:ffdir /home/l_msdetect
|
||||
0:extsig:0 off
|
||||
0:extsig:1 off
|
||||
0:extsig:2 off
|
||||
0:extsig:3 off
|
||||
#0:detectorip 10.1.1.2
|
||||
#0:detectormac 00:aa:bb:cc:dd:ee
|
||||
#0:rx_udpport 50001
|
||||
#0:rx_udpip 10.1.1.1
|
||||
#0:rx_hostname 129.129.202.134
|
||||
0:outdir /data/speedt
|
||||
0:vhighvoltage 120
|
||||
|
||||
|
||||
#1:hostname bchip009
|
||||
#1:port 1952
|
||||
#1:stopport 1953
|
||||
1:rx_tcpport 1957
|
||||
1:settingsdir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
1:angdir 1.000000
|
||||
1:moveflag 0.000000
|
||||
1:lock 0
|
||||
1:caldir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
1:ffdir /home/l_msdetect
|
||||
1:extsig:0 off
|
||||
1:extsig:1 off
|
||||
1:extsig:2 off
|
||||
1:extsig:3 off
|
||||
#1:detectorip 10.1.2.2
|
||||
#1:detectormac 00:aa:bb:cc:dd:ee
|
||||
#1:rx_udpport 50004
|
||||
#1:rx_udpip 10.1.2.1
|
||||
#1:rx_hostname 129.129.202.134
|
||||
1:outdir /data/speedt
|
||||
1:vhighvoltage 120
|
||||
|
||||
|
||||
master -1
|
||||
sync none
|
||||
outdir /data/speedt
|
||||
ffdir /home/l_msdetect
|
||||
headerbefore none
|
||||
headerafter none
|
||||
headerbeforepar none
|
||||
headerafterpar none
|
||||
badchannels none
|
||||
angconv none
|
||||
globaloff 0.000000
|
||||
binsize 0.001000
|
||||
threaded 1
|
70
integrationTests/CMakeLists.txt
Normal file → Executable file
@ -1,39 +1,49 @@
|
||||
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
|
||||
# MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
# MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
|
||||
|
||||
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/catch
|
||||
# include_directories(
|
||||
# ${PROJECT_SOURCE_DIR}/catch
|
||||
# )
|
||||
|
||||
target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-integrationMulti.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-integrationDectector.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-eigerIntegration.cpp
|
||||
)
|
||||
|
||||
if(SLS_USE_TESTS)
|
||||
set(TEST_SOURCES
|
||||
src/test-slsDetector.cpp
|
||||
src/test.cpp
|
||||
)
|
||||
add_executable(detector_test ${TEST_SOURCES})
|
||||
# if(SLS_USE_TESTS)
|
||||
# set(TEST_SOURCES
|
||||
# src/test-slsDetector.cpp
|
||||
# src/test.cpp
|
||||
# )
|
||||
# add_executable(detector_test ${TEST_SOURCES})
|
||||
|
||||
target_link_libraries(detector_test
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
set_target_properties(detector_test PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
add_executable(a src/a.cpp)
|
||||
# target_link_libraries(detector_test
|
||||
# slsDetectorShared
|
||||
# slsProjectOptions
|
||||
# slsProjectWarnings
|
||||
# slsSupportLib
|
||||
# pthread
|
||||
# rt
|
||||
# )
|
||||
# set_target_properties(detector_test PROPERTIES
|
||||
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
# )
|
||||
|
||||
target_link_libraries(a
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
set_target_properties(a PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
# add_executable(a src/a.cpp)
|
||||
# target_link_libraries(a
|
||||
# slsProjectOptions
|
||||
# slsProjectWarnings
|
||||
# slsDetectorShared
|
||||
# slsSupportLib
|
||||
# pthread
|
||||
# rt
|
||||
# )
|
||||
# set_target_properties(a PROPERTIES
|
||||
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
# )
|
||||
|
||||
endif()
|
||||
# endif()
|
||||
|
||||
|
88
integrationTests/a.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "ClientSocket.h"
|
||||
#include "Timer.h"
|
||||
#include "logger.h"
|
||||
#include "network_utils.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_detector_funcs.h"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <string>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "network_utils.h"
|
||||
|
||||
using namespace sls;
|
||||
using ROI = slsDetectorDefs::ROI;
|
||||
|
||||
// Easy printing of an ROI
|
||||
std::ostream &operator<<(std::ostream &out, const ROI &r) {
|
||||
return out << "xmin: " << std::setw(5) << r.xmin
|
||||
<< " xmax: " << std::setw(5) << r.xmax
|
||||
<< " ymin: " << std::setw(5) << r.ymin
|
||||
<< " ymax: " << std::setw(5) << r.ymax;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "nullptr: " << sizeof(nullptr) << "\n";
|
||||
// int ret[]{0,0,0};
|
||||
// for (auto i: ret)
|
||||
// std::cout << i << "\n";
|
||||
// uint32_t imageSize = 101;
|
||||
// uint32_t packetSize = 100;
|
||||
// std::cout << "a: " << std::ceil((double)imageSize / (double)packetSize) <<'\n';
|
||||
// std::cout << "b: " << imageSize / packetSize <<'\n';
|
||||
// std::cout << "c: " << static_cast<double>(imageSize / packetSize) << '\n';
|
||||
// std::cout << "c: " << (imageSize + packetSize-1) / packetSize << '\n';
|
||||
|
||||
// slsDetectorDefs::ROI roilimits[5];
|
||||
// roilimits[0].xmin = 5;
|
||||
// roilimits[0].xmax = 12;
|
||||
// roilimits[0].ymin = 5;
|
||||
// roilimits[0].ymax = 15;
|
||||
|
||||
// roilimits[1].xmin = 0;
|
||||
// roilimits[1].xmax = 3;
|
||||
// roilimits[1].ymin = 20;
|
||||
// roilimits[1].ymax = 25;
|
||||
|
||||
// roilimits[2].xmin = 500;
|
||||
// roilimits[2].xmax = 600;
|
||||
// roilimits[2].ymin = 100;
|
||||
// roilimits[2].ymax = 200;
|
||||
|
||||
// roilimits[3].xmin = 300;
|
||||
// roilimits[3].xmax = 500;
|
||||
// roilimits[3].ymin = 800;
|
||||
// roilimits[3].ymax = 900;
|
||||
|
||||
// roilimits[4].xmin = 1000;
|
||||
// roilimits[4].xmax = 2000;
|
||||
// roilimits[4].ymin = 300;
|
||||
// roilimits[4].ymax = 500;
|
||||
|
||||
// std::cout << "Before sorting:\n";
|
||||
// for (auto r : roilimits) {
|
||||
// std::cout << r << '\n';
|
||||
// }
|
||||
|
||||
// std::sort(std::begin(roilimits), std::end(roilimits),
|
||||
// [](ROI a, ROI b) { return a.xmin < b.xmin; });
|
||||
|
||||
// std::cout << "After sorting: \n";
|
||||
// for (auto r : roilimits) {
|
||||
// std::cout << r << '\n';
|
||||
// }
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "ClientSocket.h"
|
||||
#include "Timer.h"
|
||||
#include "logger.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_detector_funcs.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#define VERBOSE
|
||||
|
||||
using sls::RuntimeError;
|
||||
using sls::SharedMemoryError;
|
||||
using sls::SocketError;
|
||||
using sls::DetectorError;
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
const std::string hostname = "beb083";
|
||||
auto type = slsDetector::getTypeFromDetector(hostname);
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
std::cout << "hostname: " << d.getHostname() << '\n';
|
||||
d.setThresholdTemperature(50);
|
||||
// try{
|
||||
// d.setThresholdTemperature(50);
|
||||
// }catch(const DetectorError &e){
|
||||
// std::cout << "Caught: " << e.what() << '\n';
|
||||
// }
|
||||
// std::cout << "hostname: " << d.getHostname() << '\n';
|
||||
// std::cout << "exptime: " << d.setDAC(-1, slsDetectorDefs::E_Vrf, 0) << '\n';
|
||||
|
||||
|
||||
|
||||
|
||||
// slsDetector d2(type);
|
||||
// std::cout << "Online: " << d2.getOnlineFlag() << '\n';
|
||||
// d2.setHostname("beb55555");
|
||||
// d2.setOnline(true);
|
||||
// std::cout << "Online: " << d2.getOnlineFlag() << '\n';
|
||||
// std::cout << "hostname: " << d2.getHostname() << '\n';
|
||||
|
||||
// std::cout << "port: " << d.getControlPort() << '\n';
|
||||
// d.setOnline(true);
|
||||
// d.setReceiverOnline(true);
|
||||
// std::cout << "reciver version: " << std::hex << d.getReceiverVersion() << '\n';
|
||||
// // std::cout << "version: " << d.getId(slsDetectorDefs::CLIENT_RECEIVER_API_VERSION) << '\n';
|
||||
// d.freeSharedMemory();
|
||||
// //Catch exception
|
||||
// try {
|
||||
// throw RuntimeError("something went wrong");
|
||||
// } catch (RuntimeError &e) {
|
||||
// std::cout << "Caught RuntimeError with message : " << e.what() << '\n';
|
||||
// }
|
||||
|
||||
// //Catch base class
|
||||
// try {
|
||||
// throw SharedMemoryError("Could not create shared memory");
|
||||
// } catch (RuntimeError &e) {
|
||||
// std::cout << "Caught: " << e.what() << '\n';
|
||||
// }
|
||||
|
||||
// //Catch base class after looking for something else
|
||||
// try {
|
||||
// throw SharedMemoryError("Could not create shared memory");
|
||||
// } catch (SocketError &e) {
|
||||
|
||||
// std::cout << "Caught Socket error: " << e.what() << '\n';
|
||||
|
||||
// } catch (RuntimeError &e) {
|
||||
// std::cout << "Caught base class: " << e.what() << '\n';
|
||||
// }
|
||||
|
||||
// //Catch any after looking for something else
|
||||
// try {
|
||||
// throw SharedMemoryError("Could not create shared memory");
|
||||
// } catch (SocketError &e) {
|
||||
|
||||
// std::cout << "Caught Socket error: " << e.what() << '\n';
|
||||
|
||||
// } catch (...) {
|
||||
// std::cout << "Caught Something else probably should have let me crash\n";
|
||||
// }
|
||||
|
||||
|
||||
// throw RuntimeError("This one we missed");
|
||||
return 0;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
// #include "catch.hpp"
|
||||
// #include "multiSlsDetector.h"
|
||||
|
||||
// #include <iostream>
|
||||
// TEST_CASE("Initialize a detector") {
|
||||
// multiSlsDetector det(0, true, true);
|
||||
// std::cout << "Size: " << det.getNumberOfDetectors() << std::endl;
|
||||
// std::cout << "Hostname: " << det.getHostname() << std::endl;
|
||||
// REQUIRE(false);
|
||||
|
||||
// }
|
@ -1,199 +0,0 @@
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "Timer.h"
|
||||
#include "sls_detector_funcs.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#define VERBOSE
|
||||
|
||||
auto type_enum = slsDetectorDefs::detectorType::EIGER;
|
||||
const std::string hostname = "beb083";
|
||||
const std::string type_string = "Eiger";
|
||||
const std::string my_ip = "129.129.205.242";
|
||||
|
||||
TEST_CASE("single EIGER detector no receiver basic set and get") {
|
||||
//TODO! this test should take command line arguments for config
|
||||
|
||||
//Read type by connecting to the detector
|
||||
auto type = slsDetector::getTypeFromDetector(hostname);
|
||||
CHECK(type == type_enum);
|
||||
|
||||
//Create slsDetector of said type and set hostname and detector online
|
||||
slsDetector d(type);
|
||||
CHECK(d.getDetectorTypeAsEnum() == type);
|
||||
CHECK(d.getDetectorTypeAsString() == type_string);
|
||||
|
||||
d.setHostname(hostname);
|
||||
CHECK(d.getHostname() == hostname);
|
||||
|
||||
d.setOnline(true);
|
||||
CHECK(d.getOnlineFlag() == true);
|
||||
|
||||
CHECK(d.getReceiverOnline() == false);
|
||||
CHECK(d.checkDetectorVersionCompatibility() == slsDetectorDefs::OK);
|
||||
|
||||
//Setting and reading exposure time
|
||||
auto t = 1000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
|
||||
//size of an eiger half module with and without gap pixels
|
||||
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
|
||||
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::X) == 1024);
|
||||
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Y) == 256);
|
||||
// CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Z) == 1);
|
||||
CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::X) == 1024);
|
||||
CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::Y) == 256);
|
||||
// CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::Z) == 1);
|
||||
|
||||
CHECK(d.getNChans() == 256 * 256);
|
||||
CHECK(d.getNChans(slsDetectorDefs::dimension::X) == 256);
|
||||
CHECK(d.getNChans(slsDetectorDefs::dimension::Y) == 256);
|
||||
// CHECK(d.getNChans(slsDetectorDefs::dimension::Z) == 1);
|
||||
|
||||
CHECK(d.getNChips() == 4);
|
||||
CHECK(d.getNChips(slsDetectorDefs::dimension::X) == 4);
|
||||
CHECK(d.getNChips(slsDetectorDefs::dimension::Y) == 1);
|
||||
// CHECK(d.getNChips(slsDetectorDefs::dimension::Z) == 1);
|
||||
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
TEST_CASE("Set control port then create a new object with this control port") {
|
||||
/*
|
||||
TODO!
|
||||
Standard port but should not be hardcoded
|
||||
Is this the best way to initialize the detectors
|
||||
Using braces to make the object go out of scope
|
||||
*/
|
||||
int old_cport = DEFAULT_PORTNO;
|
||||
int old_sport = DEFAULT_PORTNO + 1;
|
||||
int new_cport = 1993;
|
||||
int new_sport = 2000;
|
||||
|
||||
{
|
||||
auto type = slsDetector::getTypeFromDetector(hostname);
|
||||
CHECK(type == type_enum);
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
CHECK(d.getControlPort() == old_cport);
|
||||
d.setControlPort(new_cport);
|
||||
CHECK(d.getStopPort() == old_sport);
|
||||
d.setStopPort(new_sport);
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
{
|
||||
auto type = slsDetector::getTypeFromDetector(hostname, new_cport);
|
||||
CHECK(type == type_enum);
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setControlPort(new_cport);
|
||||
d.setStopPort(new_sport);
|
||||
CHECK(d.getControlPort() == new_cport);
|
||||
CHECK(d.getStopPort() == new_sport);
|
||||
|
||||
d.setOnline(true);
|
||||
|
||||
//Reset standard ports
|
||||
d.setControlPort(old_cport);
|
||||
d.setStopPort(old_sport);
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
auto type = slsDetector::getTypeFromDetector(hostname);
|
||||
CHECK(type == type_enum);
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Locking mechanism and last ip") {
|
||||
auto type = slsDetector::getTypeFromDetector(hostname);
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
|
||||
//Check that detector server is unlocked then lock
|
||||
CHECK(d.lockServer() == 0);
|
||||
d.lockServer(1);
|
||||
CHECK(d.lockServer() == 1);
|
||||
|
||||
//Can we do things while it is locked
|
||||
auto t = 1300000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
|
||||
//unlock again
|
||||
d.lockServer(0);
|
||||
CHECK(d.lockServer() == 0);
|
||||
|
||||
CHECK(d.getLastClientIP() == my_ip);
|
||||
}
|
||||
|
||||
TEST_CASE("Excersise all possible set timer functions") {
|
||||
// FRAME_NUMBER, /**< number of real time frames: total number of acquisitions is number or frames*number of cycles */
|
||||
// ACQUISITION_TIME, /**< exposure time */
|
||||
// FRAME_PERIOD, /**< period between exposures */
|
||||
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or readout (in triggered mode) */
|
||||
// GATES_NUMBER, /**< number of gates per frame (in gated mode) */
|
||||
// CYCLES_NUMBER, /**< number of cycles: total number of acquisitions is number or frames*number of cycles */
|
||||
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo) */
|
||||
|
||||
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||
// MEASUREMENTS_NUMBER,
|
||||
// FRAMES_FROM_START,
|
||||
// FRAMES_FROM_START_PG,
|
||||
// SAMPLES,
|
||||
// SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
|
||||
// STORAGE_CELL_NUMBER, /**<number of storage cells */
|
||||
// SUBFRAME_DEADTIME, /**< subframe deadtime */
|
||||
// MEASURED_PERIOD, /**< measured period */
|
||||
// MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||
// MAX_TIMERS
|
||||
|
||||
auto type = slsDetector::getTypeFromDetector(hostname);
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
|
||||
//Number of frames
|
||||
auto frames = 10;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
|
||||
|
||||
auto t = 10000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
|
||||
auto period = 1000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
|
||||
|
||||
// not implemented for EIGER
|
||||
// auto delay = 10000;
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
|
||||
// CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) == delay);
|
||||
|
||||
// auto gates = 1;
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
|
||||
// CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||
|
||||
auto cycles = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
|
||||
|
||||
auto subtime = 200;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME, subtime);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) == subtime);
|
||||
}
|
||||
|
||||
// TEST_CASE()
|
199
integrationTests/test-eigerIntegration.cpp
Normal file
@ -0,0 +1,199 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
|
||||
class MultiDetectorFixture {
|
||||
protected:
|
||||
multiSlsDetector d;
|
||||
|
||||
public:
|
||||
MultiDetectorFixture() : d(0, true, true) {
|
||||
d.setHostname(hostname.c_str());
|
||||
if (my_ip != "undefined")
|
||||
d.setReceiverHostname(my_ip);
|
||||
}
|
||||
~MultiDetectorFixture() { d.freeSharedMemory(); }
|
||||
};
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Set and get dacs",
|
||||
"[.eigerintegration][cli]") {
|
||||
auto th = 1000;
|
||||
|
||||
// set and read back each individual dac of EIGER
|
||||
d.setDAC(0, di::E_SvP, 0);
|
||||
CHECK(d.setDAC(-1, di::E_SvP, 0) == 0);
|
||||
d.setDAC(4000, di::E_SvN, 0);
|
||||
CHECK(d.setDAC(-1, di::E_SvN, 0) == 4000);
|
||||
d.setDAC(2000, di::E_Vtr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vtr, 0) == 2000);
|
||||
d.setDAC(3500, di::E_Vrf, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vrf, 0) == 3500);
|
||||
d.setDAC(1400, di::E_Vrs, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vrs, 0) == 1400);
|
||||
d.setDAC(2556, di::E_Vtgstv, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vtgstv, 0) == 2556);
|
||||
d.setDAC(1500, di::E_Vcmp_ll, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == 1500);
|
||||
d.setDAC(1400, di::E_Vcmp_lr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == 1400);
|
||||
d.setDAC(4000, di::E_cal, 0);
|
||||
CHECK(d.setDAC(-1, di::E_cal, 0) == 4000);
|
||||
d.setDAC(1300, di::E_Vcmp_rl, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == 1300);
|
||||
d.setDAC(1200, di::E_Vcmp_rr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == 1200);
|
||||
d.setDAC(1100, di::E_rxb_rb, 0);
|
||||
CHECK(d.setDAC(-1, di::E_rxb_rb, 0) == 1100);
|
||||
d.setDAC(1100, di::E_rxb_lb, 0);
|
||||
CHECK(d.setDAC(-1, di::E_rxb_lb, 0) == 1100);
|
||||
d.setDAC(1500, di::E_Vcp, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcp, 0) == 1500);
|
||||
d.setDAC(2000, di::E_Vcn, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcn, 0) == 2000);
|
||||
d.setDAC(1550, di::E_Vis, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vis, 0) == 1550);
|
||||
d.setDAC(660, di::IO_DELAY, 0);
|
||||
CHECK(d.setDAC(-1, di::IO_DELAY, 0) == 660);
|
||||
|
||||
// setting threshold sets all individual vcmp
|
||||
d.setDAC(th, di::THRESHOLD, 0);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == th);
|
||||
|
||||
// different values gives -1
|
||||
if (d.getNumberOfDetectors() > 1) {
|
||||
d.setDAC(1600, di::E_Vcmp_ll, 0, 0);
|
||||
d.setDAC(1700, di::E_Vcmp_ll, 0, 1);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 0) == 1600);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 1) == 1700);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 1) == -1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Read temperatures",
|
||||
"[.eigerintegration][cli]") {
|
||||
std::vector<di> tempindex{di::TEMPERATURE_FPGA, di::TEMPERATURE_FPGA2,
|
||||
di::TEMPERATURE_FPGA3};
|
||||
for (auto index : tempindex) {
|
||||
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
||||
double temp = static_cast<double>(d.getADC(index, 0)) / 1000;
|
||||
CHECK(temp > 20);
|
||||
CHECK(temp < 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int to_time(uint32_t reg) {
|
||||
uint32_t clocks = reg >> 3;
|
||||
uint32_t exponent = (reg & 0b111) + 1;
|
||||
return clocks * pow(10, exponent);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Read/write register",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setTimer(ti::MEASUREMENTS_NUMBER, 1);
|
||||
d.setNumberOfFrames(1);
|
||||
d.setExposureTime(10000);
|
||||
d.acquire();
|
||||
CHECK(to_time(d.readRegister(0x4, 0)) == 10000);
|
||||
|
||||
d.writeRegister(0x4, 500);
|
||||
CHECK(d.readRegister(0x4) == 500);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Set dynamic range",
|
||||
"[.eigerintegration][cli][dr]") {
|
||||
std::vector<int> dynamic_range{4, 8, 16, 32};
|
||||
for (auto dr : dynamic_range) {
|
||||
d.setDynamicRange(dr);
|
||||
CHECK(d.setDynamicRange() == dr);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Set clock divider",
|
||||
"[.eigerintegration][cli][this]") {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
d.setSpeed(sv::CLOCK_DIVIDER, i);
|
||||
CHECK(d.setSpeed(sv::CLOCK_DIVIDER) == i);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Get time left",
|
||||
"[.eigerintegration][cli]") {
|
||||
CHECK_THROWS(d.getTimeLeft(ti::PROGRESS));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Get ID", "[.eigerintegration][cli]") {
|
||||
std::string hn = hostname;
|
||||
hn.erase(std::remove(begin(hn), end(hn), 'b'), end(hn));
|
||||
hn.erase(std::remove(begin(hn), end(hn), 'e'), end(hn));
|
||||
auto hostnames = sls::split(hn, '+');
|
||||
CHECK(hostnames.size() == d.getNumberOfDetectors());
|
||||
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
||||
CHECK(d.getId(defs::DETECTOR_SERIAL_NUMBER, 0) ==
|
||||
std::stoi(hostnames[0]));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Lock server",
|
||||
"[.eigerintegration][cli]") {
|
||||
|
||||
d.lockServer(1);
|
||||
CHECK(d.lockServer() == 1);
|
||||
d.lockServer(0);
|
||||
CHECK(d.lockServer() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Settings", "[.eigerintegration][cli]") {
|
||||
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Set readout flags",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setReadOutFlags(defs::PARALLEL);
|
||||
CHECK((d.setReadOutFlags() & defs::PARALLEL));
|
||||
|
||||
d.setReadOutFlags(defs::NONPARALLEL);
|
||||
CHECK_FALSE((d.setReadOutFlags() & defs::PARALLEL));
|
||||
CHECK((d.setReadOutFlags() & defs::NONPARALLEL));
|
||||
}
|
||||
|
||||
// TEST_CASE_METHOD(MultiDetectorFixture, "Flow control and tengiga",
|
||||
// "[.eigerintegration][cli]") {
|
||||
// d.setFlowControl10G(1);
|
||||
// CHECK(d.setFlowControl10G() == 1);
|
||||
// d.setFlowControl10G(0);
|
||||
// CHECK(d.setFlowControl10G() == 0);
|
||||
|
||||
// d.enableTenGigabitEthernet(1);
|
||||
// CHECK(d.enableTenGigabitEthernet() == 1);
|
||||
// d.enableTenGigabitEthernet(0);
|
||||
// CHECK(d.enableTenGigabitEthernet() == 0);
|
||||
// }
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "activate", "[.eigerintegration][cli]") {
|
||||
d.activate(0);
|
||||
CHECK(d.activate() == 0);
|
||||
d.activate(1);
|
||||
CHECK(d.activate() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "all trimbits",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setAllTrimbits(32);
|
||||
CHECK(d.setAllTrimbits(-1) == 32);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "rate correction",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setRateCorrection(200);
|
||||
CHECK(d.getRateCorrection() == 200);
|
||||
}
|
482
integrationTests/test-integrationDectector.cpp
Executable file
@ -0,0 +1,482 @@
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "Timer.h"
|
||||
#include "sls_detector_funcs.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#define VERBOSE
|
||||
|
||||
// Header holding all configurations for different detectors
|
||||
#include "tests/config.h"
|
||||
#include "tests/globals.h"
|
||||
|
||||
// using dt = slsDetectorDefs::detectorType;
|
||||
// extern std::string hostname;
|
||||
// extern std::string detector_type;
|
||||
// extern dt type;
|
||||
|
||||
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
|
||||
auto t = slsDetector::getTypeFromDetector(hostname);
|
||||
CHECK(t == type);
|
||||
|
||||
slsDetector d(t);
|
||||
CHECK(d.getDetectorTypeAsEnum() == t);
|
||||
CHECK(d.getDetectorTypeAsString() == detector_type);
|
||||
|
||||
d.setHostname(hostname);
|
||||
CHECK(d.getHostname() == hostname);
|
||||
|
||||
d.setOnline(true);
|
||||
CHECK(d.getOnlineFlag() == true);
|
||||
|
||||
CHECK(d.setDetectorType() == type);
|
||||
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
TEST_CASE("Set control port then create a new object with this control port",
|
||||
"[.integration][.single]") {
|
||||
/*
|
||||
TODO!
|
||||
Standard port but should not be hardcoded
|
||||
Is this the best way to initialize the detectors
|
||||
Using braces to make the object go out of scope
|
||||
*/
|
||||
int old_cport = DEFAULT_PORTNO;
|
||||
int old_sport = DEFAULT_PORTNO + 1;
|
||||
int new_cport = 1993;
|
||||
int new_sport = 2000;
|
||||
{
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
CHECK(d.getControlPort() == old_cport);
|
||||
d.setControlPort(new_cport);
|
||||
CHECK(d.getStopPort() == old_sport);
|
||||
d.setStopPort(new_sport);
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
{
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setControlPort(new_cport);
|
||||
d.setStopPort(new_sport);
|
||||
CHECK(d.getControlPort() == new_cport);
|
||||
CHECK(d.getStopPort() == new_sport);
|
||||
|
||||
d.setOnline(true);
|
||||
|
||||
// Reset standard ports
|
||||
d.setControlPort(old_cport);
|
||||
d.setStopPort(old_sport);
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
"[.integration][eiger]") {
|
||||
// TODO! this test should take command line arguments for config
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// Read type by connecting to the detector
|
||||
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||
CHECK(type == c.type_enum);
|
||||
|
||||
// Create slsDetector of said type and set hostname and detector online
|
||||
slsDetector d(type);
|
||||
CHECK(d.getDetectorTypeAsEnum() == type);
|
||||
CHECK(d.getDetectorTypeAsString() == c.type_string);
|
||||
|
||||
d.setHostname(c.hostname);
|
||||
CHECK(d.getHostname() == c.hostname);
|
||||
|
||||
d.setOnline(true);
|
||||
CHECK(d.getOnlineFlag() == true);
|
||||
|
||||
CHECK(d.getReceiverOnline() == false);
|
||||
CHECK(d.checkDetectorVersionCompatibility() == slsDetectorDefs::OK);
|
||||
|
||||
// Setting and reading exposure time
|
||||
auto t = 1000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
|
||||
// size of an eiger half module with and without gap pixels
|
||||
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
|
||||
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::X) == 1024);
|
||||
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Y) == 256);
|
||||
// CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Z) == 1);
|
||||
CHECK(d.getTotalNumberOfChannelsInclGapPixels(
|
||||
slsDetectorDefs::dimension::X) == 1024);
|
||||
CHECK(d.getTotalNumberOfChannelsInclGapPixels(
|
||||
slsDetectorDefs::dimension::Y) == 256);
|
||||
// CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::Z)
|
||||
// == 1);
|
||||
|
||||
CHECK(d.getNChans() == 256 * 256);
|
||||
CHECK(d.getNChans(slsDetectorDefs::dimension::X) == 256);
|
||||
CHECK(d.getNChans(slsDetectorDefs::dimension::Y) == 256);
|
||||
// CHECK(d.getNChans(slsDetectorDefs::dimension::Z) == 1);
|
||||
|
||||
CHECK(d.getNChips() == 4);
|
||||
CHECK(d.getNChips(slsDetectorDefs::dimension::X) == 4);
|
||||
CHECK(d.getNChips(slsDetectorDefs::dimension::Y) == 1);
|
||||
// CHECK(d.getNChips(slsDetectorDefs::dimension::Z) == 1);
|
||||
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
|
||||
// Check that detector server is unlocked then lock
|
||||
CHECK(d.lockServer() == 0);
|
||||
d.lockServer(1);
|
||||
CHECK(d.lockServer() == 1);
|
||||
|
||||
// Can we still access the detector while it's locked
|
||||
auto t = 1300000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
|
||||
// unlock again and free
|
||||
d.lockServer(0);
|
||||
CHECK(d.lockServer() == 0);
|
||||
|
||||
CHECK(d.getLastClientIP() == my_ip);
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
// acquisitions is number or frames*number of cycles */ ACQUISITION_TIME,
|
||||
// /**< exposure time */ FRAME_PERIOD, /**< period between exposures */
|
||||
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
|
||||
// readout (in triggered mode) */ GATES_NUMBER, /**< number of gates per
|
||||
// frame (in gated mode) */ CYCLES_NUMBER, /**< number of cycles: total
|
||||
// number of acquisitions is number or frames*number of cycles */
|
||||
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
|
||||
// */
|
||||
|
||||
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||
// MEASUREMENTS_NUMBER,
|
||||
// FRAMES_FROM_START,
|
||||
// FRAMES_FROM_START_PG,
|
||||
// SAMPLES,
|
||||
// SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
|
||||
// STORAGE_CELL_NUMBER, /**<number of storage cells */
|
||||
// SUBFRAME_DEADTIME, /**< subframe deadtime */
|
||||
// MEASURED_PERIOD, /**< measured period */
|
||||
// MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||
// MAX_TIMERS
|
||||
|
||||
slsDetector d(type);
|
||||
d.setHostname(hostname);
|
||||
d.setOnline(true);
|
||||
|
||||
// Number of frames
|
||||
auto frames = 5;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
|
||||
|
||||
auto exptime = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == exptime);
|
||||
|
||||
auto period = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
|
||||
|
||||
if (type != dt::EIGER) {
|
||||
auto delay = 10000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) ==
|
||||
delay);
|
||||
}
|
||||
|
||||
if (type != dt::EIGER) {
|
||||
auto gates = 1;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||
}
|
||||
|
||||
auto cycles = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
|
||||
|
||||
if (type == dt::EIGER) {
|
||||
auto subtime = 200;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME,
|
||||
subtime);
|
||||
CHECK(d.setTimer(
|
||||
slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) ==
|
||||
subtime);
|
||||
}
|
||||
// for (int i =0; i!=frames; ++i)
|
||||
d.startAndReadAll();
|
||||
|
||||
d.freeSharedMemory();
|
||||
|
||||
// If we add a timer we should add tests for the timer
|
||||
CHECK(slsDetectorDefs::MAX_TIMERS == 19);
|
||||
}
|
||||
|
||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||
// SingleDetectorConfig c;
|
||||
// auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||
// slsDetector d(type);
|
||||
// d.setHostname(c.hostname);
|
||||
// d.setOnline(true);
|
||||
|
||||
// auto period = 1000000000;
|
||||
// auto exptime = 100000000;
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, 5);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
// d.startAndReadAll();
|
||||
|
||||
// auto rperiod =
|
||||
// d.getTimeLeft(slsDetectorDefs::timerIndex::MEASURED_PERIOD);
|
||||
// CHECK(rperiod == 0.1);
|
||||
|
||||
// d.freeSharedMemory();
|
||||
// }
|
||||
|
||||
TEST_CASE(
|
||||
"Eiger Dynamic Range with effect on rate correction and clock divider",
|
||||
"[.eigerintegration]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
int ratecorr = 125;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
|
||||
// ensure eiger detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
|
||||
|
||||
// starting state with rate correction off
|
||||
CHECK(m.setRateCorrection(0) == 0);
|
||||
|
||||
// dr 16: clk divider, no change for ratecorr
|
||||
CHECK(m.setDynamicRange(16) == 16);
|
||||
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 1);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
|
||||
// dr 32: clk divider, no change for ratecorr
|
||||
CHECK(m.setDynamicRange(32) == 32);
|
||||
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 2);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
|
||||
// other drs: no change for clk divider, no change for ratecorr
|
||||
CHECK(m.setDynamicRange(8) == 8);
|
||||
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 2);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
CHECK(m.setDynamicRange(4) == 4);
|
||||
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 2);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
|
||||
// switching on rate correction with dr 16, 32
|
||||
m.setDynamicRange(16);
|
||||
m.setRateCorrection(ratecorr);
|
||||
CHECK(m.getRateCorrection() == ratecorr);
|
||||
m.setDynamicRange(32);
|
||||
CHECK(m.getRateCorrection() == ratecorr);
|
||||
|
||||
// ratecorr fail with dr 4 or 8
|
||||
CHECK_THROWS_AS(m.setDynamicRange(8), sls::NonCriticalError);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
m.setDynamicRange(16);
|
||||
m.setDynamicRange(16);
|
||||
m.setRateCorrection(ratecorr);
|
||||
m.setDynamicRange(16);
|
||||
m.setRateCorrection(ratecorr);
|
||||
CHECK_THROWS_AS(m.setDynamicRange(4), sls::NonCriticalError);
|
||||
CHECK(m.getRateCorrection() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
|
||||
|
||||
uint64_t word = 0;
|
||||
int addr = 0;
|
||||
int level = 0;
|
||||
const int MAX_ADDR = 0x7fff;
|
||||
|
||||
word = 0xc000000000f47ff;
|
||||
CHECK(m.setPatternIOControl(word) == word);
|
||||
CHECK(m.setPatternIOControl(-1) == word);
|
||||
CHECK(m.setPatternIOControl(0) == 0);
|
||||
|
||||
CHECK(m.setPatternClockControl(word) == word);
|
||||
CHECK(m.setPatternClockControl(-1) == word);
|
||||
CHECK(m.setPatternClockControl(0) == 0);
|
||||
|
||||
// testing pattern word will execute the pattern as well
|
||||
addr = 0;
|
||||
m.setPatternWord(addr, word);
|
||||
CHECK(m.setPatternWord(addr, -1) == word);
|
||||
addr = MAX_ADDR - 1;
|
||||
m.setPatternWord(addr, word);
|
||||
CHECK(m.setPatternWord(addr, -1) == word);
|
||||
addr = 0x2FF;
|
||||
m.setPatternWord(addr, word);
|
||||
CHECK(m.setPatternWord(addr, -1) == word);
|
||||
addr = MAX_ADDR;
|
||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::NonCriticalError);
|
||||
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
addr = -1;
|
||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::NonCriticalError);
|
||||
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
|
||||
addr = 0x2FF;
|
||||
for (level = 0; level < 3; ++level) {
|
||||
CHECK(m.setPatternWaitAddr(level, addr) == addr);
|
||||
CHECK(m.setPatternWaitAddr(level, -1) == addr);
|
||||
}
|
||||
CHECK_THROWS_WITH(m.setPatternWaitAddr(-1, addr),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
CHECK_THROWS_WITH(m.setPatternWaitAddr(0, MAX_ADDR),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
|
||||
for (level = 0; level < 3; ++level) {
|
||||
CHECK(m.setPatternWaitTime(level, word) == word);
|
||||
CHECK(m.setPatternWaitTime(level, -1) == word);
|
||||
}
|
||||
CHECK_THROWS_WITH(m.setPatternWaitTime(-1, word),
|
||||
Catch::Matchers::Contains("be between 0 and"));
|
||||
|
||||
{
|
||||
int startaddr = addr;
|
||||
int stopaddr = addr + 5;
|
||||
int nloops = 2;
|
||||
for (level = 0; level < 3; ++level) {
|
||||
m.setPatternLoops(level, startaddr, stopaddr, nloops);
|
||||
auto r = m.getPatternLoops(level);
|
||||
CHECK(r[0] == startaddr);
|
||||
CHECK(r[1] == stopaddr);
|
||||
CHECK(r[2] == nloops);
|
||||
}
|
||||
m.setPatternLoops(-1, startaddr, stopaddr, nloops);
|
||||
auto r = m.getPatternLoops(-1);
|
||||
CHECK(r[0] == startaddr);
|
||||
CHECK(r[1] == stopaddr);
|
||||
CHECK(r[2] == -1);
|
||||
|
||||
CHECK_THROWS_WITH(m.setPatternLoops(-1, startaddr, MAX_ADDR, nloops),
|
||||
Catch::Matchers::Contains("be less than"));
|
||||
CHECK_THROWS_WITH(m.setPatternLoops(-1, MAX_ADDR, stopaddr, nloops),
|
||||
Catch::Matchers::Contains("be less than"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegration][dbit]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
|
||||
|
||||
// dbit offset
|
||||
m.setReceiverDbitOffset(0);
|
||||
CHECK(m.getReceiverDbitOffset() == 0);
|
||||
m.setReceiverDbitOffset(-1);
|
||||
CHECK(m.getReceiverDbitOffset() == 0);
|
||||
m.setReceiverDbitOffset(5);
|
||||
CHECK(m.getReceiverDbitOffset() == 5);
|
||||
|
||||
// dbit list
|
||||
|
||||
std::vector <int> list = m.getReceiverDbitList();
|
||||
list.clear();
|
||||
for (int i = 0; i < 10; ++i)
|
||||
list.push_back(i);
|
||||
m.setReceiverDbitList(list);
|
||||
|
||||
CHECK(m.getReceiverDbitList().size() == 10);
|
||||
|
||||
list.push_back(64);
|
||||
CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::RuntimeError);
|
||||
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
|
||||
Catch::Matchers::Contains("be between 0 and 63"));
|
||||
|
||||
list.clear();
|
||||
for (int i = 0; i < 65; ++i)
|
||||
list.push_back(i);
|
||||
CHECK(list.size() == 65);
|
||||
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
|
||||
Catch::Matchers::Contains("be greater than 64"));
|
||||
|
||||
list.clear();
|
||||
m.setReceiverDbitList(list);
|
||||
CHECK(m.getReceiverDbitList().empty());
|
||||
|
||||
// adcinvert
|
||||
m.setADCInvert(0);
|
||||
CHECK(m.getADCInvert() == 0);
|
||||
m.setADCInvert(5);
|
||||
CHECK(m.getADCInvert() == 5);
|
||||
m.setADCInvert(-1);
|
||||
CHECK(m.getADCInvert() == -1);
|
||||
|
||||
// ext sampling reg
|
||||
m.setExternalSamplingSource(0);
|
||||
CHECK(m.getExternalSamplingSource() == 0);
|
||||
m.setExternalSamplingSource(62);
|
||||
CHECK(m.getExternalSamplingSource() == 62);
|
||||
CHECK_THROWS_WITH(m.setExternalSamplingSource(64),
|
||||
Catch::Matchers::Contains("be 0-63"));
|
||||
CHECK(m.getExternalSamplingSource() == 62);
|
||||
m.setExternalSampling(1);
|
||||
CHECK(m.getExternalSampling() == 1);
|
||||
m.setExternalSampling(0);
|
||||
CHECK(m.getExternalSampling() == 0);
|
||||
m.setExternalSampling(1);
|
||||
CHECK(m.getExternalSampling() == 1);
|
||||
CHECK(m.readRegister(0x7b) == 0x1003E);
|
||||
|
||||
}
|
110
integrationTests/test-integrationMulti.cpp
Executable file
@ -0,0 +1,110 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace Catch::literals;
|
||||
|
||||
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||
auto hostnames = sls::split(hostname, '+');
|
||||
|
||||
multiSlsDetector d(0, true, true);
|
||||
d.setHostname(hostname.c_str());
|
||||
REQUIRE(d.setOnline() == true); // get!
|
||||
|
||||
CHECK(d.getHostname() == hostname);
|
||||
for (size_t i = 0; i != hostnames.size(); ++i) {
|
||||
CHECK(d.getHostname(i) == hostnames[i]);
|
||||
}
|
||||
|
||||
CHECK(d.getDetectorTypeAsEnum() == type);
|
||||
CHECK(d.getDetectorTypeAsString() == detector_type);
|
||||
|
||||
CHECK(d.getNumberOfDetectors() == hostnames.size());
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
multiSlsDetector d(0, true, true);
|
||||
d.setHostname(hostname.c_str());
|
||||
|
||||
// FRAME_NUMBER
|
||||
int n_frames = 3;
|
||||
d.setNumberOfFrames(n_frames);
|
||||
CHECK(d.setNumberOfFrames() == n_frames);
|
||||
|
||||
// ACQUISITION_TIME
|
||||
double exptime = 0.3;
|
||||
d.setExposureTime(exptime, true);
|
||||
CHECK(d.setExposureTime(-1, true) == Approx(exptime));
|
||||
CHECK(d.setExposureTime(-1) == Approx(exptime * 1E9));
|
||||
|
||||
// FRAME_PERIOD,
|
||||
double period = 0.5;
|
||||
d.setExposurePeriod(period, true);
|
||||
CHECK(d.setExposurePeriod(-1, true) == Approx(period));
|
||||
CHECK(d.setExposurePeriod(-1) == Approx(period * 1E9));
|
||||
|
||||
// DELAY_AFTER_TRIGGER,
|
||||
// GATES_NUMBER,
|
||||
// CYCLES_NUMBER,
|
||||
// ACTUAL_TIME
|
||||
// MEASUREMENT_TIME
|
||||
|
||||
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||
// MEASUREMENTS_NUMBER,
|
||||
|
||||
int measurements = 2;
|
||||
d.setTimer(ti::MEASUREMENTS_NUMBER, measurements);
|
||||
CHECK(d.setTimer(ti::MEASUREMENTS_NUMBER, -1) == measurements);
|
||||
|
||||
// FRAMES_FROM_START,
|
||||
// FRAMES_FROM_START_PG,
|
||||
// SAMPLES,
|
||||
|
||||
// SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
|
||||
double subframe_exposure = 2000000; // ns
|
||||
if (type == dt::EIGER) {
|
||||
d.setSubFrameExposureTime(subframe_exposure);
|
||||
CHECK(d.setSubFrameExposureTime(-1) == Approx(subframe_exposure));
|
||||
}
|
||||
|
||||
// STORAGE_CELL_NUMBER, /**<number of storage cells */
|
||||
|
||||
// SUBFRAME_DEADTIME, /**< subframe deadtime */
|
||||
double subframe_deadtime = 4000; // ns
|
||||
if (type == dt::EIGER) {
|
||||
d.setSubFrameExposureDeadTime(subframe_deadtime);
|
||||
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
|
||||
}
|
||||
|
||||
|
||||
if (type == dt::EIGER) {
|
||||
// 32bit is needed for subframe exposure
|
||||
d.setDynamicRange(32);
|
||||
CHECK(d.setDynamicRange(-1) == 32);
|
||||
d.setReadOutFlags(ro::PARALLEL);
|
||||
|
||||
// Needed to have measured values
|
||||
d.acquire();
|
||||
|
||||
// MEASURED_PERIOD, /**< measured period */
|
||||
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
||||
CHECK(d.getMeasuredPeriod(true, i) == Approx(period));
|
||||
}
|
||||
|
||||
// MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
||||
CHECK(d.getMeasuredSubFramePeriod(false, i) ==
|
||||
Approx(subframe_deadtime + subframe_exposure));
|
||||
}
|
||||
}
|
||||
|
||||
// MAX_TIMERS
|
||||
|
||||
d.freeSharedMemory();
|
||||
}
|
0
integrationTests/src/test.cpp → integrationTests/test.cpp
Normal file → Executable file
0
manual/Makefile
Normal file → Executable file
0
manual/index.html
Normal file → Executable file
0
manual/manual-api/CMakeLists.txt
Normal file → Executable file
0
manual/manual-api/Makefile
Normal file → Executable file
0
manual/manual-api/mainClient.cpp
Normal file → Executable file
12
manual/manual-api/mainReceiver.cpp
Normal file → Executable file
@ -19,18 +19,18 @@ It is linked in manual/manual-api from slsReceiverSoftware/include ]
|
||||
#include "sls_detector_defs.h"
|
||||
#include "slsReceiverUsers.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <signal.h> //SIGINT
|
||||
#include <csignal> //SIGINT
|
||||
#include <cstdlib> //system
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
//#include "utilities.h"
|
||||
//#include "logger.h"
|
||||
#include <cerrno>
|
||||
#include <string>
|
||||
#include <sys/types.h> //wait
|
||||
#include <sys/wait.h> //wait
|
||||
#include <string>
|
||||
#include <unistd.h> //usleep
|
||||
#include <errno.h>
|
||||
#include <syscall.h> //tid
|
||||
#include <unistd.h> //usleep
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
0
manual/manual-api/slsDetectorUsers.doxy
Normal file → Executable file
0
manual/manual-calwiz/Advanced.png
Normal file → Executable file
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
0
manual/manual-calwiz/Constant_step.png
Normal file → Executable file
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
0
manual/manual-calwiz/GUI_Advanced.eps
Normal file → Executable file
0
manual/manual-calwiz/GUI_ThresholdScan.eps
Normal file → Executable file
0
manual/manual-calwiz/Makefile
Normal file → Executable file
0
manual/manual-calwiz/addEnergy.eps
Normal file → Executable file
0
manual/manual-calwiz/addEnergy.png
Normal file → Executable file
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
0
manual/manual-calwiz/ancCal.tex
Normal file → Executable file
0
manual/manual-calwiz/angleFit.eps
Normal file → Executable file
0
manual/manual-calwiz/angleFit.png
Normal file → Executable file
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
0
manual/manual-calwiz/angularCalibrationHowTo.tex
Normal file → Executable file
0
manual/manual-calwiz/calibrateModule.eps
Normal file → Executable file
0
manual/manual-calwiz/calibrateModule.png
Normal file → Executable file
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
0
manual/manual-calwiz/calibrationWizardsHowTo.tex
Normal file → Executable file
0
manual/manual-calwiz/enCal.tex
Normal file → Executable file
0
manual/manual-calwiz/enable_angcal.eps
Normal file → Executable file
0
manual/manual-calwiz/eneble_angcal.png
Normal file → Executable file
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
0
manual/manual-calwiz/energyCalibrationHowTo.tex
Normal file → Executable file
0
manual/manual-calwiz/fig4.eps
Normal file → Executable file
0
manual/manual-calwiz/fig5.eps
Normal file → Executable file
0
manual/manual-calwiz/fig7.eps
Normal file → Executable file
0
manual/manual-calwiz/fig8.eps
Normal file → Executable file
0
manual/manual-calwiz/installation.tex
Normal file → Executable file
0
manual/manual-calwiz/peakFit.eps
Normal file → Executable file
0
manual/manual-calwiz/peakFit.png
Normal file → Executable file
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
0
manual/manual-calwiz/position_scan.eps
Normal file → Executable file
0
manual/manual-calwiz/position_scan.png
Normal file → Executable file
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
0
manual/manual-calwiz/setupAngcal.eps
Normal file → Executable file
0
manual/manual-calwiz/setupAngcal.png
Normal file → Executable file
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 264 KiB |